mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
c4fa4cfc0c
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
109 lines
3.1 KiB
HTML
109 lines
3.1 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 =
|
|
"http://mochi.test:8888/tests/dom/ipc/tests/file_bug1086684.html";
|
|
|
|
function childFrameScript() {
|
|
"use strict";
|
|
|
|
let { MockFilePicker } =
|
|
ChromeUtils.import("resource://specialpowers/MockFilePicker.jsm");
|
|
|
|
function parentReady(message) {
|
|
MockFilePicker.init(content);
|
|
MockFilePicker.setFiles([message.data.file]);
|
|
MockFilePicker.returnValue = MockFilePicker.returnOK;
|
|
|
|
let input = content.document.getElementById("f");
|
|
input.addEventListener("change", () => {
|
|
MockFilePicker.cleanup();
|
|
let value = input.value;
|
|
message.target.sendAsyncMessage("testBug1086684:childDone", { value });
|
|
});
|
|
|
|
input.focus();
|
|
input.click();
|
|
}
|
|
|
|
addMessageListener("testBug1086684:parentReady", function(message) {
|
|
parentReady(message);
|
|
});
|
|
}
|
|
|
|
let test;
|
|
function* testStructure(mm) {
|
|
let value;
|
|
|
|
function testDone(msg) {
|
|
test.next(msg.data.value);
|
|
}
|
|
|
|
mm.addMessageListener("testBug1086684:childDone",
|
|
SpecialPowers.wrapCallback(testDone));
|
|
|
|
let blob = new Blob([]);
|
|
let file = new File([blob], "helloworld.txt", { type: "text/plain" });
|
|
|
|
mm.sendAsyncMessage("testBug1086684:parentReady", { file });
|
|
value = yield;
|
|
|
|
// Note that the "helloworld.txt" passed in above doesn't affect the
|
|
// 'value' getter. Because we're mocking a file using a blob, we ask the
|
|
// blob for its path, which is the empty string.
|
|
is(value, "", "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],
|
|
],
|
|
}, runTests);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|