5 <title>Test JSON.parse with source in workers
</title>
6 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
7 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
8 <script type=
"application/javascript">
11 SimpleTest.waitForExplicitFinish();
13 let worker = new Worker(URL.createObjectURL(new Blob([`
14 self.onmessage = function (event) {
15 let message = JSON.parse(event.data, (k,v,{source}) =
> { return { src: source, raw: JSON.rawJSON(source), val: v}});
16 message.isRaw = JSON.isRawJSON(message.raw)
17 postMessage(JSON.stringify(message)); // stringify to make sure it handles rawJSON correctly
21 worker.onmessage = event =
> {
22 let response = JSON.parse(event.data);
23 isDeeply(response, {src:
"4.32", val:
4.32, raw:
4.32, isRaw: true});
26 worker.postMessage(
"4.32");