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 170165 dbd05d2e58a52b43acd7376827487d58bbd23cb7
parent 170164 96eaa0f376ab90b2efaee3cc326f805826abba17
child 170166 3328dfb0d932f828a081375e8ecfd8405c342f58
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersmyk
bugs971149
milestone30.0a1
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.