The globalmenu extension overlays browser.xul and loads firefoxMenu.js, adding a lot of new variables/functions to the shared scope, at least:
nsIObserverService !
uIGlobalMenuLoader
uIGlobalMenuService
observer !
Observer() !
onLoad() !
onUnload() !
PlacesMenuUnityImpl()
HistoryMenuUnityImpl()
(! marks names with high chance of conflicts)
This is a problem as the regular browser code, all other extensions overlaying the browser window and this extension share the same scope, i.e. the same namespace.
If other extensions happen to define the same scope-global names, then conflicts will occur. Whoever loads last wins. Hence there is a high probability of heisenbugs (depending on the other extensions a user installs).
I'm a volunteer addons.mozilla.org editor, performing required code reviews an extension, this would be a definite show-stopper bug to any public listing.
You can either "hide" your stuff within a function, use some "namespace" variable, or a mixture of both, e.g.:
if (!com) var com = {};
if (!com.canonical) com.canonical = {};
(function() {
// local/"hidden" stuff
function load() {
removeEventListener("load", load, false);
...
}
addEventListener("load", load, false);
Binary package hint: firefox
The globalmenu extension overlays browser.xul and loads firefoxMenu.js, adding a lot of new variables/functions to the shared scope, at least: Impl() yImpl()
nsIObserverService !
uIGlobalMenuLoader
uIGlobalMenuService
observer !
Observer() !
onLoad() !
onUnload() !
PlacesMenuUnity
HistoryMenuUnit
(! marks names with high chance of conflicts)
This is a problem as the regular browser code, all other extensions overlaying the browser window and this extension share the same scope, i.e. the same namespace.
If other extensions happen to define the same scope-global names, then conflicts will occur. Whoever loads last wins. Hence there is a high probability of heisenbugs (depending on the other extensions a user installs).
I'm a volunteer addons.mozilla.org editor, performing required code reviews an extension, this would be a definite show-stopper bug to any public listing.
You can either "hide" your stuff within a function, use some "namespace" variable, or a mixture of both, e.g.: Listener( "load", load, false); ner("load" , load, false);
if (!com) var com = {};
if (!com.canonical) com.canonical = {};
(function() {
// local/"hidden" stuff
function load() {
removeEvent
...
}
addEventListe
// globally visible nityImpl: ... com.canonical) ;
this.Unity = { // |this| is com.canonical
PlacesMenuU
};
}).call(
(in the xul overlay you would then change all references to PlacesMenuUnityImpl to com.canonical. Unity.PlacesMen uUnityImpl)
Also see: /developer. mozilla. org/en/ XUL_School/ JavaScript_ Object_ Management
https:/