Closed
Bug 722996
Opened 12 years ago
Closed 12 years ago
cookieAcceptDialog.js uses global Private Browsing state to make decisions
Categories
(Toolkit :: General, defect)
Toolkit
General
Tracking
()
RESOLVED
FIXED
mozilla17
People
(Reporter: jdm, Assigned: sawrubh)
References
()
Details
(Whiteboard: [mentor=jdm][lang=js])
Attachments
(1 file, 3 obsolete files)
1.99 KB,
patch
|
ehsan.akhgari
:
checkin+
|
Details | Diff | Splinter Review |
The global state is going away. We should obtain the window's docshell and query the PB state that way instead.
Reporter | ||
Comment 1•12 years ago
|
||
This looks like we can use the same strategy as bug 722978.
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: [mentor=jdm][lang=js]
Assignee | ||
Updated•12 years ago
|
Assignee: nobody → saurabhanandiit
Assignee | ||
Comment 2•12 years ago
|
||
The concerned test (http://dxr.lanedo.com/mozilla-central/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cookieacceptdialog.js.html) seem to be passing locally.
Attachment #637261 -
Flags: feedback?(ehsan)
Comment 3•12 years ago
|
||
Comment on attachment 637261 [details] [diff] [review] Patch v1 Review of attachment 637261 [details] [diff] [review]: ----------------------------------------------------------------- Looks good to me!
Attachment #637261 -
Flags: feedback?(ehsan) → feedback+
Comment 4•12 years ago
|
||
Josh, Saurabh mentioned that you told him there's a missing piece here. Would you mind elaborating on that?
Reporter | ||
Comment 5•12 years ago
|
||
This is toolkit code, yet its relying on gPrivateBrowsingUI which is a browser/ property. We should be explicitly obtaining the load context instead.
Comment 6•12 years ago
|
||
(In reply to Josh Matthews [:jdm] from comment #5) > This is toolkit code, yet its relying on gPrivateBrowsingUI which is a > browser/ property. We should be explicitly obtaining the load context > instead. That is a very good point. Josh is right on, as usual. :-)
Assignee | ||
Comment 7•12 years ago
|
||
Dao told me once that any files included in html or xul files usually have a window attached to them, since here cookieAcceptDialog.xul exists, hence I thought that we will have access to the browser window, which will have gPrivateBrowsingUI property. I am not sure whether this accessible browser window will allow us to QI it (something like this |window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsILoadContext).usePrivateBrowsing| ) like we do when going by the nsILoadContext path ? @Josh what do you think about this ?
Reporter | ||
Comment 8•12 years ago
|
||
I can't think of any reason the QI chain in comment 7 wouldn't work, except that I'm not certain that the usePrivateBrowsing flag would propagate to the dialog window from the parent. You might need to use window.opener for that as well.
Comment 9•12 years ago
|
||
(In reply to Josh Matthews [:jdm] from comment #8) > I can't think of any reason the QI chain in comment 7 wouldn't work, except > that I'm not certain that the usePrivateBrowsing flag would propagate to the > dialog window from the parent. It doesn't. > You might need to use window.opener for that as well. Yes, you want to use the opener property. Also, you can use the API added in bug 769467 (which is currently on the inbound branch.)
Assignee | ||
Comment 10•12 years ago
|
||
What this patch does : Uses the API introduced in Bug 769467. This patch passes the entire "privatebrowsing/test/browser" test suite.
Attachment #637261 -
Attachment is obsolete: true
Attachment #643283 -
Flags: review?(ehsan)
Assignee | ||
Comment 11•12 years ago
|
||
Sorry, I attached the not-so complete patch in Patch v2. This patch is basically (a couple of whitespace cleanup + Patch v2).
Attachment #643283 -
Attachment is obsolete: true
Attachment #643283 -
Flags: review?(ehsan)
Attachment #643286 -
Flags: review?(ehsan)
Assignee | ||
Comment 12•12 years ago
|
||
Here is the try run for Patch v3 : https://tbpl.mozilla.org/?tree=Try&rev=7a7186ba3398
Comment 13•12 years ago
|
||
Comment on attachment 643286 [details] [diff] [review] Patch v3 Review of attachment 643286 [details] [diff] [review]: ----------------------------------------------------------------- r=me with the changes below. ::: toolkit/components/cookie/content/cookieAcceptDialog.js @@ +131,4 @@ > > // The Private Browsing service might not be available > try { > + let opener = window.opener; No point in declaring this local opener variable. window is the global object, and you can access its properties by just referencing the name. In other words, if you drop this line, everything should continue to work properly! :-) @@ +132,5 @@ > // The Private Browsing service might not be available > try { > + let opener = window.opener; > + if (opener) { > + if (PrivateBrowsingUtils.isWindowPrivate(opener)) { Nit: drop the nested ifs, and just && the conditions please.
Attachment #643286 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 14•12 years ago
|
||
Addressed Eshan's comments. Carries r+ from him. Passes "privatebrowsing/test" suite and had a good enough try run.
Attachment #643286 -
Attachment is obsolete: true
Attachment #643573 -
Flags: checkin?(ehsan)
Comment 15•12 years ago
|
||
Comment on attachment 643573 [details] [diff] [review] Patch v4 Review of attachment 643573 [details] [diff] [review]: ----------------------------------------------------------------- https://hg.mozilla.org/integration/mozilla-inbound/rev/82b78defe027
Attachment #643573 -
Flags: checkin?(ehsan) → checkin+
Comment 16•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/82b78defe027
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla17
You need to log in
before you can comment on or make changes to this bug.
Description
•