Back out 2780356be1a1 (bug 675574) and 9928fb9a32b1 (bug 690220) on suspicion of causing browser-chrome shutdown hangs

This commit is contained in:
Matt Brubeck 2011-09-29 14:44:36 -07:00
parent 718a93adce
commit 4a976aab61
19 changed files with 18 additions and 509 deletions

View File

@ -27,14 +27,10 @@ window.onload = function () {
window3.close();
xpcCleanupWindows();
SpecialPowers.setBoolPref("dom.block_multiple_popups", gBlockMultiplePopups);
SimpleTest.finish();
}, 4);
}
var gBlockMultiplePopups = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
var window0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window0", "width=10,height=10");
var window1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window1", "width=10,height=10");
var window2 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/parent.html", "window2", "width=10,height=10");

View File

@ -9,9 +9,6 @@
iframe { width: 90%; height: 50px; }
</style>
<script>
var gBlockMultiplePopups = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
var headerHTML = "<html><head>" +
"<script src='/tests/SimpleTest/EventUtils.js'></scr" + "ipt>" +
"<script src='NavigationUtils.js'></scr" + "ipt>" +
@ -74,7 +71,6 @@ xpcWaitForFinishedFrames(function() {
window3.close();
xpcCleanupWindows();
SpecialPowers.setBoolPref("dom.block_multiple_popups", gBlockMultiplePopups);
SimpleTest.finish();
}, 4);

View File

@ -26,14 +26,10 @@ window.onload = function () {
opener3.close();
xpcCleanupWindows();
SpecialPowers.setBoolPref("dom.block_multiple_popups", gBlockMultiplePopups);
SimpleTest.finish();
}, 6);
}
var gBlockMultiplePopups = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
//opener0 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window0", "_blank", "width=10,height=10");
opener1 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window1", "_blank", "width=10,height=10");
opener2 = window.open("http://test1.example.org:80/tests/docshell/test/navigation/open.html#window2", "_blank", "width=10,height=10");

View File

@ -9,9 +9,6 @@
iframe { width: 90%; height: 50px; }
</style>
<script>
var gBlockMultiplePopups = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
function testChild0() {
if (!window.window0)
window0 = window.open("navigate.html#opener.frames[0],location", "window0", "width=10,height=10");
@ -44,7 +41,6 @@ xpcWaitForFinishedFrames(function() {
window3.close();
xpcCleanupWindows();
SpecialPowers.setBoolPref("dom.block_multiple_popups", gBlockMultiplePopups);
SimpleTest.finish();
}, 4);

View File

@ -9,9 +9,6 @@
iframe { width: 90%; height: 50px; }
</style>
<script>
var gBlockMultiplePopups = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
window.onload = function () {
document.getElementById('active').innerHTML =
'<iframe src="http://test1.example.org:80/tests/docshell/test/navigation/navigate.html#parent.frames[0],location"></iframe>' +
@ -26,7 +23,6 @@ window.onload = function () {
isBlank(frames[3], "Should not be able to navigate off-domain sibling by targeted hyperlink.");
xpcCleanupWindows();
SpecialPowers.setBoolPref("dom.block_multiple_popups", gBlockMultiplePopups);
SimpleTest.finish();
}, 4);
}

View File

@ -39,14 +39,10 @@ window.onmessage = function (ev) {
ok(compareSnapshots(one, two, true)[0], "Popups should look identical");
ok(compareSnapshots(one, three, false)[0], "Popups should not look identical");
SpecialPowers.setBoolPref("dom.block_multiple_popups", gBlockMultiplePopups);
SimpleTest.finish();
}
}
var gBlockMultiplePopups = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
var win2 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body>Should show</body>");
var win3 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body></body>");

View File

@ -39,14 +39,10 @@ window.onmessage = function (ev) {
ok(compareSnapshots(one, two, true)[0], "Popups should look identical");
ok(compareSnapshots(one, three, false)[0], "Popups should not look identical");
SpecialPowers.setBoolPref("dom.block_multiple_popups", gBlockMultiplePopups);
SimpleTest.finish();
}
}
var gBlockMultiplePopups = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
var win2 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body>Should show</body>", "", "height=500,width=500");
var win3 = window.open("data:text/html,<script>window.onload = function() { opener.postMessage('loaded', '*'); }</" + "script><body></body>", "", "height=500,width=500");

View File

@ -268,7 +268,6 @@ static nsIEntropyCollector *gEntropyCollector = nsnull;
static PRInt32 gRefCnt = 0;
static PRInt32 gOpenPopupSpamCount = 0;
static PopupControlState gPopupControlState = openAbused;
static PopupOpenedState gPopupOpenedState = noTrack;
static PRInt32 gRunningTimeoutDepth = 0;
static bool gMouseDown = false;
static bool gDragServiceDisabled = false;
@ -1714,30 +1713,6 @@ nsGlobalWindow::GetPopupControlState() const
return gPopupControlState;
}
PopupOpenedState
GetPopupOpenedState()
{
return gPopupOpenedState;
}
PopupOpenedState
nsGlobalWindow::GetPopupOpenedState() const
{
return ::GetPopupOpenedState();
}
void
SetPopupOpenedState(PopupOpenedState aValue)
{
gPopupOpenedState = aValue;
}
void
nsGlobalWindow::SetPopupOpenedState(PopupOpenedState aValue) const
{
::SetPopupOpenedState(aValue);
}
#define WINDOWSTATEHOLDER_IID \
{0x0b917c3e, 0xbd50, 0x4683, {0xaf, 0xc9, 0xc7, 0x81, 0x07, 0xae, 0x33, 0x26}}
@ -5739,21 +5714,6 @@ nsGlobalWindow::RevisePopupAbuseLevel(PopupControlState aControl)
abuse = openOverridden;
}
if (Preferences::GetBool("dom.block_multiple_popups", true)) {
// Do not allow opening more than one popup per event.
switch (GetPopupOpenedState()) {
case noOpenedPopup:
SetPopupOpenedState(openedPopup);
break;
case openedPopup:
abuse = openOverridden;
break;
case noTrack:
default:
break;
}
}
return abuse;
}

View File

@ -353,8 +353,6 @@ public:
virtual NS_HIDDEN_(PopupControlState) PushPopupControlState(PopupControlState state, bool aForce) const;
virtual NS_HIDDEN_(void) PopPopupControlState(PopupControlState state) const;
virtual NS_HIDDEN_(PopupControlState) GetPopupControlState() const;
virtual NS_HIDDEN_(PopupOpenedState) GetPopupOpenedState() const;
virtual NS_HIDDEN_(void) SetPopupOpenedState(PopupOpenedState aValue) const;
virtual NS_HIDDEN_(nsresult) SaveWindowState(nsISupports **aState);
virtual NS_HIDDEN_(nsresult) RestoreWindowState(nsISupports *aState);

View File

@ -69,14 +69,6 @@ enum PopupControlState {
openOverridden // disallow window open
};
// PopupOpenedState helps track abuse of opened popups while the privilege has
// been given.
enum PopupOpenedState {
noTrack = -1, // Don't track opened popups.
noOpenedPopup = 0, // Tracking opened popups but none opened yet.
openedPopup = 1 // Tracking opened popups and one has been opened.
};
class nsIDocShell;
class nsIContent;
class nsIDocument;
@ -304,8 +296,6 @@ public:
bool aForce) const = 0;
virtual void PopPopupControlState(PopupControlState state) const = 0;
virtual PopupControlState GetPopupControlState() const = 0;
virtual void SetPopupOpenedState(PopupOpenedState aValue) const = 0;
virtual PopupOpenedState GetPopupOpenedState() const = 0;
// Returns an object containing the window's state. This also suspends
// all running timeouts in the window.
@ -697,12 +687,6 @@ PushPopupControlState(PopupControlState aState, bool aForce);
void
PopPopupControlState(PopupControlState aState);
PopupOpenedState
GetPopupOpenedState();
void
SetPopupOpenedState(PopupOpenedState aState);
#define NS_AUTO_POPUP_STATE_PUSHER nsAutoPopupStatePusherInternal
#else
#define NS_AUTO_POPUP_STATE_PUSHER nsAutoPopupStatePusherExternal
@ -720,28 +704,19 @@ public:
#ifdef _IMPL_NS_LAYOUT
NS_AUTO_POPUP_STATE_PUSHER(PopupControlState aState, bool aForce = false)
: mOldState(::PushPopupControlState(aState, aForce))
, mPreviousOpenState(::GetPopupOpenedState())
{
SetPopupOpenedState(mPreviousOpenState == openedPopup ? openedPopup
: noOpenedPopup);
}
~NS_AUTO_POPUP_STATE_PUSHER()
{
PopPopupControlState(mOldState);
SetPopupOpenedState(mPreviousOpenState);
}
#else
NS_AUTO_POPUP_STATE_PUSHER(nsPIDOMWindow *aWindow, PopupControlState aState)
: mWindow(aWindow)
, mOldState(openAbused)
, mPreviousOpenState(noTrack)
: mWindow(aWindow), mOldState(openAbused)
{
if (aWindow) {
mOldState = aWindow->PushPopupControlState(aState, PR_FALSE);
mPreviousOpenState = aWindow->GetPopupOpenedState();
aWindow->SetPopupOpenedState(mPreviousOpenState == openedPopup ? openedPopup
: noOpenedPopup);
}
}
@ -749,7 +724,6 @@ public:
{
if (mWindow) {
mWindow->PopPopupControlState(mOldState);
mWindow->SetPopupOpenedState(mPreviousOpenState);
}
}
#endif
@ -759,7 +733,6 @@ protected:
nsCOMPtr<nsPIDOMWindow> mWindow;
#endif
PopupControlState mOldState;
PopupOpenedState mPreviousOpenState;
private:
// Hide so that this class can only be stack-allocated

View File

@ -55,7 +55,6 @@ _BROWSER_FILES = \
browser_autofocus_preference.js \
browser_popup_blocker_save_open_panel.js \
browser_bug396843.js \
browser_popup_blocker_multiple_popups.js \
$(NULL)
libs:: $(_BROWSER_FILES)

View File

@ -1,300 +0,0 @@
/**
* In this test, we check that the content can't open more than one popup at a
* time (depending on "dom.allow_mulitple_popups" preference value).
*/
let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
.getService(Ci.nsIWindowMediator);
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Ci.nsIWindowWatcher);
let prefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
let gMultiplePopupsPref;
let gCurrentTest = -1;
let gTests = [
test1,
test2,
test3,
test4,
test5,
test6,
];
function cleanUpPopups()
{
let windowEnumerator = wm.getEnumerator(null);
while (windowEnumerator.hasMoreElements()) {
let win = windowEnumerator.getNext();
// Close all windows except ourself and the browser test harness window.
if (win != window && !win.closed &&
win.document.documentElement.getAttribute("id") != "browserTestHarness") {
win.close();
}
}
}
function cleanUp()
{
prefs.setBoolPref("dom.block_multiple_popups", gMultiplePopupsPref);
cleanUpPopups(window);
}
function nextOrFinish()
{
gCurrentTest++;
if (gCurrentTest >= gTests.length) {
finish();
return;
}
gTests[gCurrentTest]();
}
function test()
{
waitForExplicitFinish();
gMultiplePopupsPref = prefs.getBoolPref("dom.block_multiple_popups");
nextOrFinish();
}
/**
* Two window.open();
*/
function test1()
{
prefs.setBoolPref("dom.block_multiple_popups", true);
gBrowser.selectedTab.linkedBrowser.addEventListener("load", function () {
gBrowser.selectedTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
gBrowser.addEventListener("DOMPopupBlocked", function() {
gBrowser.removeEventListener("DOMPopupBlocked", arguments.callee, true);
ok(true, "The popup has been blocked");
cleanUp();
nextOrFinish();
}, true);
waitForFocus(function() {
var button = gBrowser.selectedTab.linkedBrowser.contentDocument.getElementsByTagName('button')[0];
EventUtils.synthesizeMouseAtCenter(button, {}, gBrowser.selectedTab.linkedBrowser.contentWindow);
});
}, true);
gBrowser.selectedTab.linkedBrowser.loadURI("data:text/html,<!DOCTYPE html><html><body><script>function openPopups() { window.open('data:text/html,foo', '', 'foo'); window.open('data:text/html,bar', '', 'foo'); }</script><button onclick='openPopups();'>click</button></body></html>");
}
/**
* window.open followed by w.open with w being the first popup.
*/
function test2()
{
prefs.setBoolPref("dom.block_multiple_popups", true);
let gPopupsCount = 0;
gBrowser.selectedTab.linkedBrowser.addEventListener("load", function () {
gBrowser.selectedTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
ww.registerNotification(function(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened") {
return;
}
gPopupsCount++;
if (gPopupsCount > 1) {
return;
}
executeSoon(function() {
executeSoon(function() {
executeSoon(function() {
executeSoon(function() {
ww.unregisterNotification(arguments.callee);
is(gPopupsCount, 1, "Only one popup appeared");
cleanUp();
nextOrFinish();
});
});
});
});
});
waitForFocus(function() {
var button = gBrowser.selectedTab.linkedBrowser.contentDocument.getElementsByTagName('button')[0];
EventUtils.synthesizeMouseAtCenter(button, {}, gBrowser.selectedTab.linkedBrowser.contentWindow);
});
}, true);
gBrowser.selectedTab.linkedBrowser.loadURI("data:text/html,<!DOCTYPE html><html><body><script>function openPopups() { var w = window.open('data:text/html,foo', '', 'foo'); w.open('data:text/html,bar', '', 'foo'); }</script><button onclick='openPopups();'>click</button></body></html>");
}
/**
* window.open followed by w.open with w being the first popup and the second popup being actually a tab.
*/
function test3()
{
prefs.setBoolPref("dom.block_multiple_popups", true);
let gPopupsCount = 0;
gBrowser.selectedTab.linkedBrowser.addEventListener("load", function () {
gBrowser.selectedTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
ww.registerNotification(function(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened") {
return;
}
gPopupsCount++;
if (gPopupsCount > 1) {
return;
}
executeSoon(function() {
executeSoon(function() {
executeSoon(function() {
executeSoon(function() {
ww.unregisterNotification(arguments.callee);
is(gPopupsCount, 1, "Only one popup appeared");
cleanUp();
nextOrFinish();
});
});
});
});
});
waitForFocus(function() {
var button = gBrowser.selectedTab.linkedBrowser.contentDocument.getElementsByTagName('button')[0];
EventUtils.synthesizeMouseAtCenter(button, {}, gBrowser.selectedTab.linkedBrowser.contentWindow);
});
}, true);
gBrowser.selectedTab.linkedBrowser.loadURI("data:text/html,<!DOCTYPE html><html><body><script>function openPopups() { var w = window.open('data:text/html,foo', '', 'foo'); w.open('data:text/html,bar', '', ''); }</script><button onclick='openPopups();'>click</button></body></html>");
}
/**
* window.open and .click() on the element opening the window.
*/
function test4()
{
prefs.setBoolPref("dom.block_multiple_popups", true);
gBrowser.selectedTab.linkedBrowser.addEventListener("load", function () {
gBrowser.selectedTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
gBrowser.addEventListener("DOMPopupBlocked", function() {
gBrowser.removeEventListener("DOMPopupBlocked", arguments.callee, true);
ok(true, "The popup has been blocked");
cleanUp();
nextOrFinish();
}, true);
waitForFocus(function() {
var button = gBrowser.selectedTab.linkedBrowser.contentDocument.getElementsByTagName('button')[0];
EventUtils.synthesizeMouseAtCenter(button, {}, gBrowser.selectedTab.linkedBrowser.contentWindow);
});
}, true);
gBrowser.selectedTab.linkedBrowser.loadURI("data:text/html,<!DOCTYPE html><html><body><script>var r = false; function openPopups() { window.open('data:text/html,foo', '', 'foo'); if (!r) { document.getElementsByTagName('button')[0].click(); r=true; } }</script><button onclick='openPopups();'>click</button></body></html>");
}
/**
* Two window.open from the chrome.
*/
function test5()
{
prefs.setBoolPref("dom.block_multiple_popups", true);
let gPopupsCount = 0;
ww.registerNotification(function(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened") {
return;
}
gPopupsCount++;
if (gPopupsCount != 2) {
return;
}
executeSoon(function() {
executeSoon(function() {
executeSoon(function() {
executeSoon(function() {
ww.unregisterNotification(arguments.callee);
is(gPopupsCount, 2, "Both window appeared");
cleanUp();
nextOrFinish();
});
});
});
});
});
window.open("data:text/html,foo", '', 'foo');
window.open("data:text/html,foo", '', 'foo');
}
/**
* Two window.open with the pref being disabled.
*/
function test6()
{
prefs.setBoolPref("dom.block_multiple_popups", false);
let gPopupsCount = 0;
gBrowser.selectedTab.linkedBrowser.addEventListener("load", function () {
gBrowser.selectedTab.linkedBrowser.removeEventListener("load", arguments.callee, true);
ww.registerNotification(function(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened") {
return;
}
gPopupsCount++;
if (gPopupsCount != 2) {
return;
}
executeSoon(function() {
executeSoon(function() {
executeSoon(function() {
executeSoon(function() {
ww.unregisterNotification(arguments.callee);
is(gPopupsCount, 2, "Both window appeared");
cleanUp();
nextOrFinish();
});
});
});
});
});
waitForFocus(function() {
var button = gBrowser.selectedTab.linkedBrowser.contentDocument.getElementsByTagName('button')[0];
EventUtils.synthesizeMouseAtCenter(button, {}, gBrowser.selectedTab.linkedBrowser.contentWindow);
});
}, true);
gBrowser.selectedTab.linkedBrowser.loadURI("data:text/html,<!DOCTYPE html><html><body><script>function openPopups() { window.open('data:text/html,foo', '', 'foo'); window.open('data:text/html,bar', '', 'foo'); }</script><button onclick='openPopups();'>click</button></body></html>");
}

View File

@ -28,9 +28,6 @@ SimpleTest.waitForExplicitFinish();
var wins = [];
var gBlockMultiplePopups = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
function r(base, tail) {
return base.replace(/\/[^\/]*$/, "/" + tail);
}
@ -156,7 +153,6 @@ function handleTestEnd() {
setTimeout(startThirdBatch, 0);
}
} else if (!--numTestsSet3) {
SpecialPowers.setBoolPref("dom.block_multiple_popups", gBlockMultiplePopups);
SimpleTest.finish();
}
}

View File

@ -23,13 +23,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=406375
SimpleTest.waitForExplicitFinish();
function runTest() {
var blockMultiplePopups = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
window.showModalDialog("file_bug406375.html");
ok(true, "This test should not hang");
SpecialPowers.setBoolPref("dom.block_multiple_popups", blockMultiplePopups);
SimpleTest.finish();
}

View File

@ -242,9 +242,6 @@ var expectedState;
function runtests()
{
var blockMultiplePopups = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
registerMockPromptService();
enableDialogLoopBlocking();
@ -351,8 +348,6 @@ function runtests()
mockPromptFactoryRegisterer.unregister();
mockPromptServiceRegisterer.unregister();
SpecialPowers.setBoolPref("dom.block_multiple_popups", blockMultiplePopups);
SimpleTest.finish();
}

View File

@ -4,7 +4,7 @@
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=662519
-->
<window title="Mozilla Bug 662519 and Bug 675574"
<window title="Mozilla Bug 662519"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
@ -12,9 +12,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=662519
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=662519"
target="_blank">Mozilla Bug 662519</a>
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=675574"
target="_blank">Mozilla Bug 675574</a>
<button onclick="window.open('data:text/html,foo', '', 'foo'); window.open('data:text/html,bar', '', 'bar');">click</button>
</body>
<!-- test code goes here -->
@ -23,93 +20,35 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=662519
/** Test for Bug 662519 **/
let Cc = Components.classes;
let Ci = Components.interfaces;
SimpleTest.waitForExplicitFinish();
// We have to enable dom.disable_open_during_load which is disabled
// by the test harness.
let prefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefBranch);
let gLastDomLoadValue = prefs.getBoolPref("dom.disable_open_during_load");
let gMultiplePopupsPref = prefs.getBoolPref("dom.block_multiple_popups");
let prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var gLastDomLoadValue = prefs.getBoolPref("dom.disable_open_during_load");
prefs.setBoolPref("dom.disable_open_during_load", true);
prefs.setBoolPref("dom.block_multiple_popups", true);
function test1() {
let w = window.open("data:text/html,foobar", "", "width=200,height=200");
ok(w, "The window object shouldn't be null");
let w = window.open("data:text/html,foobar", "", "width=200,height=200");
ok(w, "The window object shouldn't be null");
SimpleTest.waitForFocus(function() {
w.close();
ok(true, "The popup appeared");
SimpleTest.waitForFocus(function() {
w.close();
ok(true, "The popup appeared");
let w = window.open("data:text/html,foobar", "", "width=200,height=200");
ok(w, "The window object shouldn't be null");
SimpleTest.waitForFocus(function() {
let w = window.open("data:text/html,foobar", "", "width=200,height=200");
ok(w, "The window object shouldn't be null");
w.close();
SimpleTest.waitForFocus(function() {
w.close();
ok(true, "The popup appeared");
test2();
}, w, false);
});
}, w, false);
}
function test2() {
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Ci.nsIWindowWatcher);
let gPopupsCount = 0;
ww.registerNotification(function(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened") {
return;
}
gPopupsCount++;
if (gPopupsCount != 2) {
return;
}
SimpleTest.executeSoon(function() {
SimpleTest.executeSoon(function() {
SimpleTest.executeSoon(function() {
SimpleTest.executeSoon(function() {
ww.unregisterNotification(arguments.callee);
is(gPopupsCount, 2, "Both window appeared");
// Clean-up and finish.
let windowEnumerator = wm.getEnumerator(null);
while (windowEnumerator.hasMoreElements()) {
let win = windowEnumerator.getNext();
// Close all windows except ourself.
if (win != window && !win.closed) {
win.close();
}
}
prefs.setBoolPref("dom.block_multiple_popups", gMultiplePopupsPref);
ok(true, "The popup appeared");
prefs.setBoolPref("dom.disable_open_during_load", gLastDomLoadValue);
SimpleTest.finish();
});
});
});
});
}, w, false);
});
EventUtils.synthesizeMouseAtCenter(document.getElementsByTagName('button')[0], {});
}
SimpleTest.waitForFocus(test1);
}, w, false);
]]>
</script>
</window>

View File

@ -562,8 +562,6 @@ pref("capability.policy.default.Clipboard.cutcopy", "noAccess");
pref("capability.policy.default.Clipboard.paste", "noAccess");
// Scripts & Windows prefs
pref("dom.block_multiple_popups", true);
pref("dom.disable_image_src_set", false);
pref("dom.disable_window_flip", false);
pref("dom.disable_window_move_resize", false);

View File

@ -24,8 +24,6 @@ var testPage = "";
// Assign a function to this variable to have a clean up at the end
var testCleanUp = null;
// Backup the dom.block_multiple_popups pref value to re-set it on finish.
var blockMultiplePopupsPref;
// Internal variables
var _windowCount = 0;
@ -69,8 +67,6 @@ window.onload = function onLoad()
if (openTwoWindows)
{
_windowCount = 2;
blockMultiplePopupsPref = SpecialPowers.getBoolPref("dom.block_multiple_popups");
SpecialPowers.setBoolPref("dom.block_multiple_popups", false);
window.open(secureTestLocation, "_new1", "");
window.open(secureTestLocation, "_new2", "");
}
@ -92,10 +88,7 @@ function onMessageReceived(event)
{
if (testCleanUp)
testCleanUp();
if (openTwoWindows) {
SpecialPowers.setBoolPref("dom.block_multiple_popups", blockMultiplePopupsPref);
}
SimpleTest.finish();
}
break;

View File

@ -1,16 +1,8 @@
// ----------------------------------------------------------------------------
// Test whether an InstallTrigger.enabled is working
let prefs = Cc["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
let gMultiplePopupsPref;
function test() {
waitForExplicitFinish();
gMultiplePopupsPref = prefs.getBoolPref("dom.block_multiple_popups");
prefs.setBoolPref("dom.block_multiple_popups", false);
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.selectedBrowser.addEventListener("load", function() {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
@ -54,7 +46,6 @@ function page_loaded() {
check_load(function() {
gBrowser.removeCurrentTab();
prefs.setBoolPref("dom.block_multiple_popups", gMultiplePopupsPref);
finish();
});
});