mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1041808 - Thousands of about:blank windows when cookies policy set to "Keep until: I close Firefox". r=smaug.
--HG-- extra : rebase_source : 8706fb4ca98b9d01893dd4544d395161a4277474
This commit is contained in:
parent
4acdafaaee
commit
3dd82769cb
@ -13,6 +13,7 @@
|
||||
#include "nsString.h"
|
||||
#include "nsIDialogParamBlock.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
|
||||
/****************************************************************
|
||||
************************ nsCookiePromptService *****************
|
||||
@ -71,6 +72,11 @@ nsCookiePromptService::CookieDialog(nsIDOMWindow *aParent,
|
||||
parent = do_QueryInterface(privateParent);
|
||||
}
|
||||
|
||||
// We're opening a chrome window and passing in a nsIDialogParamBlock. Setting
|
||||
// the nsIDialogParamBlock as the .arguments property on the chrome window
|
||||
// requires system principals on the stack, so we use an AutoNoJSAPI for that.
|
||||
mozilla::dom::AutoNoJSAPI nojsapi;
|
||||
|
||||
// The cookie dialog will be modal for the root chrome window rather than the
|
||||
// tab containing the permission-requesting page. This removes confusion
|
||||
// about which monitor is displaying the dialog (see bug 470356), but also
|
||||
|
@ -38,3 +38,4 @@ support-files =
|
||||
[test_same_base_domain_5.html]
|
||||
[test_same_base_domain_6.html]
|
||||
[test_samedomain.html]
|
||||
[test_bug1041808.html]
|
||||
|
61
extensions/cookie/test/test_bug1041808.html
Normal file
61
extensions/cookie/test/test_bug1041808.html
Normal file
@ -0,0 +1,61 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1041808
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1041808</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 1041808 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var dialogsOpened = 0;
|
||||
var dialogsClosed = 0;
|
||||
function dismissDialog(aSubject, aTopic, aData)
|
||||
{
|
||||
if (aTopic == "domwindowopened") {
|
||||
var win = SpecialPowers.wrap(aSubject);
|
||||
win.addEventListener("pageshow", function() {
|
||||
win.removeEventListener("pageshow", arguments.callee, false);
|
||||
sendKey("RETURN", aSubject);
|
||||
}, false);
|
||||
++dialogsOpened;
|
||||
} else if (aTopic == "domwindowclosed") {
|
||||
++dialogsClosed;
|
||||
}
|
||||
}
|
||||
|
||||
function runTest()
|
||||
{
|
||||
SpecialPowers.Services.ww.registerNotification(dismissDialog);
|
||||
document.cookie = "test1=testValue";
|
||||
document.cookie = "test2=testValue";
|
||||
document.cookie = "test3=testValue";
|
||||
SpecialPowers.Services.ww.unregisterNotification(dismissDialog);
|
||||
is(dialogsOpened, 3, "Setting a cookie should have asked for permission");
|
||||
is(dialogsOpened - dialogsClosed, 0,
|
||||
"Setting a cookie shouldn't have left any additional windows open");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [["network.cookie.lifetimePolicy", 1]]},
|
||||
runTest);
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1041808">Mozilla Bug 1041808</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user