Closed Bug 1358313 Opened 7 years ago Closed 7 years ago

TypeError: win.gBrowser is undefined -- nsLoginManagerPrompter.js:1411:11 (using ADFS to generate the Oauth token for use with Google so when we are setting up our Oauth token, we have to authenticate to our local ADFS server first)

Categories

(Thunderbird :: General, defect)

52 Branch
defect
Not set
normal

Tracking

(thunderbird_esr5255+ fixed, thunderbird56 fixed, thunderbird57 fixed)

RESOLVED FIXED
Thunderbird 57.0
Tracking Status
thunderbird_esr52 55+ fixed
thunderbird56 --- fixed
thunderbird57 --- fixed

People

(Reporter: dattilo, Unassigned)

References

Details

Attachments

(1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 Build ID: 20170323105023 Steps to reproduce: Attempt to setup up a new account using Oauth2 to authenticate to gmail. We use ADFS so when we authenticate via Oauth2 we are redirected to a local webserver to enter our Active Directory credentials. Actual results: The resultant window that should allow us to login (and generate the Oauth2 token) is blank. The following error is thrown in the debugger: nsPrompter: Delegation to password manager failed: [Exception... "[JavaScript Error: "win.gBrowser is undefined" {file: "resource://gre/components/nsLoginManagerPrompter.js" line: 1426}]'[JavaScript Error: "win.gBrowser is undefined" {file: "resource://gre/components/nsLoginManagerPrompter.js" line: 1426}]' when calling method: [nsIPromptFactory::getPrompt]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: resource://gre/components/nsPrompter.js :: getPrompt :: line 42" data: yes] nsPrompter.js:44 uncaught exception: 2147500033 (unknown) TypeError: checkValue is undefined Expected results: We should be able to enter our credentials on the resultant window. This appears to be directly related to windows (intergrated) authentication as the same error does not apply on external systems which are using standard forms based authentication only. Thia happens in the latest beta release as well...
Sorry for the NI SPAM, how does Oauth2?
Flags: needinfo?(rkent)
Flags: needinfo?(philipp)
Flags: needinfo?(mkmelin+mozilla)
(In reply to Jorg K (GMT+2) from comment #1) > Sorry for the NI SPAM, how does Oauth2? Sorry, but I cannot parse your question.
Flags: needinfo?(rkent)
Sorry, *who* does Oauth2, as in: To whom can I refer this bug.
Flags: needinfo?(rkent)
The original imap oauth was done by jcranmer with my review, but lately oauth is probably better understood by people like Magnus and Fallen.
Flags: needinfo?(rkent)
Where/how do you get this? Setting up a gmail account works fine for me using OAuth.
Flags: needinfo?(mkmelin+mozilla)
We use ADFS to generate the Oauth token for use with Google so when we are setting up our Oauth token, we have to authenticate to our local ADFS server first. In previous Thunderbird versions, we would get a standard username/password dialog box and could authenticate correctly. In the most recent version, the standard username/password dialog box does not pop up making it impossible to authenticate (we are left with the blank screen with the Oauth token request URL at the top). As far as I can tell, this is directly related to Windows Integrated Authentication (backbone of ADFS SSO) as it does not occur when our Oauth requests go through our externally facing ADFS server (which defaults to plain old forms based authentication). Thanks for looking into this, Garth
This is the exact code statement : let browser = win.gBrowser.getBrowserForContentWindow(aWindow); So, i'm not sure if this: https://api-dev.bugzilla.mozilla.org/show_bug.cgi?id=1300539 is relevant. I (also in the same organization as OP Garth D'atillo), have the exact same symptom using Debian Linux with Mozilla Thunderbird 52.0.1 (not Debian package, though i have not tried that, and don't know the current state of the ESR->mainstream migration and how that would affect the Debian packages (which track ESR)) --stephen
Might be two issues here. (I've not tested any of this.) First, we don't have a gBrowser in mail, usuallly getBrowser() should be called instead in toolkit. Then tabmail.xml should probably implement getBrowserForContentWindow - similar to bug 1300539. https://hg.mozilla.org/mozilla-central/annotate/6a563348b8be/toolkit/components/passwordmgr/nsLoginManagerPrompter.js#l1345
Blocks: 1350152
Summary: TypeError: win.gBrowser is undefined -- nsLoginManagerPrompter.js:1411:11 → TypeError: win.gBrowser is undefined -- nsLoginManagerPrompter.js:1411:11 (using ADFS to generate the Oauth token for use with Google so when we are setting up our Oauth token, we have to authenticate to our local ADFS server first)
No longer blocks: 1350152
Depends on: 1350152
Reporter: Can you test this on today's Daily (will be compiled in a few hours) now that bug 1350152 is fixed.
Thank you for your efforts on this... We are still seeing a blank screen with this new error in the debugger (Oauth token request URL still at the top): TypeError: chromeWin.getBrowser is not a function[Learn More] nsLoginManagerPrompter.js:1437:46 nsPrompter: Delegation to password manager failed: [Exception... "[JavaScript Error: "chromeWin.getBrowser is not a function" {file: "jar:file:///C:/Program%20Files/Daily/omni.ja!/components/nsLoginManagerPrompter.js" line: 1437}]'[JavaScript Error: "chromeWin.getBrowser is not a function" {file: "jar:file:///C:/Program%20Files/Daily/omni.ja!/components/nsLoginManagerPrompter.js" line: 1437}]' when calling method: [nsIPromptFactory::getPrompt]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: jar:file:///C:/Program%20Files/Daily/omni.ja!/components/nsPrompter.js :: getPrompt :: line 42" data: yes] nsPrompter.js:44 getPrompt jar:file:///C:/Program%20Files/Daily/omni.ja!/components/nsPrompter.js:44:17 uncaught exception: 2147500033 (unknown) TypeError: checkValue is undefined[Learn More] nsPrompter.js:760:13 Please let me know if you need any more information... Thanks again, Garth
So it's it's not fixed by bug 1350152 like bug 1367191 :-( The offending line nsLoginManagerPrompter.js" line: 1437 reads: let tabbrowser = chromeWin.gBrowser || chromeWin.getBrowser(); Johann, do you have any further insight here? Many thanks for fixing bug 1350152, BTW :-)
Flags: needinfo?(jhofmann)
Ah, that's a small oversight on my side. I expected chromeWin.getBrowser() to be present but return null when there's no browser. It obviously doesn't make much sense to have it when the application doesn't have a browser. The quickest thing for you to do to fix this might be to shim getBrowser() to return null.
Flags: needinfo?(jhofmann)
Hmm, I have real problems understanding this bug. I verified bug 1367191, that was fixed by bug 1350152. Maybe that works since the compose window has a getBrowser() function? https://dxr.mozilla.org/comm-central/rev/959c482d6c7eb35510a14dbd9fdcda43a78a619c/mail/components/compose/content/MsgComposeCommands.js#5543 Since I can't even reproduce the problem described in comment #0 I don't know how to take this further. Would the M-C fix be: let tabbrowser = chromeWin.gBrowser || (("getBrowser" in chromeWin) && chromeWin.getBrowser()); I can provide a patch for that ;-)
Flags: needinfo?(jhofmann)
(In reply to Jorg K (GMT+2) from comment #13) > Hmm, I have real problems understanding this bug. I verified bug 1367191, > that was fixed by bug 1350152. Maybe that works since the compose window has > a getBrowser() function? > https://dxr.mozilla.org/comm-central/rev/ > 959c482d6c7eb35510a14dbd9fdcda43a78a619c/mail/components/compose/content/ > MsgComposeCommands.js#5543 > > Since I can't even reproduce the problem described in comment #0 I don't > know how to take this further. > > Would the M-C fix be: > > let tabbrowser = chromeWin.gBrowser || (("getBrowser" in chromeWin) && > chromeWin.getBrowser()); > > I can provide a patch for that ;-) I'd happily review a patch for that. I'd suggest checking for typeof function, though, like https://searchfox.org/mozilla-central/source/toolkit/components/passwordmgr/nsLoginManagerPrompter.js#1440 already does. Thanks!
Flags: needinfo?(jhofmann)
Depends on: 1388166
Garth, would you be willing to test a fix in a Daily version of TB?
Flags: needinfo?(philipp) → needinfo?(dattilo)
Certainly... Just let me know when the Daily version has the proposed "fix". Thanks again for sticking with thid as I know our usage scenario is relatively "unique"... :-) -Garth
Flags: needinfo?(dattilo)
I've proposed a patch in bug 1388166, so if that's approved, I'll get a build to you.
(In reply to Garth Dattilo from comment #16) > Certainly... Just let me know when the Daily version has the proposed "fix". Here is a special version compiled just for you: https://archive.mozilla.org/pub/thunderbird/try-builds/mozilla@jorgk.com-d53d5d7372f985dc76abffb44a49bda9d8df836d/try-comm-central-win32/ If you use the ZIP (thunderbird-57.0a1.en-US.win32.zip), just unpack it, start with |thunderbird -p| to select your profile. Like this, you don't have to install anything.
Your fix worked and I was able to acquire the oAuth token successfully using the specified build. Please let me know if you need any further testing (64bit, other OS's, etc.). THANK YOU! -Garth
No further testing required, I'll get this into TB 52.4.
Fixed by bug 1388166.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 57.0
Attachment #8894980 - Flags: approval-comm-esr52+
Attachment #8894980 - Flags: approval-comm-beta+
This will work now in TB 56 beta 2 released today: https://www.mozilla.org/en-US/thunderbird/channel/ (Page still serving TB 56 beta 1, so you need to wait until beta 2 becomes available.)
This is indeed working with the 56b2 release... Thank you again... This was an awesome display of open source troubleshooting/ collaboration at its finest. -Garth
Component: Untriaged → General
Comment on attachment 8894980 [details] Don't forget to uplift M-C change to M-ESR52 This served its purpose, uplifted for TB 56 beta 2 and TB 52.3 ESR, and I won't forget it for TB 56 beta 3 either.
Attachment #8894980 - Attachment is obsolete: true
Attachment #8894980 - Flags: approval-comm-esr52+
Attachment #8894980 - Flags: approval-comm-beta+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: