Using Javascript variables in Global Scope

Yesterday, we faced a strange problem with firefox addons. We had a addon that was working perfectly on firefox 3.5 but not on firefox 3.6.

As we glanced through, we could notice there were no such Components that was relying particularly on firefox 3.5. So, here we had, a perfectly working addon on 3.5 that isn’t working on firefox 3.6.

As we glanced further, we noticed we had used variables in Global scope as follows.

var stringsBundle = null; var gNavigatorBundle = null;

We removed the null initialization and replaced them with var stringsBundle; var gNavigatorBundle; and woila it worked.

We just couldn’t believe that removing null initialization solved the problem. But that said, it wasn’t right solution. As we started looking at the source code of firefox 3.6.2 we noticed that, these two variables., stringsBundle and gNavigatorBundle were already defined in the Global scope. Hence reinitializing them to null in the Global scope was causing an issue with our addon. We modified the variable names to get our addon working in firefox 3.6 as well.

This entry was posted in Uncategorized. Bookmark the permalink.

One Response to Using Javascript variables in Global Scope

  1. Pingback: Tweets that mention Using Javascript variables in Global Scope « Jinnu's Blog -- Topsy.com

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s