forked from mirrors/gecko-dev
This is split from the previous changeset since if we include dom/ the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 2` argument. Differential Revision: https://phabricator.services.mozilla.com/D27457 --HG-- extra : moz-landing-system : lando
45 lines
1.5 KiB
HTML
45 lines
1.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test an empty IPCBlob together with other parts</title>
|
|
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript">
|
|
|
|
function checkContent(msg, content) {
|
|
return new Promise(resolve => {
|
|
let fr = new FileReader();
|
|
fr.readAsText(new Blob(content));
|
|
fr.onloadend = () => {
|
|
is(fr.result, "Hello world!", "The content matches: " + msg);
|
|
resolve();
|
|
};
|
|
});
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
let url = SimpleTest.getTestFileURL("script_file.js");
|
|
|
|
let script = SpecialPowers.loadChromeScript(url);
|
|
script.addMessageListener("emptyfile.opened", message => {
|
|
checkContent("middle", ["Hello ", message.file, "world!"]).
|
|
then(() => checkContent("begin", [message.file, "Hello world!"])).
|
|
then(() => checkContent("end", ["Hello world!", message.file])).
|
|
then(() => checkContent("random", [message.file, message.file, "Hello world!", message.file])).
|
|
then(() => checkContent("random 2", [message.file, message.file, "Hello ",
|
|
message.file, "world", message.file,
|
|
message.file, "!", message.file, "",
|
|
message.file, message.file])).
|
|
then(SimpleTest.finish);
|
|
});
|
|
|
|
script.sendAsyncMessage("emptyfile.open");
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|