Closed Bug 836448 Opened 7 years ago Closed 7 years ago

browser-data-submission-info-bar.js pollutes the global scope

Categories

(Firefox :: General, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 21
Tracking Status
firefox20 --- fixed

People

(Reporter: dao, Assigned: dao)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
browser-data-submission-info-bar.js does a couple of things as if it didn't share the scope with lots of other chrome JS:

- it adds its own license header that ends up in the middle of browser.js
- it attempts to enable strict mode (I believe this doesn't work, since it ends up not being at the top of browser.js)
- it imports resource://services-common/log4moz.js into the global scope
- it exposes a redundant DataNotificationInfoBar object
Attachment #708266 - Flags: review?(gavin.sharp)
Assignee: nobody → dao
Well, I tried to catch this in bug 804745 comment 25, but I guess we forgot to remove the global import() call :( We were in a bit of a hurry... Thanks for following up.
Comment on attachment 708266 [details] [diff] [review]
patch

Greg and I had discussed using a singleton vs. a constructor function, and Greg had some arguments about not liking singletons in general, related to them making testing and re-usability harder. In looking back at it I don't think those really apply here, though, and this code is simpler this way.
Attachment #708266 - Flags: review?(gavin.sharp) → review+
https://hg.mozilla.org/mozilla-central/rev/885f8166c008
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 21
Blocks: 804745
Target Milestone: Firefox 21 → ---
Comment on attachment 708266 [details] [diff] [review]
patch

[Approval Request Comment]
Bug caused by (feature/regressing bug #): bug 804745
User impact if declined: add-ons could start relying on log4moz.js being imported into browser.js, and then break on the next update because we removed the accidental import
Testing completed (on m-c, etc.): on m-c
Risk to taking this patch (and alternatives if risky): low
String or UUID changes made by this patch: reverting accidental log4moz.js import into browser.js
Attachment #708266 - Flags: approval-mozilla-aurora?
Target Milestone: --- → Firefox 21
Attachment #708266 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Blocks: 1509029
You need to log in before you can comment on or make changes to this bug.