diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-12 09:27:21 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-12 09:27:21 +0200 |
commit | 33f860b25e1db06f18d06eba9fcdd2de895d9dbc (patch) | |
tree | f4701fffdabef51c6fc13adabc811074cdedff1b | |
parent | 87bf3b1714ba0f8f0c269eefba2aec7a5edab679 (diff) | |
download | UXP-33f860b25e1db06f18d06eba9fcdd2de895d9dbc.tar UXP-33f860b25e1db06f18d06eba9fcdd2de895d9dbc.tar.gz UXP-33f860b25e1db06f18d06eba9fcdd2de895d9dbc.tar.lz UXP-33f860b25e1db06f18d06eba9fcdd2de895d9dbc.tar.xz UXP-33f860b25e1db06f18d06eba9fcdd2de895d9dbc.zip |
moebius#117: Login Manager Prompter - auth: Throws an errors
https://github.com/MoonchildProductions/moebius/pull/117
-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 }; } |