Last Comment Bug 1107388 - No auth prompt is shown when subscribing to CalDAV calendars [domWin.document is null]
: No auth prompt is shown when subscribing to CalDAV calendars [domWin.document...
Status: RESOLVED FIXED
: regression
Product: Calendar
Classification: Client Software
Component: Provider: CalDAV (show other bugs)
: Lightning 3.8
: All All
-- blocker (vote)
: 3.8
Assigned To: Matthew Mecca [:mmecca]
:
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-12-03 20:19 PST by Matthew Mecca [:mmecca]
Modified: 2015-01-02 04:14 PST (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
auth-prompt.diff (6.57 KB, patch)
2014-12-06 21:11 PST, Matthew Mecca [:mmecca]
philipp: review+
philipp: approval‑calendar‑aurora+
Details | Diff | Splinter Review
Fix v2 (6.58 KB, patch)
2014-12-15 05:43 PST, Matthew Mecca [:mmecca]
no flags Details | Diff | Splinter Review
Fix v3 (6.16 KB, patch)
2014-12-15 05:48 PST, Matthew Mecca [:mmecca]
philipp: review+
philipp: approval‑calendar‑aurora+
Details | Diff | Splinter Review

Description User image Matthew Mecca [:mmecca] 2014-12-03 20:19:24 PST
Subscribing to a non-OAuth CalDAV calendar no longer displays an auth prompt, with the following error logged:

Error: NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS: [JavaScript Error: "domWin.document is null" {file: "resource://gre/modules/SharedPromptUtils.jsm" line: 16}]'[JavaScript Error: "domWin.document is null" {file: "resource://gre/modules/SharedPromptUtils.jsm" line: 16}]' when calling method: [nsIAuthPrompt2::promptAuth]
Source File: resource://calendar/modules/calAuthUtils.jsm
Line: 257
Comment 1 User image Philipp Kewisch [:Fallen] 2014-12-04 03:11:22 PST
Matt, do you think you could take care of this one? I think you already had a hunch why its not working?
Comment 2 User image Matthew Mecca [:mmecca] 2014-12-06 21:08:16 PST
Regression is likely caused by Bug 1091287 - looks like we need to pass in the real window to the prompt now.
Comment 3 User image Matthew Mecca [:mmecca] 2014-12-06 21:11:56 PST
Created attachment 8532868 [details] [diff] [review]
auth-prompt.diff

Uses the real window for the auth prompt instead of a LoadContext. To do so we have to defer the prompt until the window is loaded.
Comment 4 User image Philipp Kewisch [:Fallen] 2014-12-08 02:54:09 PST
Comment on attachment 8532868 [details] [diff] [review]
auth-prompt.diff

Review of attachment 8532868 [details] [diff] [review]:
-----------------------------------------------------------------

r=philipp with these comments considered:

::: calendar/base/modules/calAuthUtils.jsm
@@ +317,5 @@
>  
> +        function checkWindowState() {
> +            self.mWindow = cal.getCalendarWindow();
> +            if (!self.mWindow || self.mWindow.document.readyState != "complete") {
> +                setTimeout(checkWindowState, 0);

Can you just add an event listener on the "load" or "DOMContentLoaded" event here instead? This way we don't have to hammer the event queue with the checkWindowState call.

::: calendar/base/modules/calProviderUtils.jsm
@@ -185,5 @@
>  };
>  
>  /**
> - * Implements an nsILoadContext that allows auth prompts to avoid using private
> - * browsing without a parent DOM window

I don't remember the details, but with the new code, do we still avoid using private browsing?
Comment 5 User image Matthew Mecca [:mmecca] 2014-12-15 05:38:48 PST
(In reply to Philipp Kewisch [:Fallen] from comment #4)

> I don't remember the details, but with the new code, do we still avoid using
> private browsing?

Yes, we avoid private browsing using the real window, so we still have the option to save passwords.
Comment 6 User image Matthew Mecca [:mmecca] 2014-12-15 05:43:49 PST
Created attachment 8536563 [details] [diff] [review]
Fix v2

Uses the window's load event listener if the window isn't ready yet.
Comment 7 User image Matthew Mecca [:mmecca] 2014-12-15 05:48:49 PST
Created attachment 8536564 [details] [diff] [review]
Fix v3

Don't need the Timer.jsm import anymore.
Comment 8 User image Richard Marti (:Paenglab) 2015-01-02 01:49:19 PST
http://hg.mozilla.org/comm-central/rev/2944600ee1ef
Comment 9 User image Richard Marti (:Paenglab) 2015-01-02 04:14:52 PST
https://hg.mozilla.org/releases/comm-aurora/rev/156340fdb85e

Note You need to log in before you can comment on or make changes to this bug.