4 <script src=
"../../resources/js-test.js"></script>
6 if (window
.testRunner
) {
7 testRunner
.dumpAsText();
8 testRunner
.waitUntilDone();
11 function buildInlineSharedWorker() {
12 var script
= document
.getElementById('workerCode').innerText
;
13 var blob
= new Blob([script
], {type
: 'text/javascript'});
14 var worker
= new SharedWorker(URL
.createObjectURL(blob
));
16 worker
.port
.postMessage({cmd
: 'connect', id
: "host"});
18 worker
.port
.addEventListener('message', function (e
) {
20 setTimeout(finishJSTest
, 0);
28 <!-- This script's body will be used to build a Blob URL to use as a Worker. -->
29 <script id=
"workerCode" type=
"text/plain">
31 console.log(typeof console.log);
32 console.log(console.log.toString());
33 console.error(
"error");
36 console.debug(
"debug");
37 console.count(
"count");
40 // FIXME(slightlyoff): these aren't getting logged properly from here!
41 console.timeEnd(
"time");
43 console.assert(false);
44 console.markTimeline(
"markTimeline");
46 self.addEventListener(
"connect", function (e) {
47 var port = e.ports[
0];
48 port.postMessage({ done: true });
52 window
.jsTestIsAsync
= true;
53 description("This tests that 'console.log' and friends function correctly from workers.");
54 buildInlineSharedWorker();