Bug 971149 - Use the newly introduced registryStarted promise in Startup.jsm. r=myk
authorMarco Castelluccio <mar.castelluccio@studenti.unina.it>
Thu, 20 Feb 2014 15:35:09 -0500
changeset 169726 dbd05d2e58a52b43acd7376827487d58bbd23cb7
parent 169725 96eaa0f376ab90b2efaee3cc326f805826abba17
child 169727 3328dfb0d932f828a081375e8ecfd8405c342f58
push id26264
push userkwierso@gmail.com
push dateFri, 21 Feb 2014 02:59:52 +0000
treeherdermozilla-central@3328dfb0d932 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmyk
bugs971149
milestone30.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 971149 - Use the newly introduced registryStarted promise in Startup.jsm. r=myk
webapprt/Startup.jsm
--- a/webapprt/Startup.jsm
+++ b/webapprt/Startup.jsm
@@ -76,38 +76,30 @@ function createBrandingFiles() {
                     brandPropertiesContent);
   });
 }
 
 // Observes all the events needed to actually launch an application.
 // It waits for XUL window and webapps registry loading.
 this.startup = function(window) {
   return Task.spawn(function () {
-    // Observe registry loading.
-    let deferredRegistry = Promise.defer();
-    function observeRegistryLoading() {
-      Services.obs.removeObserver(observeRegistryLoading, "webapps-registry-start");
-      deferredRegistry.resolve();
-    }
-    Services.obs.addObserver(observeRegistryLoading, "webapps-registry-start", false);
-
     // Observe XUL window loading.
     // For tests, it could be already loaded.
     let deferredWindowLoad = Promise.defer();
     if (window.document && window.document.getElementById("content")) {
       deferredWindowLoad.resolve();
     } else {
       window.addEventListener("load", function onLoad() {
         window.removeEventListener("load", onLoad, false);
         deferredWindowLoad.resolve();
       });
     }
 
     // Wait for webapps registry loading.
-    yield deferredRegistry.promise;
+    yield DOMApplicationRegistry.registryStarted;
 
     // Install/update permissions and get the appID from the webapps registry.
     let appID = Ci.nsIScriptSecurityManager.NO_APP_ID;
     let manifestURL = WebappRT.config.app.manifestURL;
     if (manifestURL) {
       appID = DOMApplicationRegistry.getAppLocalIdByManifestURL(manifestURL);
 
       // On firstrun, set permissions to their default values.