Closed Bug 1453537 Opened 7 years ago Closed 7 years ago

Add "init browser" phase in GeckoView startup

Categories

(GeckoView :: General, enhancement, P2)

All
Android
enhancement

Tracking

(firefox61 fixed)

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: jchen, Assigned: jchen)

Details

Attachments

(7 files)

Some modules perform tasks between creating the browser element and binding the browser element to the window. We should add a separate onInitBrowser call for that.
Comment on attachment 8967232 [details] Bug 1453537 - 2. Name GV module overrides more consistently; https://reviewboard.mozilla.org/r/235928/#review241664 Code analysis found 1 defect in this patch: - 1 defect found by mozlint You can run this analysis locally with: - `./mach lint path/to/file` (JS/Python) If you see a problem in this automated review, please report it here: http://bit.ly/2y9N9Vx ::: mobile/android/modules/geckoview/GeckoViewContentModule.jsm:69 (Diff revision 1) > - unregister() {} > + > + // Override to detect settings change. Access settings via this.settings. > onSettingsUpdate() {} > + > + // Override to enable module after setting a Java delegate. > + register {} Error: Parsing error: unexpected token { [eslint]
Attachment #8967231 - Flags: review?(esawin) → review+
Comment on attachment 8967232 [details] Bug 1453537 - 2. Name GV module overrides more consistently; https://reviewboard.mozilla.org/r/235928/#review241750 ::: mobile/android/chrome/geckoview/GeckoViewContentSettings.js:13 (Diff revision 1) > // Handles GeckoView content settings including: > // * tracking protection > // * desktop mode > class GeckoViewContentSettings extends GeckoViewContentModule { > - init() { > + onInit() { > debug `init`; Please fix debug logs ("onInit", "onEnable", ...). ::: mobile/android/chrome/geckoview/GeckoViewNavigationContent.js:16 (Diff revision 1) > LoadURIDelegate: "resource://gre/modules/LoadURIDelegate.jsm", > }); > > // Implements nsILoadURIDelegate. > class GeckoViewNavigationContent extends GeckoViewContentModule { > - register() { > + onEnable() { We should document the register and enable mechanics more explicitly. ::: mobile/android/modules/geckoview/GeckoViewModule.jsm:79 (Diff revision 1) > > - register() {} > + _unregister() { > + if (!this.isRegistered) { > + return; > + } > + this._eventProxy.unregisterListener(); I think we might want to remove automatic unregistering so that the module has to call it. Some modules may register listeners in onInit, which would break things.
Attachment #8967232 - Flags: review?(esawin) → review+
Attachment #8967233 - Flags: review?(esawin) → review+
Comment on attachment 8967234 [details] Bug 1453537 - 4. Implement GeckoViewNavigation.onInitBrowser; https://reviewboard.mozilla.org/r/235932/#review241756
Attachment #8967234 - Flags: review?(esawin) → review+
Comment on attachment 8967235 [details] Bug 1453537 - 5. Set browser remote attribute during onInitBrowser; https://reviewboard.mozilla.org/r/235934/#review241758 That's a nice change!
Attachment #8967235 - Flags: review?(esawin) → review+
Comment on attachment 8967236 [details] Bug 1453537 - 6. Clean up Settings JS modules; https://reviewboard.mozilla.org/r/235936/#review241760 ::: mobile/android/modules/geckoview/GeckoViewSettings.jsm:46 (Diff revision 1) > onInit() { > - this._isSafeBrowsingInit = false; > + this._useTrackingProtection = false; > this._useDesktopMode = false; > - this._displayMode = Ci.nsIDocShell.DISPLAY_MODE_BROWSER; > > - this.messageManager.loadFrameScript( > + this.registerContent( We can't use it here with automatic unregistering, see previous patch's comment. ::: mobile/android/modules/geckoview/GeckoViewSettings.jsm:68 (Diff revision 1) > - SafeBrowsing.init(); > - this._isSafeBrowsingInit = true; > - } > + } > + > + set useTrackingProtection(aUse) { > + aUse && SafeBrowsing; Looks a bit odd.
Attachment #8967236 - Flags: review?(esawin) → review+
Comment on attachment 8967236 [details] Bug 1453537 - 6. Clean up Settings JS modules; https://reviewboard.mozilla.org/r/235936/#review241760 > We can't use it here with automatic unregistering, see previous patch's comment. `registerContent` shouldn't be affected by automatic unregistering. But I think I'll go ahead and remove automatic unregistering anyways.
Comment on attachment 8967513 [details] Bug 1453537 - 2b. Don't unregister listeners automatically on disable; https://reviewboard.mozilla.org/r/236192/#review241966
Attachment #8967513 - Flags: review?(esawin) → review+
Pushed by nchen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a91a03cf5528 1. Use Map for GV modules; r=esawin https://hg.mozilla.org/integration/autoland/rev/8ebfd97f230b 2. Name GV module overrides more consistently; r=esawin https://hg.mozilla.org/integration/autoland/rev/e8b47563c732 2b. Don't unregister listeners automatically on disable; r=esawin https://hg.mozilla.org/integration/autoland/rev/d6da57f4b96d 3. Add a "onInitBrowser" call for GV module; r=esawin https://hg.mozilla.org/integration/autoland/rev/0b95977592df 4. Implement GeckoViewNavigation.onInitBrowser; r=esawin https://hg.mozilla.org/integration/autoland/rev/095e2adce50b 5. Set browser remote attribute during onInitBrowser; r=esawin https://hg.mozilla.org/integration/autoland/rev/61be6eea7441 6. Clean up Settings JS modules; r=esawin
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 61 → mozilla61
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: