зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1087646 - Add a test. r=smaug
This commit is contained in:
Родитель
2b00b0f294
Коммит
6c17217f08
|
@ -4,6 +4,8 @@ skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s
|
||||||
[test_blob_sliced_from_parent_process.html]
|
[test_blob_sliced_from_parent_process.html]
|
||||||
# This test is only supposed to run in the main process.
|
# This test is only supposed to run in the main process.
|
||||||
skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s
|
skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s
|
||||||
|
[test_cpow_cookies.html]
|
||||||
|
skip-if = buildapp == 'b2g' || buildapp == 'mulet'
|
||||||
[test_NuwaProcessCreation.html]
|
[test_NuwaProcessCreation.html]
|
||||||
skip-if = toolkit != 'gonk'
|
skip-if = toolkit != 'gonk'
|
||||||
[test_NuwaProcessDeadlock.html]
|
[test_NuwaProcessDeadlock.html]
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test for recursive CPOW-getting-cookie bug</title>
|
||||||
|
<script type="application/javascript"
|
||||||
|
src="/tests/SimpleTest/SimpleTest.js">
|
||||||
|
</script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<script type="application/javascript;version=1.8">
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
const childFrameURL =
|
||||||
|
"data:text/html,<!DOCTYPE HTML><html><body></body></html>";
|
||||||
|
|
||||||
|
function childFrameScript() {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
const Ci = Components.interfaces;
|
||||||
|
|
||||||
|
function test1(message) {
|
||||||
|
// NB: This is a no-op because we're a data: document with a null
|
||||||
|
// principal.
|
||||||
|
content.document.cookie = "a=b";
|
||||||
|
message.target.sendAsyncMessage("testCPOWCookies:test1Finished", { pass: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
addMessageListener("testCPOWCookies:test1", function(message) {
|
||||||
|
test1(message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let test;
|
||||||
|
function* testStructure(mm) {
|
||||||
|
let lastResult;
|
||||||
|
|
||||||
|
function testDone(msg) {
|
||||||
|
test.next(msg.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
mm.addMessageListener("testCPOWCookies:test1Finished", testDone);
|
||||||
|
|
||||||
|
mm.sendAsyncMessage("testCPOWCookies:test1", {});
|
||||||
|
lastResult = yield;
|
||||||
|
ok(lastResult.pass, "got the right answer and didn't crash");
|
||||||
|
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTests() {
|
||||||
|
info("Browser prefs set.");
|
||||||
|
|
||||||
|
let iframe = document.createElement("iframe");
|
||||||
|
SpecialPowers.wrap(iframe).mozbrowser = true;
|
||||||
|
iframe.id = "iframe";
|
||||||
|
iframe.src = childFrameURL;
|
||||||
|
|
||||||
|
iframe.addEventListener("mozbrowserloadend", function() {
|
||||||
|
info("Got iframe load event.");
|
||||||
|
let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
|
||||||
|
mm.loadFrameScript("data:,(" + encodeURI(childFrameScript.toString()) + ")();",
|
||||||
|
false);
|
||||||
|
|
||||||
|
test = testStructure(mm);
|
||||||
|
test.next();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.body.appendChild(iframe);
|
||||||
|
}
|
||||||
|
|
||||||
|
addEventListener("load", function() {
|
||||||
|
info("Got load event.");
|
||||||
|
|
||||||
|
SpecialPowers.addPermission("browser", true, document);
|
||||||
|
SpecialPowers.pushPrefEnv({
|
||||||
|
"set": [
|
||||||
|
["dom.ipc.browser_frames.oop_by_default", true],
|
||||||
|
["dom.mozBrowserFramesEnabled", true],
|
||||||
|
["browser.pagethumbnails.capturing_disabled", true]
|
||||||
|
]
|
||||||
|
}, runTests);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Загрузка…
Ссылка в новой задаче