Merge mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2012-12-07 14:18:15 +00:00
commit bc5cfaa61f
2 changed files with 1 additions and 18 deletions

View File

@ -5,7 +5,7 @@
function test() { function test() {
// We need to open a new window for this so that its docshell would get destroyed // We need to open a new window for this so that its docshell would get destroyed
// when clearing the PB mode flag. // when clearing the PB mode flag.
let newWin = window.openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no"); let newWin = OpenBrowserWindow({private: true});
waitForExplicitFinish(); waitForExplicitFinish();
SimpleTest.waitForFocus(function() { SimpleTest.waitForFocus(function() {
let expected = false; let expected = false;
@ -14,12 +14,10 @@ function test() {
is(aTopic, "last-pb-context-exited", "Correct topic should be dispatched"); is(aTopic, "last-pb-context-exited", "Correct topic should be dispatched");
is(expected, true, "notification not expected yet"); is(expected, true, "notification not expected yet");
Services.obs.removeObserver(observer, "last-pb-context-exited", false); Services.obs.removeObserver(observer, "last-pb-context-exited", false);
gPrefService.clearUserPref("browser.privatebrowsing.keep_current_session");
finish(); finish();
} }
}; };
Services.obs.addObserver(observer, "last-pb-context-exited", false); Services.obs.addObserver(observer, "last-pb-context-exited", false);
setPrivateWindow(newWin, true);
expected = true; expected = true;
newWin.close(); // this will cause the docshells to leave PB mode newWin.close(); // this will cause the docshells to leave PB mode
newWin = null; newWin = null;

View File

@ -1,18 +1,3 @@
/*
* Function created to put a window in PB mode.
* THIS IS DANGEROUS. DO NOT DO THIS OUTSIDE OF TESTS!
*/
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;
}
function whenNewWindowLoaded(aOptions, aCallback) { function whenNewWindowLoaded(aOptions, aCallback) {
let win = OpenBrowserWindow(aOptions); let win = OpenBrowserWindow(aOptions);
win.addEventListener("load", function onLoad() { win.addEventListener("load", function onLoad() {