author | James Willcox <snorp@snorp.net> |
Thu, 31 May 2018 11:55:30 -0500 | |
changeset 422040 | b1638aab8138e367bfeb0f0b6d38e0fa63839ddc |
parent 422039 | 73fcd0ba9baf2e99a7b4a31710ddf1e26e1f0e34 |
child 422041 | 3f9698c8d77d99bdb0225995202be91608a61415 |
push id | 34114 |
push user | btara@mozilla.com |
push date | Sat, 09 Jun 2018 15:31:58 +0000 |
treeherder | mozilla-central@e02a5155d815 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jchen |
bugs | 1465480 |
milestone | 62.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
mobile/android/chrome/geckoview/geckoview.js | file | annotate | diff | comparison | revisions | |
mobile/android/modules/geckoview/GeckoViewModule.jsm | file | annotate | diff | comparison | revisions |
--- a/mobile/android/chrome/geckoview/geckoview.js +++ b/mobile/android/chrome/geckoview/geckoview.js @@ -58,16 +58,25 @@ var ModuleManager = { ]); this.messageManager.addMessageListener("GeckoView:ContentModuleLoaded", this); this.forEach(module => { module.onInit(); }); + + window.addEventListener("unload", () => { + this.forEach(module => { + module.enabled = false; + module.onDestroy(); + }); + + this._modules.clear(); + }); }, get window() { return window; }, get browser() { return this._browser; @@ -195,16 +204,22 @@ class ModuleInfo { this._impl.onSettingsUpdate(); } this._loadPhase(this._onInitPhase); this._onInitPhase = null; this.enabled = this._enabledOnInit; } + onDestroy() { + if (this._impl) { + this._impl.onDestroy(); + } + } + /** * Load resources according to a phase object that contains possible keys, * * "resource": specify the JSM resource to load for this module. * "frameScript": specify a content JS frame script to load for this module. */ _loadPhase(aPhase) { if (!aPhase) {
--- a/mobile/android/modules/geckoview/GeckoViewModule.jsm +++ b/mobile/android/modules/geckoview/GeckoViewModule.jsm @@ -50,16 +50,19 @@ class GeckoViewModule { } // Override to initialize the browser before it is bound to the window. onInitBrowser() {} // Override to initialize module. onInit() {} + // Override to cleanup when the window is closed + onDestroy() {} + // Override to detect settings change. Access settings via this.settings. onSettingsUpdate() {} // Override to enable module after setting a Java delegate. onEnable() {} // Override to disable module after clearing the Java delegate. onDisable() {}