Backed out changeset 1b23439451a8 (bug 1079245)
authorWes Kocher <wkocher@mozilla.com>
Thu, 19 Mar 2015 15:43:21 -0700
changeset 251829 7b259d8a61a8d39289abe9414856ec67e3f56e48
parent 251827 80ade5ec1d31bb79c27103149b0c446a365e5a49
child 251830 988afda9eac4989e7a3aa5192c678a8f41ba69e8
push id1156
push userpbrosset@mozilla.com
push dateFri, 20 Mar 2015 16:00:24 +0000
bugs1079245
milestone39.0a1
backs out1b23439451a8ec0a5f9343c3699547d2efb628ec
Backed out changeset 1b23439451a8 (bug 1079245)
browser/base/content/browser.js
browser/base/content/content.js
browser/base/content/test/general/browser_bug963945.js
browser/components/about/AboutRedirector.cpp
browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -931,17 +931,16 @@ var gBrowserInit = {
     // loading the frame script to ensure that we don't miss any
     // message sent between when the frame script is loaded and when
     // the listener is registered.
     DOMLinkHandler.init();
     gPageStyleMenu.init();
     LanguageDetectionListener.init();
     BrowserOnClick.init();
     DevEdition.init();
-    AboutPrivateBrowsingListener.init();
 
     let mm = window.getGroupMessageManager("browsers");
     mm.loadFrameScript("chrome://browser/content/content.js", true);
     mm.loadFrameScript("chrome://browser/content/content-UITour.js", true);
 
     window.messageManager.addMessageListener("Browser:LoadURI", RedirectLoad);
 
     // initialize observers and listeners
@@ -7771,18 +7770,8 @@ let PanicButtonNotifier = {
       Cu.reportError(ex);
     }
   },
   close: function() {
     let popup = document.getElementById("panic-button-success-notification");
     popup.hidePopup();
   },
 };
-
-let AboutPrivateBrowsingListener = {
-  init: function () {
-    window.messageManager.addMessageListener(
-      "AboutPrivateBrowsing:OpenPrivateWindow",
-      msg => {
-        OpenBrowserWindow({private: true});
-    });
-  }
-};
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -474,39 +474,16 @@ let AboutHomeListener = {
     let searchInput = content.document.getElementById("searchText");
     if (searchInput) {
       searchInput.focus();
     }
   },
 };
 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,
 
   init: function() {
     addEventListener("AboutReaderContentLoaded", this, false, true);
     addEventListener("DOMContentLoaded", this, false);
     addEventListener("pagehide", this, false);
--- a/browser/base/content/test/general/browser_bug963945.js
+++ b/browser/base/content/test/general/browser_bug963945.js
@@ -2,22 +2,29 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * This test ensures the about:addons tab is only
  * 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");
+
+    waitForFocus(function() {
+      EventUtils.synthesizeKey("a", { ctrlKey: true, shiftKey: true }, win);
 
-  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.");
 
-  is(win.gBrowser.tabs.length, 2, "about:addons tab was re-focused.");
-  is(win.gBrowser.currentURI.spec, "about:addons", "Addons tab was opened.");
+      win.close();
+      finish();    
+    });
+  });
+}
 
-  yield BrowserTestUtils.closeWindow(win);
-});
+
--- a/browser/components/about/AboutRedirector.cpp
+++ b/browser/components/about/AboutRedirector.cpp
@@ -56,17 +56,16 @@ static RedirEntry kRedirMap[] = {
     nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
     nsIAboutModule::ALLOW_SCRIPT |
     nsIAboutModule::HIDE_FROM_ABOUTABOUT },
   { "feeds", "chrome://browser/content/feeds/subscribe.xhtml",
     nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
     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
     "chrome://global/content/aboutRights.xhtml",
 #else
     "chrome://global/content/aboutRights-unbranded.xhtml",
 #endif
     nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
--- a/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
+++ b/browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
@@ -12,16 +12,23 @@ var stringBundle = Cc["@mozilla.org/intl
 if (!PrivateBrowsingUtils.isContentWindowPrivate(window)) {
   document.title = stringBundle.GetStringFromName("title.normal");
   setFavIcon("chrome://global/skin/icons/question-16.png");
 } else {
   document.title = stringBundle.GetStringFromName("title");
   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");
   icon.setAttribute("type", "image/png");
   icon.setAttribute("href", url);
   var head = document.getElementsByTagName("head")[0];
   head.insertBefore(icon, head.firstChild);
 }
@@ -42,12 +49,10 @@ document.addEventListener("DOMContentLoa
   
   let startPrivateBrowsing = document.getElementById("startPrivateBrowsing");
   if (startPrivateBrowsing) {
     startPrivateBrowsing.addEventListener("command", openPrivateWindow);
   }
 }, false);
 
 function openPrivateWindow() {
-  // Ask chrome to open a private window
-  document.dispatchEvent(
-    new CustomEvent("AboutPrivateBrowsingOpenWindow", {bubbles:true}));
+  mainWindow.OpenBrowserWindow({private: true});
 }
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_downloadLastDir.js
@@ -43,16 +43,18 @@ function test() {
       let gDownloadLastDir = new DownloadLastDir(win);
       aCallback(win, gDownloadLastDir);
       gDownloadLastDir.cleanupPrivateFile();
     });
   }
 
   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");
     // Check gDownloadLastDir value.
     is(gDownloadLastDir.file.path, aDisplayDir.path,
        "gDownloadLastDir should be the expected display dir");
 
     MockFilePicker.returnFiles = [aFile];
@@ -71,17 +73,17 @@ function test() {
       is(gDownloadLastDir.file.path, aGlobalLastDir.path,
          "gDownloadLastDir should be the expected global last dir");
 
       launcher.saveDestinationAvailable = null;
       aWin.close();
       aCallback();
     };
 
-    launcherDialog.promptForSaveToFileAsync(launcher, aWin, null, null, null);
+    launcherDialog.promptForSaveToFileAsync(launcher, context, null, null, null);
   }
 
   testOnWindow(false, function(win, downloadDir) {
     testDownloadDir(win, downloadDir, file1, tmpDir, dir1, dir1, function() {
       testOnWindow(true, function(win, downloadDir) {
         testDownloadDir(win, downloadDir, file2, dir1, dir1, dir2, function() {
           testOnWindow(false, function(win, downloadDir) {
             testDownloadDir(win, downloadDir, file3, dir1, dir3, dir3, finish);