Bug 1621503 - Notify the extension system when GeckoView has started. r=geckoview-reviewers,agi a=jcristau
authorBrendan Dahl <brendan.dahl@gmail.com>
Fri, 13 Mar 2020 17:34:35 +0000
changeset 580547 0e68abe93a5242af51636c07f7e36dc8cf7af38c
parent 580546 b25e2637b29e0ab598cf7c3c2e11ce5a6f21404c
child 580548 2303ef5a43246b7f4e2fb9d22ce1658c4e1911b2
push id12868
push userbtara@mozilla.com
push dateTue, 17 Mar 2020 21:14:02 +0000
treeherdermozilla-beta@2a7c2cd8ed9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, agi, jcristau
bugs1621503
milestone75.0
Bug 1621503 - Notify the extension system when GeckoView has started. r=geckoview-reviewers,agi a=jcristau The extension background page should be loaded when either an event needs to be sent to it or after the browser has started up. When an extension is updated the special startup event listeners do not appear to be built yet and GeckoView was not sending browser started notification, which meant the background page never being loaded. Differential Revision: https://phabricator.services.mozilla.com/D66717
mobile/android/chrome/geckoview/geckoview.js
--- a/mobile/android/chrome/geckoview/geckoview.js
+++ b/mobile/android/chrome/geckoview/geckoview.js
@@ -592,16 +592,22 @@ function startup() {
     // Bug 1496684: Various bits of platform stuff depend on this notification
     // to learn when a browser window has finished its initial (chrome)
     // initialisation, especially with regards to the very first window that is
     // created. Therefore, GeckoView "windows" need to send this, too.
     InitLater(() =>
       Services.obs.notifyObservers(window, "browser-delayed-startup-finished")
     );
 
+    // Let the extension code know it can start loading things that were delayed
+    // while GeckoView started up.
+    InitLater(() => {
+      Services.obs.notifyObservers(window, "extensions-late-startup");
+    });
+
     // This should always go last, since the idle tasks (except for the ones with
     // timeouts) should execute in order. Note that this observer notification is
     // not guaranteed to fire, since the window could close before we get here.
 
     // This notification in particular signals the ScriptPreloader that we have
     // finished startup, so it can now stop recording script usage and start
     // updating the startup cache for faster script loading.
     InitLater(() =>