Tuesday, September 30, 2008

Extension Progress

So, I talked to Jono earlier today. He's decided to lead the porting Ubiquity to Thunderbird project himself, which is a good thing for me. There's now an experienced Mozilla developer at my disposal that's willing to help everyone involved with the project get it done.

In order to help steer everyone in the right direction, Jono told us to write a small extension for Thunderbird that displays a message box showing the infamous "Hello World!" message. Well, after following his links and reading a tutorial on how to create Firefox extensions, I have to say... it's not nearly as intimidating as I thought it would be. Creating the extension for Firefox was a breeze. After that, I decided it was time to "port" it over to Thunderbird. Well, porting it over was simple enough, but there were definitely some differences between some of the information in my Firefox version and my Thunderbird version.

Ok, so I had to change the following in my chrome.manifest:

chrome://browser/content/browser.xul

To:

chrome://messenger/content/messenger.xul

That's a no brainer.

This is the part that stumped me for a little while. I didn't understand why my extension wasn't showing up in the Tool menu. Well, I should have guessed right off the bat that menupopup ids are different in Firefox than they are in Thunderbird. So I used:

menupopup id="taskPopup"

Instead of:

menupopup id="menu_ToolsPopup"

In my overlay.xul.

Now I just need to play around with my extension and make it do something "fancier" than displaying "Hello World!"

Sunday, September 28, 2008

Project Update

There's really not too much to say at this point. So far for this week I've been exploring both Thunderbird and Firefox to determine where extensions are installed. With the help of a classmate, Jason Tarka, I was able to get a head start on doing this. Unfortunately, with other things on the go for this week, I haven't been able to do too much beyond playing around with extensions.

I'm hoping to make this up coming week a solid work week for this project once I get some kinks worked out with Thomas Brown. Hopefully my Blog next week will be a little longer than this.

OSD600 Week 4 Labs

So our task for this week in OSD600 was to find out how a functionality worked in Firefox searching through the source code, and to apply a patch to Firefox. Applying a patch was very simply and straight forward, however, I found searching through the Firefox code slightly annoying.

To start off, I'll talk about patching. Patching was very simple and straight forward. I simply followed Mozilla's instructions to patch Firefox, and everything worked magically. There were very little problems using their commands to apply patches. One thing I did run into was my hg command wouldn't work when attempting to create a diff. The error message I received was "abort: There is no Mercurial repository here (.hg not found)!" I'm going to assume that's because I never downloaded my Firefox source using mercurial. Oh well, cvs worked... so that's fine. My main focus for this semester isn't Firefox anyways, it's Thunderbird. The hg command seems to work fine there.

All in all, patching was a breeze.

Now, I decided to search for source code based upon the back button. Despite hearing that it's usually not a good idea to post source code in a Blog, I'm going to completely ignore that and do it anyways. These were some of the "interesting" findings I found when searching through the source code for the Back Button:

/toolkit/content/widgets/browser.xml || webNavigation.canGoBack
/browser/base/content/tabbrowser.xml || this.mCurrentBrowser.goBack()
/browser/base/content/browser.js

1410 function BrowserBack(aEvent) {
1411 var where = whereToOpenLink(aEvent, false, true);
1412
1413 if (where == "current") {
1414 try {
1415 gBrowser.goBack();
1416 }
1417 catch(ex) {
1418 }
1419 }
1420 else {
1421 var sessionHistory = getWebNavigation().sessionHistory;
1422 var currentIndex = sessionHistory.index;
1423 var entry = sessionHistory.getEntryAtIndex(currentIndex - 1, false);
1424 var url = entry.URI.spec;
1425 openUILinkIn(url, where);
1426 }
1427 }




/docshell/base/nsIWebNavigation.idl

/**
48 * The nsIWebNavigation interface defines an interface for navigating the web.
49 * It provides methods and attributes to direct an object to navigate to a new
50 * location, stop or restart an in process load, or determine where the object
51 * has previously gone.
52 *
53 * @status UNDER_REVIEW
54 */


[scriptable, uuid(F5D9E7B0-D930-11d3-B057-00A024FFC08C)]
56 interface nsIWebNavigation : nsISupports
57 {
58 /**
59 * Indicates if the object can go back. If true this indicates that
60 * there is back session history available for navigation.
61 */
62 readonly attribute boolean canGoBack;


/**
71 * Tells the object to navigate to the previous session history item. When a
72 * page is loaded from session history, all content is loaded from the cache
73 * (if available) and page state (such as form values and scroll position) is
74 * restored.
75 *
76 * @throw NS_ERROR_UNEXPECTED
77 * Indicates that the call was unexpected at this time, which implies
78 * that canGoBack is false.
79 */
80 void goBack();



/browser/locales/en-US/chrome/browser/browser.dtd (View Hg log or Hg annotations)

* line 72 --






The interesting thing that I noticed is that there doesn't seem to be one place where "GoBack" is defined. It seems that the page back functionality is defined multiple times throughout the source code, which seems a bit messy to me. Perhaps there is one specific place that GoBack is defined absolutely, but I just couldn't seem to find it.

One other interesting thing I did find was there seemed to be two different back functionalities for "Browser" and "Browser Tabs". It makes more sense to me that "Browser Tabs" GoBack was what I was mainly looking for, because the majority of my browsing is done through Firefox tabs. Also, if you take a look at some of the source code I posted above, example here:

[scriptable, uuid(F5D9E7B0-D930-11d3-B057-00A024FFC08C)]
56 interface nsIWebNavigation : nsISupports
57 {
58 /**
59 * Indicates if the object can go back. If true this indicates that
60 * there is back session history available for navigation.
61 */
62 readonly attribute boolean canGoBack;

Throughout the Mozilla source code there's continuous checks on the GoBack functions to determine whether or not the tab in question can actually go back. Naturally, this just makes sense.

All in all, searching through the Firefox source code seemed to be time consuming, as well as confusing at times. The hardest part was determining where the "Beginning" and "End" of the GoBack function actually occurred. Right now, I'm still not too sure where it actually "begins". However, finding everything in between was fairly simple.

Sunday, September 21, 2008

Building Firefox

Where to begin...

Suppose I'll start off by saying that building Firefox wasn't an overly challenging experience. The majority of my problems building it for the first time came from the Mozilla Build failing to work properly on Windows Vista. To put things simply, after installing all of the required addons (mainly the required SDKs), the Mozilla Build start batch files could not find Visual Studio.

I decided to do some probing in my registry and found that the entries Mozilla Build was looking for simply weren't there. Ok that's no problem, I'll just add them in. I start up the start batch file again, everything startings working great, but then I get this error:

"Unexpected \Microsoft"

Around this time, I've been fighting with the Mozilla Build and Windows Vista for about 3 days trying to figure out exactly what was going wrong. I started to think to myself, "I bet it's Vista." I had the suspicion that Mozilla Build just wasn't working properly with Vista, so I decided to try it out on Windows XP.

So I look at all the extras I need to install for Mozilla Build to work once again. I look at one of the required packages, and it's listed by Microsoft as a Vista package. Well, I'm on Windows XP, so I probably won't need it. I run Mozilla Build's start batch file, and it fails. So I figure, I'll just install the package and see what happens. I download and install, run the Mozilla Build start batch file, everything runs perfectly.

After that point, unpacking and building Firefox with my own mozconfig was a breeze. I did run into one strange anomoly while attempting to run my build of Firefox. I received an exception saying something in a cpp file on line 811 (didn't document this error so I'm not sure of the exact message) was not handled. At the same time this happened, a window from McAfee anti-virus popped up asking me if I wanted to enable secure browsing. I clicked on the Ignore button in the error dialog and told McAfee no I don't want this feature. Each time I loaded my Firefox build the exact same thing would happen every time. Same error message would appear, McAfee would pop up.

Well I'm sure you'll never guess what happened when I disabled McAfee. The error message went away. Ok so apparently running my build of Firefox doesn't like it when McAfee interferes during start up. That's fine, I don't need McAfee running anyways when I start up my build of Firefox.

So after many days of frustration struggling with Vista, I caved in and did my build on XP. After a little bit of poking with my build, all runs well. I might attempt to build on Vista at a later point, but right now I just can't be bothered. It's more frustration than what it's worth at this point in time. I'll probably tackle Vista again in another week.

Friday, September 19, 2008

Making Ubiquity Work In Thunderbird

So a little while back I commented on our OSD600 class being introduced to Ubiquity. I went through our class' potential project list, and decided that "porting" Ubiquity over to Thunderbird sounded like it would be a fun challenge. I'm sure at present it's probably completely out of my scope of knowledge, but I'll do my best to try to best this challenge.

Thankfully, I'm not alone. I'm partnering up with a classmate named Thomas Brown, who seems to be quite enthusiastic about the project. Once we get moving on this, I'll be sure to keep the project page updated at least twice a week.

Until then... I'm off to attempt to make this work and learn a lot from it.

Thursday, September 11, 2008

My First Experience With Firefox's Ubiquity

So, our OSD600 class was introduced to a Firefox addon called Ubiquity. It's an interesting addon that allows users to create their own scripting commands, or download and use scripting commands written by others. It also appears that you have to be extremely cautious when you add another person's Ubiquity command, as the scripts have enough power to harm your system. Fortunately, every time before you download a new script, a warning message is displayed and you can view the source code for the script to check whether or not the script may be doing something malicious.

I wrote a very simple command that adds in a delay before sending a message to the user. Here is the code:

CmdUtils.CreateCommand({
name: "Timer",
author: "Scott Lunel",
takes: {"Time": noun_arb_text},
preview: "A simple timer that executes a message to the user after the entered time period.",
execute: function(directObj) {

Utils.setTimeout(function() { displayMessage("Time's Up!"); }, parseInt(directObj.text));

}
})

Nothing fancy. However, without knowing anything about Ubiquity, and being extremely rusty at Javascript (Ubiquity scripting is very similar to Javascripting) I was able to figure out how to write a simple display command within a couple of minutes. Finding the best command to use for the delay time took a bit longer, but over all it appears that writing simple commands is very easy to learn.

Personally, I don't think I'll be using Ubiquity very much. I use my browser to browse. I don't usually write scripts or commands for my browser. However, that might change as I progress in OSD600. There's quite a lot I need to learn about Firefox, and it could just be my limited knowledge that's preventing me from using the browser beyond it's basic function.

Wednesday, September 3, 2008

Open Source exploration.

Open source is a topic I've been aware of for quite some time, but I never really took a look at it closely. When I first heard about the OSD600 course, I thought it would be interesting to work on something someone else has developed and help expand upon it. I was first introduced to this in my JAC444 course with Peter Lui. We did a small project on an open source Java project called Robocode. I enjoyed working on Robocode, however, I found that searching through the source code to find what I wanted to be quite a pain. I'm sure reading another program's source code to find out where to begin or what you want to get from it to be the hardest part of writing for an open source project. Once I accomplished this, I did find the project enjoyable.

I have to commend Richard Stallman for founding the free software movement. Providing free software, getting people to build upon it, and evolving a community out of it can definitely create a strong bond between people. If his feelings are genuine I'd have to say that what he really wants is a society that interacts in this manner, not just from a software development perspective. While it would be nice if all software created could be maintained, updated, and distributed for free by the very users that use the software, this does not make sense from a corporate perspective. Unfortunately, a large portion of people believe that living in society is all about the size of your wallet. If you're looking to live in luxury, this is definitely true.

One thing I didn't realize was that there was a difference between "free software" and "open source". I always associated distributing a software application's source code as being the equivalent of making it free. After receiving a detailed explanation of the open source movement, I must say that it does make sense. Allow the users, or co-developers as it was put, help maintain and update the software they like to use. With a much larger "development" and tester base, it's easier to find and squash bugs, effectively making bugs that would appear to be huge problems into shallow nothings. While this does defy the very foundation upon which software engineering is built upon, I never believed there was a definite method for anything. There's always bound to be something that proves an absolute dictated by someone else to be false.

Also, I found the history behind Mozilla to be quite interesting. I wasn't aware that Mozilla originated from Netscape releasing their source code to their browser. I must say, that's quite the bold business move on their behalf.

Considering the amount of material that was thrown at me through these readings and documentaries, I could probably sit here and write about my thoughts all day. Instead I think I'll end things now and possibly expand upon my thoughts in future blogs. What I have written about here were the main points that caught my attention.

Will definitely be writing more later...

Tuesday, September 2, 2008

Created my first blog page.

I created this Blog for the OSD course I'm currently enrolled in at Seneca College. I will add more Blogs when I have time.