gecko-dev/dom/workers/test/test_readableStream_when_closing.html
Brian Grinstead 6515f97bcb Bug 1544322 - Part 1 - Remove the [type] attribute for one-liner <script> tags loading files in chrome://mochikit/content/ r=bzbarsky
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 1` argument.

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

--HG--
extra : moz-landing-system : lando
2019-04-15 20:56:58 +00:00

66 lines
1.6 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test for ReadableStream+fetch when the worker is closing</title>
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
</head>
<body>
<script>
function workerCode() {
onmessage = () => {
const BIG_BUFFER_SIZE = 1000000;
const fibStream = new ReadableStream({
start(controller) {},
pull(controller) {
const buffer = new Uint8Array(BIG_BUFFER_SIZE);
buffer.fill(42);
controller.enqueue(buffer);
}
});
const r = new Response(fibStream);
const p = r.blob();
self.postMessage("reading");
p.then(() => {
// really?
});
}
}
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({"set": [
["javascript.options.streams", true],
]}).then(() => {
const b = new Blob([workerCode+'workerCode();']);
const url = URL.createObjectURL(b);
const w = new Worker(url);
w.onmessage = function(e) {
ok(true, 'Worker is reading');
const wdm = Cc["@mozilla.org/dom/workers/workerdebuggermanager;1"].
getService(Ci.nsIWorkerDebuggerManager);
wdm.addListener({
onUnregister: function (dbg) {
if (dbg.url == url) {
ok(true, "Debugger with url " + url + " should be unregistered.");
wdm.removeListener(this);
SimpleTest.finish();
}
}
});
w.terminate();
}
w.postMessage("start");
});
</script>
</body>
</html>