2015-03-27 23:12:37 +03:00
|
|
|
<!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>
|
|
|
|
|
2017-02-23 00:10:07 +03:00
|
|
|
<script type="application/javascript">
|
2015-03-27 23:12:37 +03:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
const childFrameURL =
|
|
|
|
"http://mochi.test:8888/tests/dom/ipc/tests/file_bug1086684.html";
|
|
|
|
|
|
|
|
function childFrameScript() {
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
let { MockFilePicker } =
|
2015-11-05 18:00:59 +03:00
|
|
|
Components.utils.import("chrome://specialpowers/content/MockFilePicker.jsm", {});
|
2015-03-27 23:12:37 +03:00
|
|
|
|
|
|
|
function parentReady(message) {
|
|
|
|
MockFilePicker.init(content);
|
|
|
|
MockFilePicker.returnFiles = [message.data.file];
|
|
|
|
MockFilePicker.returnValue = MockFilePicker.returnOK;
|
|
|
|
|
|
|
|
let input = content.document.getElementById("f");
|
|
|
|
input.addEventListener("change", () => {
|
|
|
|
MockFilePicker.cleanup();
|
2016-01-19 01:17:29 +03:00
|
|
|
let value = input.value;
|
|
|
|
message.target.sendAsyncMessage("testBug1086684:childDone", { value });
|
2015-03-27 23:12:37 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
input.focus();
|
|
|
|
input.click();
|
|
|
|
}
|
|
|
|
|
|
|
|
addMessageListener("testBug1086684:parentReady", function(message) {
|
|
|
|
parentReady(message);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
let test;
|
|
|
|
function* testStructure(mm) {
|
2016-01-19 01:17:29 +03:00
|
|
|
let value;
|
2015-03-27 23:12:37 +03:00
|
|
|
|
|
|
|
function testDone(msg) {
|
2016-01-19 01:17:29 +03:00
|
|
|
test.next(msg.data.value);
|
2015-03-27 23:12:37 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
mm.addMessageListener("testBug1086684:childDone", testDone);
|
|
|
|
|
|
|
|
let blob = new Blob([]);
|
|
|
|
let file = new File([blob], "helloworld.txt", { type: "text/plain" });
|
|
|
|
|
|
|
|
mm.sendAsyncMessage("testBug1086684:parentReady", { file });
|
2016-01-19 01:17:29 +03:00
|
|
|
value = yield;
|
2015-03-27 23:12:37 +03:00
|
|
|
|
|
|
|
// 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.
|
2016-01-19 01:17:29 +03:00
|
|
|
is(value, "", "got the right answer and didn't crash");
|
2015-03-27 23:12:37 +03:00
|
|
|
|
|
|
|
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],
|
2016-11-17 16:53:30 +03:00
|
|
|
["network.disable.ipc.security", true],
|
2015-03-27 23:12:37 +03:00
|
|
|
["browser.pagethumbnails.capturing_disabled", true]
|
|
|
|
]
|
|
|
|
}, runTests);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|