{"ScriptPreparationCode":"\r\nvar blob = new Blob([\r\n \u0060 \r\n let bitmap = undefined;\r\n let canvas = undefined;\r\n let ctx = undefined;\r\n\r\nlet postAMessage=self.postMessage;\r\n\r\n\r\nself.onmessage = function(ev) {\r\n\r\n\r\n\r\n if(ev.data.msg === \u0027bitmap\u0027 \u0026\u0026 canvas != undefined) {\r\n\t\tbitmap = ev.data.imageB;\r\n\r\n\tconsole.log(\u0022Received an ImageBitmap next!\u0022);\r\n while (true)\r\n\t{\r\n\t\tctx.clearRect(0,0,640,480);\r\n\t\tctx.drawImage(bitmap, 0,0);\r\n\t}\r\n }\r\n\r\n if(ev.data.msg === \u0027init\u0027 \u0026\u0026 bitmap != undefined) {\r\n canvas = ev.data.canvas;\r\n ctx = canvas.getContext(\u00272d\u0027);\r\n\tconsole.log(\u0022Received a canvas next!\u0022);\r\n\t\r\n while (true)\r\n\t{\r\n\t\tctx.clearRect(0,0,640,480);\r\n\t\tctx.drawImage(bitmap, 0,0);\r\n\t}\r\n }\r\n\r\n if(ev.data.msg === \u0027bitmap\u0027 \u0026\u0026 canvas == undefined) {\r\n\tconsole.log(\u0022Received a bitmap first!\u0022);\r\n\t\r\n\t\tbitmap = ev.data.imageB;\r\n }\r\n\r\n if(ev.data.msg === \u0027init\u0027 \u0026\u0026 bitmap == undefined) {\r\n\tconsole.log(\u0022Received a canvas first!\u0022);\r\n\t\r\n canvas = ev.data.canvas;\r\n ctx = canvas.getContext(\u00272d\u0027);\r\n\r\n }\r\n\r\n}\r\n\u0060]);\r\n\r\nvar myWorker = new Worker(window.URL.createObjectURL(blob));\r\nvar buff = new ArrayBuffer(8);\r\n\r\n\r\nvar img = new Image();\r\n\r\nimg.src = \u0022https://www.google.com/s2/favicons?domain=www.google.com\u0022;\r\n\r\nimg.decode().then(() =\u003E {createImageBitmap(img).then(Ibitmap =\u003E { myWorker.postMessage({imageB: Ibitmap, msg:\u0027bitmap\u0027}, [Ibitmap]); })});\r\n\r\nvar canvas = document.createElement(\u0022canvas\u0022);\r\nvar c2 = document.createElement(\u0022canvas\u0022);\r\nc2.width = 640;\r\nc2.height = 480;\r\nc2 = c2.transferControlToOffscreen();\r\n\r\ncanvas.width = 640;\r\ncanvas.height = 480;\r\nc2.width = 640;\r\nc2.height = 480;\r\n\r\nvar ctx = canvas.getContext(\u00272d\u0027);\r\n\r\nmyWorker.postMessage({msg: \u0027init\u0027, canvas: c2}, [c2]);\r\n","TestCases":[{"Name":"main thread","Code":"if (img.width \u003E 0){\r\nctx.drawImage(img, 0, 0);\r\nvar imageData = ctx.getImageData(0, 0, img.width, img.height);\r\n}","IsDeferred":false},{"Name":"worker thread","Code":"if (img.width \u003E 0) myWorker.postMessage(buff);","IsDeferred":false}]}