globalmenu extension pollutes main window javascript scope
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Global menubar extension | Status tracked in Trunk | |||||
1.0 |
Fix Released
|
High
|
Chris Coulson | |||
Trunk |
Fix Released
|
Medium
|
Unassigned | |||
firefox (Ubuntu) |
Fix Released
|
High
|
Chris Coulson | |||
Natty |
Fix Released
|
High
|
Chris Coulson | |||
Oneiric |
Fix Released
|
Medium
|
Unassigned | |||
thunderbird (Ubuntu) |
Fix Released
|
High
|
Chris Coulson | |||
Natty |
Fix Released
|
High
|
Chris Coulson | |||
Oneiric |
Fix Released
|
Medium
|
Unassigned |
Bug Description
REASON FOR SRU:
Polluting the global namespace isn't friendly and will break either the globalmenu extension or other extensions that people install.
-------
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:
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.:
if (!com) var com = {};
if (!com.canonical) com.canonical = {};
(function() {
// local/"hidden" stuff
function load() {
removeEvent
...
}
addEventListe
// globally visible
this.Unity = { // |this| is com.canonical
PlacesMenuU
};
}).call(
(in the xul overlay you would then change all references to PlacesMenuUnityImpl to com.canonical.
Also see:
https:/
Related branches
Changed in globalmenu-extension: | |
importance: | Undecided → High |
status: | New → Triaged |
affects: | firefox (Ubuntu) → ubuntu |
affects: | Ubuntu Natty → firefox (Ubuntu Natty) |
Changed in thunderbird (Ubuntu Natty): | |
importance: | Undecided → High |
status: | New → Triaged |
Changed in thunderbird (Ubuntu Oneiric): | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in thunderbird (Ubuntu Natty): | |
milestone: | none → natty-updates |
Changed in firefox (Ubuntu Natty): | |
assignee: | nobody → Chris Coulson (chrisccoulson) |
Changed in thunderbird (Ubuntu Natty): | |
assignee: | nobody → Chris Coulson (chrisccoulson) |
Changed in firefox (Ubuntu Oneiric): | |
status: | Triaged → Fix Committed |
Changed in firefox (Ubuntu Natty): | |
status: | Triaged → Fix Committed |
Changed in thunderbird (Ubuntu Oneiric): | |
status: | Triaged → Fix Committed |
Changed in thunderbird (Ubuntu Natty): | |
status: | Triaged → Fix Committed |
description: | updated |
Ok, some code for you...
This is my first real launchpad and bzr attempt, so please bear with me ;)