зеркало из https://github.com/mozilla/gecko-dev.git
Backout 1d89bc229215 (bug 784142) for bug 787744
This commit is contained in:
Родитель
756cd13dfd
Коммит
b42466cd6b
|
@ -274,7 +274,6 @@ _BROWSER_FILES = \
|
|||
social_flyout.html \
|
||||
social_window.html \
|
||||
social_worker.js \
|
||||
browser_bug784142.js \
|
||||
$(NULL)
|
||||
|
||||
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
||||
|
|
|
@ -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 () {}
|
||||
};
|
|
@ -2518,7 +2518,7 @@ nsGlobalWindow::DialogsAreBlocked(bool *aBeingAbused)
|
|||
|
||||
nsGlobalWindow *topWindow = GetScriptableTop();
|
||||
if (!topWindow) {
|
||||
NS_ASSERTION(!mDocShell, "DialogsAreBlocked() called without a top window?");
|
||||
NS_ERROR("DialogsAreBlocked() called without a top window?");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -7652,11 +7652,9 @@ nsGlobalWindow::ActivateOrDeactivate(bool aActivate)
|
|||
|
||||
// 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));
|
||||
|
|
Загрузка…
Ссылка в новой задаче