Closed Bug 855866 Opened 12 years ago Closed 12 years ago

usePrivateBrowsing is true for non-private windows on domwindowopen and toplevel-window-ready

Categories

(Core :: Widget, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla23

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(1 file, 1 obsolete file)

In Jetpack, we used to listen to domwindowopen for new top level window creation, but it ends up being buggy as window.usePrivateBrowsing is true on non-private windows opened from a private window. STR: 1/ Open firefox, 2/ Open a private window, 3/ Open a non-private window from the private one, Actual: Receive domwindowopen observer notification, with a window.usePrivateBrowsing being true. Excepted: Ideally, domwindowopen will only fire when the window is preliminaty initialized and do not reflect ambigiuous states. So that window.usePrivateBrowsing should be false. Such behavior happens because private browsing state is set after these two notification are fired. The state is set at the end of nsWindowWatcher::OpenWindowInternal http://mxr.mozilla.org/mozilla-central/source/embedding/components/windowwatcher/src/nsWindowWatcher.cpp#904 Whereas `domwindowopened` opened is fired when we call windowCreator2->CreateChromeWindow2 at the beginning of this OpenWindowInternal method: http://mxr.mozilla.org/mozilla-central/source/embedding/components/windowwatcher/src/nsWindowWatcher.cpp#739 And still right after the `toplevel-window-ready` event: http://mxr.mozilla.org/mozilla-central/source/embedding/components/windowwatcher/src/nsWindowWatcher.cpp#863
Here is a patch to fire toplevel-window-ready after usePrivateBrowsing is initialized. But ideally the private state would be correctly initialized before we even fire domwindowopened. Or fire both of these events later... ?
Can we make this critical?
Flags: needinfo?(ehsan)
Comment on attachment 730907 [details] [diff] [review] Bug 855866: Fire toplevel-window-ready after usePrivateBrowsing is initialized. Review of attachment 730907 [details] [diff] [review]: ----------------------------------------------------------------- Hmm, this patch causes the notification to not be dispatched if |!(uriToLoad && aNavigate)|. I think you should move this block down to after |if (isNewToplevelWindow)|. You want to get bz to review this patch though.
Attachment #730907 - Flags: review-
Flags: needinfo?(ehsan)
Is this still an issue?
Attachment #730907 - Attachment is obsolete: true
Comment on attachment 737950 [details] [diff] [review] Fire toplevel-window-ready after usePrivateBrowsing is initialized, but still before the document starts loading. (In reply to :Ehsan Akhgari (needinfo? me!) from comment #4) > Comment on attachment 730907 [details] [diff] [review] > Bug 855866: Fire toplevel-window-ready after usePrivateBrowsing is > initialized. > > Review of attachment 730907 [details] [diff] [review]: > ----------------------------------------------------------------- > > Hmm, this patch causes the notification to not be dispatched if |!(uriToLoad > && aNavigate)|. I think you should move this block down to after |if > (isNewToplevelWindow)|. You want to get bz to review this patch though. Oh, good catch! I tweaked the patch accordingly, but didn't moved it in |if (isNewToplevelWindow)| as it would fired the event after the document starts loading.
Attachment #737950 - Flags: review?(bzbarsky)
Comment on attachment 737950 [details] [diff] [review] Fire toplevel-window-ready after usePrivateBrowsing is initialized, but still before the document starts loading. r=me
Attachment #737950 - Flags: review?(bzbarsky) → review+
Assignee: nobody → poirot.alex
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla23
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: