Closed
Bug 749187
Opened 13 years ago
Closed 13 years ago
Ensure new tabs and windows opened in private browsing mode have docshells set accordingly
Categories
(Firefox :: Private Browsing, defect)
Firefox
Private Browsing
Tracking
()
RESOLVED
FIXED
Firefox 15
People
(Reporter: jdm, Assigned: ehsan.akhgari)
References
Details
(Keywords: regression)
Attachments
(1 file, 2 obsolete files)
|
13.00 KB,
patch
|
Gavin
:
review+
lsblakk
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
This bug is for investigation of the issue, and a fix if it actually does exist. Please follow up on Tim and Dao's comments in bug 748802 that suggest that new windows and tabs opened in global private browsing mode may not inherit the correct docshell privacy values, leading to incorrect privateWindow results.
| Reporter | ||
Comment 1•13 years ago
|
||
and by Tim I really mean Raymond.
Updated•13 years ago
|
OS: Mac OS X → All
Hardware: x86 → All
| Assignee | ||
Comment 2•13 years ago
|
||
We have a bunch of stuff using this flag in Firefox 14, they will break if you open a new window in PB mode.
Assignee: nobody → ehsan
status-firefox14:
--- → affected
status-firefox15:
--- → affected
tracking-firefox14:
--- → +
tracking-firefox15:
--- → +
| Assignee | ||
Comment 3•13 years ago
|
||
OK, this patch adds the necessary handling for newly opened windows. This is a pretty serious problem, and we definitely want to take this for Firefox 14.
Attachment #618727 -
Flags: review?(gavin.sharp)
Comment 4•13 years ago
|
||
Comment on attachment 618727 [details] [diff] [review]
Patch (v1)
>diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
> get privateWindow() {
>+ return window.QueryInterface(Ci.nsIInterfaceRequestor)
>+ .getInterface(nsIWebNavigation)
Please don't use "nsIWebNavigation" (it shouldn't exist), and continue using Ci.nsIWebNavigation.
>diff --git a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
>- if (!this._quitting) {
>- var windowsEnum = Services.wm.getEnumerator("navigator:browser");
>- while (windowsEnum.hasMoreElements()) {
>+ var windowsEnum = Services.wm.getEnumerator("navigator:browser");
>+ while (windowsEnum.hasMoreElements()) {
I don't understand why you're removing the !quitting check or moving this code, it seems unrelated to this patch.
>+ case "domwindowopened":
>+ let aWindow = aSubject;
>+ let self = this;
>+ aWindow.QueryInterface(Ci.nsIDOMWindow);
Technically you probably want to QI to nsIDOMEventTarget? Applies to the test too.
>diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
>+ function testNewWindow(aCallback, expected) {
>+ let observer1 = {
>+ observe: function(aSubject, aTopic, aData) {
function observer1(aSubject, aTopic, aData)
>+ SimpleTest.executeSoon(function() {
you don't need the "SimpleTest."
>+ let ui = XPCNativeWrapper.unwrap(aSubject).gPrivateBrowsingUI;
This unwrap shouldn't be necessary either.
Attachment #618727 -
Flags: review?(gavin.sharp) → review-
| Assignee | ||
Comment 5•13 years ago
|
||
(In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment #4)
> Comment on attachment 618727 [details] [diff] [review]
> Patch (v1)
>
> >diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
>
> > get privateWindow() {
>
> >+ return window.QueryInterface(Ci.nsIInterfaceRequestor)
> >+ .getInterface(nsIWebNavigation)
>
> Please don't use "nsIWebNavigation" (it shouldn't exist), and continue using
> Ci.nsIWebNavigation.
Will fix.
> >diff --git a/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js b/browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
>
> >- if (!this._quitting) {
> >- var windowsEnum = Services.wm.getEnumerator("navigator:browser");
> >- while (windowsEnum.hasMoreElements()) {
>
> >+ var windowsEnum = Services.wm.getEnumerator("navigator:browser");
> >+ while (windowsEnum.hasMoreElements()) {
>
> I don't understand why you're removing the !quitting check or moving this
> code, it seems unrelated to this patch.
Because not doing this will cause the "last-pb-context-exited" event to not be fired when quitting, which is bad. I guess this is technically not related to this bug, and I can move it to another bug if you want me to.
> >+ case "domwindowopened":
> >+ let aWindow = aSubject;
> >+ let self = this;
> >+ aWindow.QueryInterface(Ci.nsIDOMWindow);
>
> Technically you probably want to QI to nsIDOMEventTarget? Applies to the
> test too.
Ah, right.
> >diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_ui.js
>
> >+ function testNewWindow(aCallback, expected) {
> >+ let observer1 = {
> >+ observe: function(aSubject, aTopic, aData) {
>
> function observer1(aSubject, aTopic, aData)
That's what I did originally, but removeObserver(arguments.callee) would not work correctly, which is why I switched to this more verbose code.
Comment 6•13 years ago
|
||
(In reply to Ehsan Akhgari [:ehsan] from comment #5)
> > >+ case "domwindowopened":
> > >+ let aWindow = aSubject;
> > >+ let self = this;
> > >+ aWindow.QueryInterface(Ci.nsIDOMWindow);
> >
> > Technically you probably want to QI to nsIDOMEventTarget? Applies to the
> > test too.
>
> Ah, right.
Under which circumstances is this actually needed?
| Assignee | ||
Comment 7•13 years ago
|
||
Attachment #618727 -
Attachment is obsolete: true
Attachment #618787 -
Flags: review?(gavin.sharp)
Comment 8•13 years ago
|
||
Oh, I forgot to mention that you also shouldn't use arguments.callee :)
Services.obs.addObserver(function obs() {
Services.obs.removeObserver(obs, "domwindowopened");
}, "domwindowopened", false);
should work fine?
Comment 9•13 years ago
|
||
(In reply to Dão Gottwald [:dao] from comment #6)
> Under which circumstances is this actually needed?
I don't know. Probably none?
Comment 10•13 years ago
|
||
(In reply to :Gavin Sharp (use gavin@gavinsharp.com for email) from comment #9)
> (In reply to Dão Gottwald [:dao] from comment #6)
> > Under which circumstances is this actually needed?
>
> I don't know. Probably none?
That's what I thought. I always omit the QueryInterface (including for nsIDOMWindow).
| Assignee | ||
Comment 11•13 years ago
|
||
Attachment #618788 -
Flags: review?(gavin.sharp)
| Assignee | ||
Updated•13 years ago
|
Attachment #618787 -
Attachment is obsolete: true
Attachment #618787 -
Flags: review?(gavin.sharp)
| Assignee | ||
Comment 12•13 years ago
|
||
Gavin: ping?
| Reporter | ||
Comment 13•13 years ago
|
||
Gavin, this is a serious regression in behaviour. Can you prioritize this review accordingly, or pass it off to someone else who can review it quickly?
| Assignee | ||
Comment 14•13 years ago
|
||
Josh, do you wanna review this yourself? :-)
| Reporter | ||
Comment 15•13 years ago
|
||
Nope, I don't think I'm a good choice.
| Assignee | ||
Comment 16•13 years ago
|
||
Gavin, can you please provide a review here based on our IRC discussion a few days ago? Thanks!
| Assignee | ||
Comment 17•13 years ago
|
||
Comment on attachment 618788 [details] [diff] [review]
Patch (v3)
Review of attachment 618788 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/components/privatebrowsing/src/nsPrivateBrowsingService.js
@@ +237,5 @@
> + var windowsEnum = Services.wm.getEnumerator("navigator:browser");
> + while (windowsEnum.hasMoreElements()) {
> + var window = windowsEnum.getNext();
> + this._setPerWindowPBFlag(window, this._inPrivateBrowsing);
> + }
The reason that this hunk is necessary is that if we don't set the PB flag on some docshells when quitting, the last-pb-exited event may not be dispatched properly, which could prevent some modules which depend on it from cleaning up properly.
Comment 18•13 years ago
|
||
Comment on attachment 618788 [details] [diff] [review]
Patch (v3)
none of the QueryInterface(Ci.nsIDOM*) calls in this patch (both code and test) are necessary, you can remove them.
Attachment #618788 -
Flags: review?(gavin.sharp) → review+
| Assignee | ||
Comment 19•13 years ago
|
||
| Assignee | ||
Comment 20•13 years ago
|
||
Comment on attachment 618788 [details] [diff] [review]
Patch (v3)
[Approval Request Comment]
Bug caused by (feature/regressing bug #): Many per window PB bugs.
User impact if declined: Serious regression in PB mode.
Testing completed (on m-c, etc.): Using automated testing.
Risk to taking this patch (and alternatives if risky): Minimal.
String or UUID changes made by this patch: None.
Attachment #618788 -
Flags: approval-mozilla-aurora?
Comment 21•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment 22•13 years ago
|
||
Comment on attachment 618788 [details] [diff] [review]
Patch (v3)
approving, regression fix.
Attachment #618788 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Updated•13 years ago
|
Keywords: regression
| Assignee | ||
Comment 23•13 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•