gecko-dev/dom/ipc/tests/test_cpow_cookies.html
Brian Grinstead c4fa4cfc0c Bug 1544322 - Part 4 - Remove the [type] attribute for multiline <script> tags loading files in /tests/SimpleTest/ r=bzbarsky
This is an autogenerated commit to handle scripts loading mochitest harness files, in
the case where the script src is on the line below the script tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 4` argument.

Differential Revision: https://phabricator.services.mozilla.com/D27459

--HG--
extra : moz-landing-system : lando
2019-04-16 04:01:46 +00:00

91 lines
2.5 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test for recursive CPOW-getting-cookie bug</title>
<script src="/tests/SimpleTest/SimpleTest.js">
</script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript">
"use strict";
/* eslint-env mozilla/frame-script */
SimpleTest.waitForExplicitFinish();
const childFrameURL =
"data:text/html,<!DOCTYPE HTML><html><body></body></html>";
function childFrameScript() {
"use strict";
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",
SpecialPowers.wrapCallback(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],
["network.disable.ipc.security", true],
["browser.pagethumbnails.capturing_disabled", true],
["security.data_uri.block_toplevel_data_uri_navigations", false],
],
}, runTests);
});
</script>
</body>
</html>