Closed Bug 1112552 Opened 10 years ago Closed 10 years ago

Clean up global-scope pollution from browser-fxaccounts.js

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 37

People

(Reporter: dao, Assigned: abdelrahman, Mentored)

References

Details

(Whiteboard: [good first bug][lang=js])

Attachments

(1 file, 1 obsolete file)

browser/base/content/browser-fxaccounts.js shares the global browser window scope with many other scripts and shouldn't set random variables there.

Therefore, we should:

* change 'XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function () {' to 'XPCOMUtils.defineLazyGetter(gFxAccounts, "FxAccountsCommon", function () {'

* adjust code accessing the FxAccountsCommon variable to access this.FxAccountsCommon instead

* change 'XPCOMUtils.defineLazyModuleGetter(this, "fxaMigrator",' to 'XPCOMUtils.defineLazyModuleGetter(gFxAccounts, "fxaMigrator",'

* adjust code accessing the fxaMigrator variable to access this.fxaMigrator instead

* move PREF_SYNC_START_DOORHANGER, DOORHANGER_ACTIVATE_DELAY_MS and SYNC_MIGRATION_NOTIFICATION_TITLE into the gFxAccounts object
Attachment #8537976 - Flags: review?(dao)
Comment on attachment 8537976 [details] [diff] [review]
rev 1 - Clean up browser-fxaccounts.js

Looks good, thanks!
Attachment #8537976 - Flags: review?(dao) → review+
Assignee: nobody → codo.abdo
Something in this push caused mass bustage. Backed out.
https://hg.mozilla.org/integration/fx-team/rev/803bc910c45a
(In reply to Ryan VanderMeulen [:RyanVM UTC-5] from comment #4)
> Something in this push caused mass bustage. Backed out.
> https://hg.mozilla.org/integration/fx-team/rev/803bc910c45a

Looks like this was caused by XPCOMUtils.defineLazyGetter(gFxAccounts... / XPCOMUtils.defineLazyModuleGetter(gFxAccounts... being called before the gFxAccounts object would be declared.

Abdelrhman, can you update the patch to fix that?
Flags: needinfo?(codo.abdo)
Flags: needinfo?(codo.abdo)
Attachment #8539288 - Flags: review?(dao)
Attachment #8539288 - Flags: review?(dao) → review+
Attachment #8537976 - Attachment is obsolete: true
Can we please verify that this is green on Try before burning the trees for a third time?
(In reply to Dão Gottwald [:dao] from comment #10)
> https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=57294ae763e1

Oops, this wasn't actually running the primarily interesting test suite, i.e. browser-chrome.
https://hg.mozilla.org/mozilla-central/rev/3c7defb79660
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 37
Blocks: 1509029
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: