diff options
author | New Tobin Paradigm <email@mattatobin.com> | 2018-04-12 07:33:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-12 07:33:58 -0400 |
commit | 706493af4e0f67bffdcc77a5c21fb26a0aa43afe (patch) | |
tree | 83212fa3f199e8ee7fdf3b11c3b732832a42b24f /toolkit | |
parent | 8c19f94d2957ad41aa11ceb31792e3b6b35b05e2 (diff) | |
parent | 33f860b25e1db06f18d06eba9fcdd2de895d9dbc (diff) | |
download | UXP-706493af4e0f67bffdcc77a5c21fb26a0aa43afe.tar UXP-706493af4e0f67bffdcc77a5c21fb26a0aa43afe.tar.gz UXP-706493af4e0f67bffdcc77a5c21fb26a0aa43afe.tar.lz UXP-706493af4e0f67bffdcc77a5c21fb26a0aa43afe.tar.xz UXP-706493af4e0f67bffdcc77a5c21fb26a0aa43afe.zip |
Merge pull request #125 from janekptacijarabaci/pm_loginManager_1
[PALEMOON] Fix Login Manager (Prompter) - basic
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/components/passwordmgr/nsLoginManagerPrompter.js | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js index b66489234..720e80446 100644 --- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js +++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js @@ -808,6 +808,9 @@ LoginManagerPrompter.prototype = { */ _showLoginCaptureDoorhanger(login, type) { let { browser } = this._getNotifyWindow(); + if (!browser) { + return; + } let saveMsgNames = { prompt: login.username === "" ? "rememberLoginMsgNoUser" @@ -1405,10 +1408,34 @@ LoginManagerPrompter.prototype = { * Given a content DOM window, returns the chrome window and browser it's in. */ _getChromeWindow: function (aWindow) { + // Handle non-e10s toolkit consumers. + if (!Cu.isCrossProcessWrapper(aWindow)) { + let chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebNavigation) + .QueryInterface(Ci.nsIDocShell) + .chromeEventHandler.ownerGlobal; + if (!chromeWin) { + return null; + } + + // gBrowser only exists on some apps, like Firefox. + let tabbrowser = chromeWin.gBrowser || + (typeof chromeWin.getBrowser == "function" ? chromeWin.getBrowser() : null); + // At least serve the chrome window if getBrowser() + // or getBrowserForContentWindow() are not supported. + if (!tabbrowser || typeof tabbrowser.getBrowserForContentWindow != "function") { + return { win: chromeWin }; + } + + let browser = tabbrowser.getBrowserForContentWindow(aWindow); + return { win: chromeWin, browser }; + } + let windows = Services.wm.getEnumerator(null); while (windows.hasMoreElements()) { let win = windows.getNext(); - let browser = win.gBrowser.getBrowserForContentWindow(aWindow); + let tabbrowser = win.gBrowser || win.getBrowser(); + let browser = tabbrowser.getBrowserForContentWindow(aWindow); if (browser) { return { win, browser }; } |