Writing software, the wrong way

Wednesday, February 27, 2008

Using Venkman to combat terrorism and save freedom

Venkman has been a big help during this release, and it something that I want to share. I have been avoiding using a javascript for a while, and that's mainly because I opted to use alert() and dump() instead. But after a while, they both suck and can make debugging incredibly frustrating especially if you have to restart firefox each time to go one step ahead.

Introduction
It's been out since 0.9 folks!


Install
Grab the extension

Setting it up
  • Under Debug menu, make sure "Exclude Browser Files" is not checked.
  • Under the File menu, check "Save Break/Watch Settings on Exit".

Setting Breakpoints
This is reasonably simple. On the left are your files. Here I am debugging ProxyEnable.js.

Below it are the functions within that file. Double-clicking on the filename brings up the source code on the right.
  1. Place your breakpoints. The dashes near the left side of the source are where you can put your breakpoints. Here I am putting a breakpoint just before the if-statement.
  2. Exit venkman (this will close firefox)
  3. Relaunch firefox with -venkman argument. For example :
    /path/to/firefox -venkman --no-remote -profile /path/to/profile

Once you restart, venkman starts first and catches any breakpoints.

This is ideal when you can't use browser chrome to initiate the javascript, for example, js code that is executed on startup.

Fun
Once the debugger breaks, you have access to all the variables. So you can start investigating the problem much more effectively than with dump. You use the black window at the bottom as an interactive javascript shell.


Navigation
The buttons at the top let you go to the next line, go deeper into js functions, or continue. Try them out.


Now Code
No more excuses.

Saturday, February 23, 2008

x86_64 woes

I now have an amd64 (Sempron) desktop and an emt64 (Core 2 Duo) laptop and fully 64-bit and Y2K38 ready, which I am quickly finding out that it doesn't get it's share of love.

For example, Firefox/Thunderbird nightlies and OpenOffice don't have x86_64 builds. Now, if you have a 32-bit OS on a x86_64 architecture, it's ok and you can emulate. But if your running x86_64 without 32-bit libraries, your in trouble.

Fortunately, my desktop is equipped with Ubuntu, and the greatest package manager, ever.
All you should need to do is :

sudo apt-get install ia32-libs
sudo apt-get install ia32-gtk


This runs prism with a few warnings about an unsupported locale or something. Which is a lot better than compiling it from source.

My laptop however uses BlueWhite64, and I by slackwarian code (this is a complete lie), must compile everything from source. Unfortunately, here I don't have any of the 32-bit libs. So that's a lot of compiling. I wonder if it's even worth it. I'm fairly tempted to just skip it and download the i386 packages. But that would be taking the ubuntu way out, and I'm likely to get lynched by people like me.

Monday, February 18, 2008

Dynamic Proxy Settings

There were three things I was planning on doing for the previous release that didn't get finished, and something extra that I didn't plan on doing and probably won't be done (priorities and such) but interesting to know that it exists.

  • Proxy Settings using group policy

  • Disable changing the proxy settings

  • Create some Javascript Wrappers around the XPCOM components for locating/reading registry keys


Proxy Settings using Group Policy
This was something that almost everyone that commented said was an important policy to them. I think I only once had to ever use a proxy (I wanted to watch a John Stewart clip from a website then wouldn't let me in, so I had to proxy to an American server to view it). Regardless, if it's the most popular request, I'll do what I can.
I have it working for http:// sites. Still need to make changes for the other protocols. Mossop also taught me a lesson that <preferences> requires a <prefwindow>. That's going to be a problem when you have to use <overlay>'s instead of a prefWindow, so I had to use an nsIPrefBranch instead. On the lighter side, I can refactor and finally have an excuse to use FUEL.

Disable changing the proxy settings
nsIPrefBranch supports locking preferences so that the user cannot change them in about:config or in the UI (it will grey out the settings).

Unfortunately, you can only lock the default value. Which kinda sucks at the moment. The other two alternatives is to make the option of changing your proxy greyed out or hidden. IE7 has it's own tab for connection which completely disappears with the right policy enabled. Since Firefox's proxy settings is located in the same UI tab as offline storage, it is probably best for us to disable the button. To avoid allowing people to change the settings via about:config, we would have a policy to disable about:config access (get back to me on this, I don't have an answer on how we can do that yet).

Javascript Wrappers around the XPCOM components for locating/reading registry keys
I started doing some work on doing some JS wrappers around registry keys, since I dislike the current implementation to a certain degree. I won't go into details, because it's more of a preference then anything else.

I'll end with an amusing quotation.
And _please_ file bugs when you hit problems like this. I flunked long-distance widebeam telepathy in college, so I'm no good at just guessing that you're running into problems...
-- Boris Zbarsky

Wednesday, February 6, 2008

Generic IE policies in Firefox

This is something neat that I cannot take credit for. I just put it in a tree-friendly extension. I got the source onto an svn repository for people to play around with :

svn://cdot.senecac.on.ca/ff-ad

I put up some slightly more detailed steps into the wiki on how to set up Firefox. In the meantime, some explanation of what IE settings means for Firefox.

IE has several policies that Firefox can use, for example you can disable tabs and the help menu. Below we have the example of turning off the help menu

Ignore the bit about IE for a moment.

If you open up Firefox, you get the predicted results

Which is ok. If you look elsewhere, you'll see that not all the help functionality is disabled.

Which is something that still needs to be fixed. I also found some javascript errors that I would like to fix as well.

But the problem now is the overwhelming amount of policies in place. Mike's blog should help me out a fair bit with this, as he has got some response. More updates as this goes along.

==UPDATE==
So I was a little bit wrong. If you read the entire IE policy, it doesn't explicitly say that all help functionality will be turned off. To make a liar out of me, you can go into Options and click on the question mark at the top-right corner and help will popup. Just the help menu is disabled it seems (and F1).

Wednesday, January 30, 2008

Back on the yellow brick road

After a series of unfortunate events, things seem getting better. I got enough back that I can start working again.

I started looking through some of FirefoxADM and WetDog code a while back, and I have been grossly misjudged these programs. Neither of them actually turned out to be extensions. This isn't a bad thing actually. FirefoxADM seems to be a fancy visual basic script that reads the registry and makes pref changes. WetDog is some C++ code (I haven't analyzed it too closely).

One of the things that I was worried about early on was redoing the work that has already been done. That doesn't look like it's going to happen. However, now the thing is trying to get enough work done for the next release.

Mike Kaply has started doing some work on using overlays to disable certain functionality, and loading those overlays dynamically. I need another copy of that program, put it into an extension if it's not already, and lubricate the firefox tree and jam it in. I also want to be able to set those overlays based on some registry values (there is a big fuss in bugzilla on where these key/value pairs should be. But that seems to have gotten in the way of getting actual work done).

This will probably be a giant hack, but it will be a good start. And it can be refined later as the semester goes.

Also, Mike made a useful blog post getting comments from people who have enterprise experience trying to figure out what enterprises would like to see. This will do until I can find some enterprises to collaberate with.

Monday, January 14, 2008

A leap of faith

For the next three and a half months, I will be working on integrating Active Directory into Firefox. This may come as a shock (or not), but after working on Linux for anything remotely productive in the past 3 years, my Windows knowledge could use a fair bit of upgrading.

Why is Active Directory special?
It isn't useful for the general public, but rather for Enterprise administrators who want to control the preferences of the browser. For example, let's say you want to have a default homepage for Firefox. How can you do this without going to each machine and setting the preference? Without re-imaging (Seneca's solution)?

Setting homepage for IE7 (don't ask why it says IE6)

Well, you can do it Firefox, sorta. You need to download an extension, at the very least. I haven't actually tried it. I may be wrong. And it is probably more complicated than that.

The solution seems to be Active Directory and Group Policies. Or it seems to be anyways. The concept is still new to me, but this is the next few months of work. It is not only required piecing this stuff together (and maybe some upgrading), but also working at it until it gets to the tree. I will hopefully understand Andrew's pain.

My first release will be learning about GPO, and starting to take apart extensions like CCK and FirefoxADM. I will have some documentation, definitely up on the wiki

An introduction

Firstly, an introduction.

My name is Cesar Oliveira. I am my 4th year of a Bachelors of Software Development at Seneca College. That is really all you need to know about me.

I have decided to make this blog, separate from my wordpress blog, mainly because I can more freely post here without spamming planet@mozilla. I will still post in wordpress, if the announcement I feel needs to reach more people.

This blog will mainly deal with my experience working with Mozilla. I have been working with Mozilla (both as a intern and as a volunteer). I am now doing a project as part of a course.