Backed out changeset 1b23439451a8 (bug 1079245)

This commit is contained in:
Wes Kocher 2015-03-19 15:43:21 -07:00
parent 03ddfdcbae
commit 3f586a3e72
6 changed files with 28 additions and 49 deletions

View File

@ -936,7 +936,6 @@ var gBrowserInit = {
LanguageDetectionListener.init();
BrowserOnClick.init();
DevEdition.init();
AboutPrivateBrowsingListener.init();
let mm = window.getGroupMessageManager("browsers");
mm.loadFrameScript("chrome://browser/content/content.js", true);
@ -7776,13 +7775,3 @@ let PanicButtonNotifier = {
popup.hidePopup();
},
};
let AboutPrivateBrowsingListener = {
init: function () {
window.messageManager.addMessageListener(
"AboutPrivateBrowsing:OpenPrivateWindow",
msg => {
OpenBrowserWindow({private: true});
});
}
};

View File

@ -479,29 +479,6 @@ let AboutHomeListener = {
};
AboutHomeListener.init(this);
let AboutPrivateBrowsingListener = {
init: function(chromeGlobal) {
chromeGlobal.addEventListener('AboutPrivateBrowsingOpenWindow', this,
false, true);
},
get isAboutPrivateBrowsing() {
return content.document.documentURI.toLowerCase() == "about:privatebrowsing";
},
handleEvent: function(aEvent) {
if (!this.isAboutPrivateBrowsing) {
return;
}
switch (aEvent.type) {
case "AboutPrivateBrowsingOpenWindow":
sendAsyncMessage("AboutPrivateBrowsing:OpenPrivateWindow");
break;
}
},
};
AboutPrivateBrowsingListener.init(this);
let AboutReaderListener = {
_articlePromise: null,

View File

@ -7,17 +7,24 @@
* opened one time when in private browsing.
*/
add_task(function* test() {
let win = yield BrowserTestUtils.openNewBrowserWindow({private: true});
function test() {
waitForExplicitFinish();
var win = OpenBrowserWindow({private: true});
let tab = win.gBrowser.selectedTab = win.gBrowser.addTab("about:addons");
yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
yield promiseWaitForFocus(win);
whenDelayedStartupFinished(win, function() {
win.gBrowser.loadURI("about:addons");
EventUtils.synthesizeKey("a", { ctrlKey: true, shiftKey: true }, win);
waitForFocus(function() {
EventUtils.synthesizeKey("a", { ctrlKey: true, shiftKey: true }, win);
is(win.gBrowser.tabs.length, 1, "about:addons tab was re-focused.");
is(win.gBrowser.currentURI.spec, "about:addons", "Addons tab was opened.");
win.close();
finish();
});
});
}
is(win.gBrowser.tabs.length, 2, "about:addons tab was re-focused.");
is(win.gBrowser.currentURI.spec, "about:addons", "Addons tab was opened.");
yield BrowserTestUtils.closeWindow(win);
});

View File

@ -61,7 +61,6 @@ static RedirEntry kRedirMap[] = {
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::HIDE_FROM_ABOUTABOUT },
{ "privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml",
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT },
{ "rights",
#ifdef MOZ_OFFICIAL_BRANDING

View File

@ -17,6 +17,13 @@ if (!PrivateBrowsingUtils.isContentWindowPrivate(window)) {
setFavIcon("chrome://browser/skin/Privacy-16.png");
}
var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
function setFavIcon(url) {
var icon = document.createElement("link");
icon.setAttribute("rel", "icon");
@ -47,7 +54,5 @@ document.addEventListener("DOMContentLoaded", function () {
}, false);
function openPrivateWindow() {
// Ask chrome to open a private window
document.dispatchEvent(
new CustomEvent("AboutPrivateBrowsingOpenWindow", {bubbles:true}));
mainWindow.OpenBrowserWindow({private: true});
}

View File

@ -48,6 +48,8 @@ function test() {
function testDownloadDir(aWin, gDownloadLastDir, aFile, aDisplayDir, aLastDir,
aGlobalLastDir, aCallback) {
let context = aWin.gBrowser.selectedBrowser.contentWindow;
// Check lastDir preference.
is(prefs.getComplexValue("lastDir", Ci.nsIFile).path, aDisplayDir.path,
"LastDir should be the expected display dir");
@ -76,7 +78,7 @@ function test() {
aCallback();
};
launcherDialog.promptForSaveToFileAsync(launcher, aWin, null, null, null);
launcherDialog.promptForSaveToFileAsync(launcher, context, null, null, null);
}
testOnWindow(false, function(win, downloadDir) {