Bug 1394580 - 1. Only load AsyncPrefs for Fennec; r=esawin
authorJim Chen <nchen@mozilla.com>
Tue, 05 Sep 2017 21:26:30 -0400
changeset 379107 71322aab413bf464bfdbe5ce9eed7c5db4f26297
parent 379106 53ef4a4139b9d7a85d3f4f1e0201cb50eb860711
child 379108 0fd2ec57de053d48dcc5d98f3ce2c0c3b536a01e
push id50503
push usernchen@mozilla.com
push dateWed, 06 Sep 2017 01:30:19 +0000
treeherderautoland@be2d41805031 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1394580
milestone57.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
Bug 1394580 - 1. Only load AsyncPrefs for Fennec; r=esawin Move AsyncPrefs initialization to inside browser.js to only load it for Fennec. Also, delay initialization until later in startup. MozReview-Commit-ID: 7gLaXA5UJud
mobile/android/chrome/content/browser.js
mobile/android/components/geckoview/GeckoViewPrompt.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -17,16 +17,19 @@ Cu.import("resource://gre/modules/Servic
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/TelemetryController.jsm");
 
 if (AppConstants.ACCESSIBILITY) {
   XPCOMUtils.defineLazyModuleGetter(this, "AccessFu",
                                     "resource://gre/modules/accessibility/AccessFu.jsm");
 }
 
+XPCOMUtils.defineLazyModuleGetter(this, "AsyncPrefs",
+                                  "resource://gre/modules/AsyncPrefs.jsm");
+
 XPCOMUtils.defineLazyModuleGetter(this, "Manifests",
                                   "resource://gre/modules/Manifest.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
                                   "resource://gre/modules/FileUtils.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "JNI",
                                   "resource://gre/modules/JNI.jsm");
@@ -524,16 +527,19 @@ var BrowserApp = {
     GlobalEventDispatcher.sendRequest({ type: "Gecko:Ready" });
 
     this.deck.addEventListener("DOMContentLoaded", function() {
       InitLater(() => Cu.import("resource://gre/modules/NotificationDB.jsm"));
 
       InitLater(() => Services.obs.notifyObservers(window, "browser-delayed-startup-finished"));
       InitLater(() => GlobalEventDispatcher.sendRequest({ type: "Gecko:DelayedStartup" }));
 
+      // AsyncPrefs is needed for reader mode.
+      InitLater(() => AsyncPrefs.init());
+
       if (!AppConstants.RELEASE_OR_BETA) {
         InitLater(() => WebcompatReporter.init());
       }
 
       // Collect telemetry data.
       // We do this at startup because we want to move away from "gather-telemetry" (bug 1127907)
       InitLater(() => {
         Telemetry.addData("FENNEC_TRACKING_PROTECTION_STATE", parseInt(BrowserApp.getTrackingProtectionState()));
--- a/mobile/android/components/geckoview/GeckoViewPrompt.js
+++ b/mobile/android/components/geckoview/GeckoViewPrompt.js
@@ -2,19 +2,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
-XPCOMUtils.defineLazyModuleGetter(this, "AsyncPrefs",
-                                  "resource://gre/modules/AsyncPrefs.jsm");
-
 XPCOMUtils.defineLazyModuleGetter(this, "ContentPrefServiceParent",
                                   "resource://gre/modules/ContentPrefServiceParent.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher",
                                   "resource://gre/modules/Messaging.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
                                   "resource://gre/modules/FileUtils.jsm");
@@ -37,18 +34,16 @@ PromptFactory.prototype = {
       case "app-startup": {
         Services.obs.addObserver(this, "chrome-document-global-created");
         Services.obs.addObserver(this, "content-document-global-created");
         break;
       }
       case "profile-after-change": {
         // ContentPrefServiceParent is needed for e10s file picker.
         ContentPrefServiceParent.init();
-        // AsyncPrefs is needed for reader mode.
-        AsyncPrefs.init();
         Services.mm.addMessageListener("GeckoView:Prompt", this);
         break;
       }
       case "chrome-document-global-created":
       case "content-document-global-created": {
         let win = aSubject.QueryInterface(Ci.nsIInterfaceRequestor)
                           .getInterface(Ci.nsIDocShell).QueryInterface(Ci.nsIDocShellTreeItem)
                           .rootTreeItem.QueryInterface(Ci.nsIInterfaceRequestor)