Bug 1217016 : Added null check in xpi install observer r=margaret
authorvivek <vivekb.balakrishnan@gmail.com>
Wed, 21 Oct 2015 19:34:49 +0300
changeset 304178 214bc95f9d20afb36016a0ff7021695a01f78c1b
parent 304177 43d38fbbc50e84d9b9d9217e9346bf354918a91e
child 304179 ffeca1025cd07845ef400d7bcd1b699d075a6cda
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1217016, 1201547
milestone44.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 1217016 : Added null check in xpi install observer r=margaret This definitely a fallout from 1201547. I failed to audit whether subject is not null for all the notifications. Seems like it is null for "xpi-signature-changed" [1]. [1] http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/internal/XPIProvider.jsm#2993
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -5848,25 +5848,26 @@ var XPInstallObserver = {
     Services.obs.addObserver(this, "addon-install-started", false);
     Services.obs.addObserver(this, "xpi-signature-changed", false);
     Services.obs.addObserver(this, "browser-delayed-startup-finished", false);
 
     AddonManager.addInstallListener(this);
   },
 
   observe: function(aSubject, aTopic, aData) {
-    let installInfo = aSubject.QueryInterface(Ci.amIWebInstallInfo);
-    let tab = BrowserApp.getTabForBrowser(installInfo.browser);
+    let installInfo, tab, host;
+    if (aSubject) {
+      installInfo = aSubject.QueryInterface(Ci.amIWebInstallInfo);
+      tab = BrowserApp.getTabForBrowser(installInfo.browser);
+      if (installInfo.originatingURI) {
+        host = installInfo.originatingURI.host;
+      }
+    }
+
     let strings = Strings.browser;
-
-    let host = null;
-    if (installInfo.originatingURI) {
-      host = installInfo.originatingURI.host;
-    }
-
     let brandShortName = Strings.brand.GetStringFromName("brandShortName");
 
     switch (aTopic) {
       case "addon-install-started":
         NativeWindow.toast.show(strings.GetStringFromName("alertAddonsDownloading"), "short");
         break;
       case "addon-install-disabled": {
         if (!tab)