Thursday, February 18, 2010

Enabling Firefox Tabs to load Homepage

For the past week I've been quietly working on enabling Firefox tabs to load a home page. By working on this task its shown me how important it is to be able to skim through huge amounts of code in order to find that small portion that affects or does what you are looking to change. So I'll get right into it!

The task was to achieve two things:

1) Enable a homepage to load whenever a new tab is created
2) Enable the user to optionally set the tab to open this homepage on creation or to
remain with the standard blank page

Surprisingly enough the second objective came along pretty easy! So if you've ever changed your homepage in firefox you would be familiar with the this:


If you look carefully you can see that my home page is set to "http://www.xbox.com", so whenever I open a browser window it will automatically open up to that website. Now in order to proceed further I will need to know where the homepage string is stored and for this I took up a torch and ventured into the "den of dragons":



This tool is real nifty in the fact that I can use it to search for different components of the Firefox browser. Since we are trying to customize a homepage load up for a tab I figured I'd search up browser.startup, lo and behold I got the following:


Notice anything familiar in those results? Check out the highlighted function and look at the value...it should look familiar now. This variable "browser.startup.homepage" holds a string variable for the home page's URL! Now I know I'm getting somewhere. Now I know where the homepage is actually stored. With this information I searched the Mozilla repository for it and I got the following results:


Weaving through all of these results was both tedious and time consuming but I eventually came across a file that contained the use of browser.startup.homepage. Looking at lines 199 - 203 you can see how an integer value is used to determine the action of the browser's startup, if you look again at the earlier screenshots showing the browser variable search from the "dragon's den" you'd notice that browser.startup.page has a value of '1' which then asks it to call "browser.startup.page" function which uses that string value in the browser.startup.homepage variable. Whew! I've done some testing and by changing the integer variable I can manipulate the actual action taken when the browser starts up.


Even though I now know how to manipulate a browsers homepage it still leaves out the tab function which is what I really want to manipulate. This is where my progress had temporarily come to a halt....until I happened across a colleagues blog in my OSD600 class. Scott Downe has also been working on the Firefox tab tweak and has made progress in the area in which I'm having trouble with. For now I will take a break from actual testing and contact Scott to better understand how Firefox tabs are called in the code and also share what I've come to understand thus far. (There's that Open Source collaboration coming into play :P )

Hopefully in the near future I will be able to post a success story but for now I gotta get back to work on my Release 0.1 which I should be releasing a status post for later today!

Thursday, February 11, 2010

Initial Project Plan

For my semester assignment I’ve chosen to contribute to the Processing for the Web project which is an ongoing work that is porting the Processing language to be the open web.

Background of Processing.js

Although the project is based around the processing.js language it is important to know the origins of this language port. Processing is an open source programming language that was developed for the purpose of teaching the basics of computer programming from a visual perspective. The Processing language was started by Ben Fry and Casey Reas in 2001, both of which were a part of the MIT Media Lab’s Aesthetics and Computation Group. A few years later in the summer of 2008 John Resig, the creator of the jQuery, ported the Processing language (which was based in Java) to Javascript for use in web pages.

Importance of Processing.js

Currently if one wants to implement animations in their browser they would have to install a plug-in, whether it is Macromedia Flash, Java and Microsoft Silverlight. But what if there was a way to run these animations without having to take that extra time to install a plug-in to do so? Wouldn’t that be convenient and make life easier? Well there is! With processing.js all of the implementation for animation can be done from the javascript running on your browser, ultimately eliminating the need for a plug-in to do the implementation for you. Not only is processing.js eliminating the need for additional plug-ins but it also is eliminating the issue of browser compatibility as the language is running on all of the major browsers such as Firefox, Safari and Internet Explorer (although with Internet Explorer they would have to use ExplorerCanvas).

What Will I Be Doing?

Why did I choose this project? I believe mainly for the fact that my job will consist of actually trying to break something as opposed to fixing it. For the project I will be creating a test suite that will test processing.js functions that are currently being ported through the parser to ensure that they work properly after the port process. For this I will have to develop lots and lots of simple tests to put each of the functions through. In doing so I will try to keep with the following timeline for my releases to the best of my ability:

0.1 Release – February 19th, 2010

0.2 Release – March 19th, 2010

0.3 Release – April 9th, 2010

For progress on my project you can follow on my wiki project page, I’ll keep my blog updated with breakthroughs and pitfalls, and maybe...just maybe…some ranting. Since my task encompasses creating tests for the functions used in processing.js I’m pretty sure my releases 0.2 and 0.3 will more than likely change. For the time being I will go with the following outline:


Release 0.1

Focus on completing tests for functions that are of high priority for the project in terms of close to completion by other members. For this I will have to communicate with others working on the actual porting of the code to find out which functions need immediate attention.


Release 0.2

To Be Specified**

I’m looking at completing less important functions after the important functions have tests created for them. An additional functionality will be added to the test suite to work with unit tests (unsure if this has been done yet, will update this release goal if it has)

Release 0.3

Test suite will be able to perform tests for all functions in the processing.js library. As I may be changing the goals of Release 0.2 there will be an added functionality which will be incorporated into the test suite.


Required Learning

For this project I will need to have a basic understanding of the following:

Javascript – it plays an important role in the project as it is the language in which the processing language will be ported into so I will need to know the basics of Javascript in order to write my tests and to debugging.

Processing - I will need to learn processing since it is the language that processing.js was ported from. To have an a basic understanding of this language will prove valuable for my work in the same light as Javascript as I would need to know which functions translate into what on the Javascript side.

Processing Developer Environment – familiarizing myself with how to use this development environment will allow me to actually use the functions to do some testing and debugging.

To acquire knowledge on these topics I will resort to the following:


Processing Resources

http://processingjs.org/reference

http://ejohn.org/

http://processing.org


Javascript Resources

“Learning Javascript” by Shelley Powers

http://javascript.internet.com/


Collaboration and Contact

As my task requires me to write many tests I would appreciate any input regarding to scenarios in which a function may crash, it’s not possible for one person to look at an issue from every angle so having others contribute ideas and scenarios will help cover areas that may escape me. In terms of contributing I’m keen on doing cross platform testing and debugging javascript since I will be using the language quite a bit this semester.


Barriers and Obstacles

For this project I’ve got a personal barrier that has stuck with me for a while. First off I’m easily intimidated by work that seems complex or beyond what I feel I’m capable of. When I’m faced with this not only do I get frustrated but I try to fix it on my own without asking for advice or assistance which results in time being wasted achieving a small task that could have been done in seconds should I have asked for assistance. To help with this barrier I will try to utilize IRC more and collaborate with others instead of struggling on my own wasting invaluable time.

Thursday, February 4, 2010

The Dark Tunnel..........

So it's been a while since I last posted, been wandering in a real dark "tunnel" trying to build the environment for Firefox. I first took a look at the MDC wiki on building FireFox for a Windows platform. From first sight it was, to put it mildly, tedious. In order to get my platform ready to build this environment I had to go and download a few a things:

- Microsoft SDK for Windows 7
- VisualStudio 2005/2008 (I chose 2008)
- The current mozilla-build file

Downloading three files might not seem to be much but when two of three files are more than two gigabytes then you can understand my frustration. Three hours later everything was prepped and installed, building the environment would be a cinch, or so I thought. After following the MDC wiki I ended up in a shell that was created to simulate a linux environment (start-msvc9.bat). In order to build Firefox on my system I needed to retrieve a clone from the mercurial that would produce a localized copy of the mozilla-central repository on my system. After issuing the command: "make -f client.mk build" the system beginning running tests to ensure that I had the necessary components installed and configured.

Enter my first headache, for a strange reason the test failed to identify the C compiler on my machine, after an hour of trying to figure it out I decided to google up error to find out if others had experienced the same problem as I had. After doing a bit of research I found out that the problem could be resolved by editing the PATH environment variable in the system properties.

After solving this I figured it would be smooth sailing but that was not the case. Enter headache #2, this little error that I picked up when attempting to build on my fourth try:

Adding configure options from /c/mozilla-central/mozconfig:
--enable-application=browser
--disable-optimize
--enable-debug
--enable-tests
configure: error: System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.
make[1]: *** [configure] Error 1
make: *** [/c/mozilla-central/ff-dbg/Makefile] Error 2

After carefully reading this error message I knew that my system lacked the atlbase.h header file which is necessary in order for the building to be completed. I followed the link which directed me to another link that ultimately landed me on this page. Seeing as my system is a 64 bit OS the only version of the header file that would work was the PSDK-amd64.exe. After installing the missing files I attempted to build again and my result was as follows:


Then I navigated into my obj-dir folder nicknamed ff-dbg and searched for the mozilla or firefox executable:



Issuing the command to start it with the profile manager and the build FireFox Browser (which looks identical to the one I normally use):