Closed
Bug 888571
Opened 11 years ago
Closed 11 years ago
Don't load CustomizeMode.jsm upon startup
Categories
(Firefox :: Toolbars and Customization, defect)
Firefox
Toolbars and Customization
Tracking
()
RESOLVED
FIXED
Firefox 28
People
(Reporter: jaws, Assigned: jaws)
References
Details
(Keywords: perf, Whiteboard: [Australis:M8])
Attachments
(1 file, 2 obsolete files)
8.07 KB,
patch
|
dao
:
review+
|
Details | Diff | Splinter Review |
This is probably hitting our startup costs pretty heavily, and we are only loading CustomizeMode.jsm because of the tabs progress listener, for which one already exists in browser.js. Piggy-backing on that tabs progress listener can still get us the same functionality without loading the new JSM. I've confirmed using the Browser Debugger that CustomizeMode.jsm is not loaded anymore upon startup, while typing about:customizing in the location bar and hitting Enter still works.
Attachment #769326 -
Flags: review?(mnoorenberghe+bmo)
Assignee | ||
Comment 1•11 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=0d52639d2dc8
Comment 2•11 years ago
|
||
Comment on attachment 769326 [details] [diff] [review] Patch Review of attachment 769326 [details] [diff] [review]: ----------------------------------------------------------------- ::: browser/components/customizableui/src/CustomizeMode.jsm @@ +37,5 @@ > + // user. Then there's the visible palette, which gets populated and displayed > + // to the user when in customizing mode. > + this.visiblePalette = this.document.getElementById(kPaletteId); > + > + this.browser.tabContainer.addEventListener("TabSelect", this, false); Nit: remove the third argument while you're touching this. @@ +63,5 @@ > return this.document.getElementById("PanelUI-contents"); > }, > > + uninit: function() { > + if (!this._initialized) Nit: leftover code to remove @@ +64,5 @@ > }, > > + uninit: function() { > + if (!this._initialized) > + this.browser.tabContainer.removeEventListener("TabSelect", this, false); ditto
Attachment #769326 -
Flags: review?(mnoorenberghe+bmo) → review+
Assignee | ||
Comment 3•11 years ago
|
||
Repushed to try with review issues fixed at https://tbpl.mozilla.org/?tree=Try&rev=31c54dc42c5b
Comment 4•11 years ago
|
||
Comment on attachment 769326 [details] [diff] [review] Patch >--- a/browser/base/content/browser-customization.js >+++ b/browser/base/content/browser-customization.js >+ isCustomizing: function(aDocument) { >+ return aDocument.documentElement.hasAttribute("customizing") || >+ aDocument.documentElement.hasAttribute("customize-exiting"); >+ }, What is aDocument good for here? browser-customization.js belongs to a browser window. 'document' is accessible here and already used elsewhere in this file. >+ // Try not to instantiate gCustomizeMode as much as possible, >+ // so don't use CustomizeMode.jsm to check for URI or customizing. >+ const kAboutURI = "about:customizing"; Prevailing browser.js style is to use caps or to just write it like a normal variable in case it's not a global. Also, "about URI" seems unclear and could clash with other random code in this method. "customizing URI" would be clearer. >+ if (aBrowser.currentURI.spec == kAboutURI && >+ !CustomizationHandler.isCustomizing(document)) { >+ gCustomizeMode.enter(); >+ } else if (aBrowser.currentURI.spec != kAboutURI && >+ CustomizationHandler.isCustomizing(document)) { >+ gCustomizeMode.exit(); >+ } As opposed to XULBrowserWindow.onLocationChange, this code handles background tabs. This means it will call gCustomizeMode.enter when about:customizing is loaded in a background tab and gCustomizeMode.exit when something else is loaded in a background tab while customizing. This doesn't seem to make sense. >--- a/browser/components/customizableui/src/CustomizeMode.jsm >+++ b/browser/components/customizableui/src/CustomizeMode.jsm >+ isCustomizing: function() { >+ return this._customizing; > }, This method seems unused?
Attachment #769326 -
Flags: review-
Assignee | ||
Comment 5•11 years ago
|
||
Thanks for the drive-by review. Does this look better to you?
Attachment #769326 -
Attachment is obsolete: true
Attachment #769332 -
Flags: review?(dao)
Comment 6•11 years ago
|
||
Comment on attachment 769332 [details] [diff] [review] Patch v2 This looks better, but at this point it seems that you should remove CustomizeMode.jsm's code dealing with the TabSelect event -- XULBrowserWindow.onLocationChange takes care of this.
Attachment #769332 -
Flags: review?(dao) → review-
Assignee | ||
Comment 7•11 years ago
|
||
This is great, as it now allows us to remove gCustomizeMode.uninit(), which would load CustomizeMode.jsm upon shutdown even if Customize Mode was never entered.
Attachment #769332 -
Attachment is obsolete: true
Attachment #769337 -
Flags: review?(dao)
Comment 8•11 years ago
|
||
Comment on attachment 769337 [details] [diff] [review] Patch v3 >+ // Try not to instantiate gCustomizeMode as much as possible, >+ // so don't use CustomizeMode.jsm to check for URI or customizing. >+ let customizingURI = "about:customizing"; >+ if (browser.currentURI.spec == customizingURI && >+ !CustomizationHandler.isCustomizing()) { >+ gCustomizeMode.enter(); >+ } else if (browser.currentURI.spec != customizingURI && >+ CustomizationHandler.isCustomizing()) { >+ gCustomizeMode.exit(); >+ } you can use 'location' instead of browser.currentURI.spec
Attachment #769337 -
Flags: review?(dao) → review+
Assignee | ||
Comment 9•11 years ago
|
||
Cool, I've made that change and repushed to try on an older revision since the UX tree is currently burning on linux: https://tbpl.mozilla.org/?tree=Try&rev=5e1adf8dde7e
Comment 10•11 years ago
|
||
(In reply to Jared Wein [:jaws] from comment #9) > Cool, I've made that change and repushed to try on an older revision since > the UX tree is currently burning on linux: > > https://tbpl.mozilla.org/?tree=Try&rev=5e1adf8dde7e For reasons completely beyond me this doesn't seem to buy us anything for Linux tspaint. Which doesn't mean this isn't a good idea, but that's still weird... :-\
Assignee | ||
Comment 11•11 years ago
|
||
https://hg.mozilla.org/projects/ux/rev/ee81f5bac27a
Whiteboard: [Australis:M8][fixed-in-ux]
Comment 12•11 years ago
|
||
(In reply to Jared Wein [:jaws] from comment #11) > https://hg.mozilla.org/projects/ux/rev/ee81f5bac27a This turned mochitest-browser/chrome orange on all platforms: 01:52:38 WARNING - TEST-UNEXPECTED-FAIL | chrome://mochitests/content/browser/browser/base/content/test/browser_bug422590.js | Test timed out :-(
Assignee | ||
Comment 13•11 years ago
|
||
Backed out in https://hg.mozilla.org/projects/ux/rev/30b4e0a35ef8
Assignee | ||
Updated•11 years ago
|
Whiteboard: [Australis:M8][fixed-in-ux] → [Australis:M8]
Comment 14•11 years ago
|
||
Now that the dep that caused the orange is fixed, this can probably safely reland, but if you want to be safe you may want to do a try run beforehand.
Assignee | ||
Comment 15•11 years ago
|
||
I'm pretty confident that the try run won't be necessary. Relanded, https://hg.mozilla.org/projects/ux/rev/c901ba98ea87
Comment 16•11 years ago
|
||
This has landed, so marking as fixed to fix bug queries. :-)
Whiteboard: [Australis:M8] → [Australis:M8][fixed-in-ux]
Comment 17•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/c901ba98ea87
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [Australis:M8][fixed-in-ux] → [Australis:M8]
Target Milestone: --- → Firefox 28
You need to log in
before you can comment on or make changes to this bug.
Description
•