Bug 747023 - Install software notification doorhanger popup can appear from page in background tab. r=mfinkle a=android-only
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Tue, 01 May 2012 13:59:07 -0700
changeset 92736 28157498541077b2cf7ccff15a8135e3d750f282
parent 92735 3266a0e9f1b2d383de4b4092c0f9a658b2a13c04
child 92737 d3a3b430e9515a560c68243d9a1d0727ef2ccec0
push id22561
push usermleibovic@mozilla.com
push dateTue, 01 May 2012 20:59:20 +0000
treeherdermozilla-central@281574985410 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, android-only
bugs747023
milestone15.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 747023 - Install software notification doorhanger popup can appear from page in background tab. r=mfinkle a=android-only
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3373,16 +3373,21 @@ var XPInstallObserver = {
 
   observe: function xpi_observer(aSubject, aTopic, aData) {
     switch (aTopic) {
       case "addon-install-started":
         NativeWindow.toast.show(Strings.browser.GetStringFromName("alertAddonsDownloading"), "short");
         break;
       case "addon-install-blocked":
         let installInfo = aSubject.QueryInterface(Ci.amIWebInstallInfo);
+        let win = installInfo.originatingWindow;
+        let tab = BrowserApp.getTabForWindow(win.top);
+        if (!tab)
+          return;
+
         let host = installInfo.originatingURI.host;
 
         let brandShortName = Strings.brand.GetStringFromName("brandShortName");
         let notificationName, buttons, message;
         let strings = Strings.browser;
         let enabled = true;
         try {
           enabled = Services.prefs.getBoolPref("xpinstall.enabled");
@@ -3412,17 +3417,17 @@ var XPInstallObserver = {
             label: strings.GetStringFromName("xpinstallPromptAllowButton"),
             callback: function() {
               // Kick off the install
               installInfo.install();
               return false;
             }
           }];
         }
-        NativeWindow.doorhanger.show(message, aTopic, buttons);
+        NativeWindow.doorhanger.show(message, aTopic, buttons, tab.id);
         break;
     }
   },
 
   onInstallEnded: function(aInstall, aAddon) {
     let needsRestart = false;
     if (aInstall.existingAddon && (aInstall.existingAddon.pendingOperations & AddonManager.PENDING_UPGRADE))
       needsRestart = true;