mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 748477 - Switch chrome privateWindow getter to check currentTab and remove setter; r=ehsan
This commit is contained in:
parent
8bc88ec370
commit
ae364922c7
@ -7167,25 +7167,9 @@ let gPrivateBrowsingUI = {
|
||||
* and the setter should only be used in tests.
|
||||
*/
|
||||
get privateWindow() {
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.treeOwner
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIXULWindow)
|
||||
.docShell.QueryInterface(Ci.nsILoadContext)
|
||||
.usePrivateBrowsing;
|
||||
},
|
||||
|
||||
set privateWindow(val) {
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.treeOwner
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIXULWindow)
|
||||
.docShell.QueryInterface(Ci.nsILoadContext)
|
||||
.usePrivateBrowsing = val;
|
||||
return gBrowser.selectedTab.linkedBrowser
|
||||
.docShell.QueryInterface(Ci.nsILoadContext)
|
||||
.usePrivateBrowsing;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@ function test() {
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, "last-pb-context-exited", false);
|
||||
newWin.gPrivateBrowsingUI.privateWindow = true;
|
||||
setPrivateWindow(newWin, true);
|
||||
expected = true;
|
||||
newWin.close(); // this will cause the docshells to leave PB mode
|
||||
newWin = null;
|
||||
|
@ -70,9 +70,9 @@ function test() {
|
||||
testNewWindow(function() {
|
||||
// These are tests for the privateWindow setter. Note that the setter should
|
||||
// not be used anywhere else for now!
|
||||
gPrivateBrowsingUI.privateWindow = true;
|
||||
setPrivateWindow(window, true);
|
||||
is(gPrivateBrowsingUI.privateWindow, true, "gPrivateBrowsingUI should accept the correct per-window private browsing status");
|
||||
gPrivateBrowsingUI.privateWindow = false;
|
||||
setPrivateWindow(window, false);
|
||||
is(gPrivateBrowsingUI.privateWindow, false, "gPrivateBrowsingUI should accept the correct per-window private browsing status");
|
||||
|
||||
// now, test using the <command> object
|
||||
|
@ -23,3 +23,17 @@ function waitForClearHistory(aCallback) {
|
||||
}, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
|
||||
PlacesUtils.bhistory.removeAllPages();
|
||||
}
|
||||
|
||||
/*
|
||||
* Function created to replace the |privateWindow| setter
|
||||
*/
|
||||
function setPrivateWindow(aWindow, aEnable) {
|
||||
return aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
.treeOwner
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIXULWindow)
|
||||
.docShell.QueryInterface(Ci.nsILoadContext)
|
||||
.usePrivateBrowsing = aEnable;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user