Bug 1258792 - ensure window before trying to use it in update check; r=marco, a=ritu
authorMyk Melez <myk@mykzilla.org>
Thu, 24 Mar 2016 14:24:47 -0700
changeset 323630 a4481ccef67e4732e005b3538df8d8e61890bcdc
parent 323629 7fad9b1e32fd631e7df6486d580d82120eef4eb2
child 323631 49207e06538f84689dc6ff388621b9f754c2ca91
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarco, ritu
bugs1258792
milestone47.0a2
Bug 1258792 - ensure window before trying to use it in update check; r=marco, a=ritu
webapprt/WebappRT.jsm
--- a/webapprt/WebappRT.jsm
+++ b/webapprt/WebappRT.jsm
@@ -97,25 +97,24 @@ this.WebappRT = {
   startUpdateService: function() {
     let manifestURL = this.config.app.manifestURL;
     // We used to install apps without storing their manifest URL.
     // Now we can't update them.
     if (!manifestURL) {
       return;
     }
 
-    if (!window.navigator.mozApps) {
-      return;
-    }
-
     // Check for updates once a day.
     let timerManager = Cc["@mozilla.org/updates/timer-manager;1"].
                        getService(Ci.nsIUpdateTimerManager);
     timerManager.registerTimer("updateTimer", () => {
       let window = Services.wm.getMostRecentWindow("webapprt:webapp");
+      if (!window.navigator.mozApps) {
+        return;
+      }
       window.navigator.mozApps.mgmt.getAll().onsuccess = function() {
         let thisApp = null;
         for (let app of this.result) {
           if (app.manifestURL == manifestURL) {
             thisApp = app;
             break;
           }
         }