Backout 1d89bc229215 (bug 784142) for bug 787744
authorEd Morley <emorley@mozilla.com>
Mon, 03 Sep 2012 10:04:49 +0100
changeset 104145 0e92b62f3f21ea031c03542b7fde889cf68a6b0b
parent 104144 610d4f3abeebdf4763594e24f5b843e7209b1e5c
child 104146 4151e3d7d00c45922d022012b428ea4a963f23f3
push id23400
push userryanvm@gmail.com
push dateMon, 03 Sep 2012 16:31:29 +0000
treeherdermozilla-central@b0544769406c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs784142, 787744
milestone18.0a1
backs out1d89bc229215fd8477b2068e359f9b9b8c249a18
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout 1d89bc229215 (bug 784142) for bug 787744
browser/base/content/test/Makefile.in
browser/base/content/test/browser_bug784142.js
dom/base/nsGlobalWindow.cpp
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -269,17 +269,16 @@ endif
                  browser_social_chatwindow.js \
                  social_panel.html \
                  social_share_image.png \
                  social_sidebar.html \
                  social_chat.html \
                  social_flyout.html \
                  social_window.html \
                  social_worker.js \
-                 browser_bug784142.js \
                  $(NULL)
 
 ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 _BROWSER_FILES += \
 		browser_bug462289.js \
 		$(NULL)
 else
 _BROWSER_FILES += \
deleted file mode 100644
--- a/browser/base/content/test/browser_bug784142.js
+++ /dev/null
@@ -1,61 +0,0 @@
-const windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
-
-function test()
-{
-  waitForExplicitFinish();
-
-  // Need to enable modal dialogs for this test.
-  Services.prefs.setBoolPref("prompts.tab_modal.enabled", false);
-
-  windowMediator.addListener(promptListener);
-
-  // Open a new tab and have that tab open a new window. This is done to
-  // ensure that the new window is a normal browser window.
-  var script = "window.open('data:text/html,<button id=\"button\" onclick=\"window.close(); alert(5);\">Close</button>', null, 'width=200,height=200');";
-  gBrowser.selectedTab = 
-    gBrowser.addTab("data:text/html,<body onload='setTimeout(dotest, 0)'><script>function dotest() { " + script + "}</script></body>");
-}
-
-function windowOpened(win)
-{
-  // Wait for the page in the window to load.
-  waitForFocus(clickButton, win.content);
-}
-
-function clickButton(win)
-{
-  // Set the window in the prompt listener to indicate that the alert window
-  // is now expected to open.
-  promptListener.window = win;
-
-  // Click the Close button in the window.
-  EventUtils.synthesizeMouseAtCenter(win.content.document.getElementById("button"), { }, win);
-
-  windowMediator.removeListener(promptListener);
-  gBrowser.removeTab(gBrowser.selectedTab);
-
-  is(promptListener.message, "window appeared", "modal prompt closer didn't crash");
-  Services.prefs.clearUserPref("prompts.tab_modal.enabled", false);
-  finish();
-}
-
-var promptListener = {
-  onWindowTitleChange: function () {},
-  onOpenWindow: function (win) {
-    let domWin = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
-    if (!promptListener.window) {
-      // The first window that is open is the one opened by the new tab.
-      waitForFocus(windowOpened, domWin);
-    }
-    else {
-      // The second window is the alert opened when clicking the Close button in the window
-      ok(promptListener.window.closed, "window has closed");
-
-      // Assign a message so that it can be checked just before the test
-      // finishes to ensure that the alert opened properly.
-      promptListener.message = "window appeared";
-      executeSoon(function () { domWin.close() });
-    }
-  },
-  onCloseWindow: function () {}
-};
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -2513,17 +2513,17 @@ nsGlobalWindow::PreHandleEvent(nsEventCh
 
 bool
 nsGlobalWindow::DialogsAreBlocked(bool *aBeingAbused)
 {
   *aBeingAbused = false;
 
   nsGlobalWindow *topWindow = GetScriptableTop();
   if (!topWindow) {
-    NS_ASSERTION(!mDocShell, "DialogsAreBlocked() called without a top window?");
+    NS_ERROR("DialogsAreBlocked() called without a top window?");
     return true;
   }
 
   topWindow = topWindow->GetCurrentInnerWindowInternal();
   if (!topWindow) {
     return true;
   }
 
@@ -7647,21 +7647,19 @@ nsGlobalWindow::ActivateOrDeactivate(boo
   } else {
     // This is a workaround for the following problem:
     // When a window with an open sheet loses focus, only the sheet window
     // receives the NS_DEACTIVATE event. However, it's not the sheet that
     // should lose the active styling, but the containing top level window.
 
     // widgetListener should be a nsXULWindow
     nsIWidgetListener* listener = topLevelWidget->GetWidgetListener();
-    if (listener) {
-      nsCOMPtr<nsIXULWindow> window = listener->GetXULWindow();
-      nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(window));
-      topLevelWindow = do_GetInterface(req);
-    }
+    nsCOMPtr<nsIXULWindow> window = listener->GetXULWindow();
+    nsCOMPtr<nsIInterfaceRequestor> req(do_QueryInterface(window));
+    topLevelWindow = do_GetInterface(req);
   }
   if (topLevelWindow) {
     nsCOMPtr<nsPIDOMWindow> piWin(do_QueryInterface(topLevelWindow));
     piWin->SetActive(aActivate);
   }
 }
 
 static bool