From 7572f4b2b0e328b55ee5112b43dc563b2eda5020 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 15 Sep 2010 10:46:55 -0700 Subject: [PATCH] Bug 593187: Request for authentication for an extension install doesn't focus the correct tab. r=dtownsend, a=blocks-betaN --- toolkit/mozapps/extensions/XPIProvider.jsm | 7 ++++++- toolkit/mozapps/extensions/addonManager.js | 10 ++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/toolkit/mozapps/extensions/XPIProvider.jsm b/toolkit/mozapps/extensions/XPIProvider.jsm index 587155b7727..a12c56f967b 100644 --- a/toolkit/mozapps/extensions/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/XPIProvider.jsm @@ -4085,6 +4085,11 @@ function AddonInstall(aCallback, aInstallLocation, aUrl, aHash, aName, aType, this.listeners = []; this.existingAddon = aExistingAddon; this.error = 0; + if (aLoadGroup) + this.window = aLoadGroup.notificationCallbacks + .getInterface(Ci.nsIDOMWindow); + else + this.window = null; if (aUrl instanceof Ci.nsIFileURL) { this.file = aUrl.file.QueryInterface(Ci.nsILocalFile); @@ -4968,7 +4973,7 @@ AddonInstall.prototype = { if (iid.equals(Ci.nsIAuthPrompt2)) { var factory = Cc["@mozilla.org/prompter;1"]. getService(Ci.nsIPromptFactory); - return factory.getPrompt(null, Ci.nsIAuthPrompt); + return factory.getPrompt(this.window, Ci.nsIAuthPrompt); } else if (iid.equals(Ci.nsIChannelEventSink)) { return this; diff --git a/toolkit/mozapps/extensions/addonManager.js b/toolkit/mozapps/extensions/addonManager.js index 120ae86a6f5..6d90bfe10fb 100644 --- a/toolkit/mozapps/extensions/addonManager.js +++ b/toolkit/mozapps/extensions/addonManager.js @@ -221,15 +221,13 @@ amManager.prototype = { }, }; } - var window; + var window = null; try { // Normal approach for single-process mode - window = aMessage.target.docShell - .QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindow).content; + window = aMessage.target.contentWindow; } catch (e) { - // Fallback for multiprocess (e10s) mode. Appears to work but has - // not had a full suite of automated tests run on it. + // Fallback for multiprocess (e10s) mode. Should reimplement this + // properly with Window IDs when possible, see bug 596109. window = aMessage.target.ownerDocument.defaultView; } return this.installAddonsFromWebpage(payload.mimetype,