<p dir="auto">REPRO:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const code = `
onmessage = function(data) {
  unexistingVariable = data;
}`
const worker = new Worker(`data:text/javascript;base64,${btoa(code)}`, {type: &quot;module&quot;});
worker.postMessage(&quot;boop&quot;);"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">code</span> <span class="pl-c1">=</span> <span class="pl-s">`</span>
<span class="pl-s">onmessage = function(data) {</span>
<span class="pl-s">  unexistingVariable = data;</span>
<span class="pl-s">}`</span>
<span class="pl-k">const</span> <span class="pl-s1">worker</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-v">Worker</span><span class="pl-kos">(</span><span class="pl-s">`data:text/javascript;base64,<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-en">btoa</span><span class="pl-kos">(</span><span class="pl-s1">code</span><span class="pl-kos">)</span><span class="pl-kos">}</span></span>`</span><span class="pl-kos">,</span> <span class="pl-kos">{</span><span class="pl-c1">type</span>: <span class="pl-s">"module"</span><span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-s1">worker</span><span class="pl-kos">.</span><span class="pl-en">postMessage</span><span class="pl-kos">(</span><span class="pl-s">"boop"</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: Uncaught (in worker &quot;&quot;) Error
    throw new Error();
          ^
    at file:///home/abotella/test/worker.js:3:11
    at fire (deno:extensions/timers/01_timers.js:477:7)
    at handleTimerMacrotask (deno:extensions/timers/01_timers.js:338:7)
thread 'worker-0' panicked at 'coding error: either js is polling or the worker is terminated', runtime/web_worker.rs:498:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Uncaught (in promise) Error: Unhandled error event reached main worker.
    at Worker.#pollControl (deno:runtime/js/11_workers.js:247:23)"><pre class="notranslate"><code class="notranslate">error: Uncaught (in worker "") Error
    throw new Error();
          ^
    at file:///home/abotella/test/worker.js:3:11
    at fire (deno:extensions/timers/01_timers.js:477:7)
    at handleTimerMacrotask (deno:extensions/timers/01_timers.js:338:7)
thread 'worker-0' panicked at 'coding error: either js is polling or the worker is terminated', runtime/web_worker.rs:498:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: Uncaught (in promise) Error: Unhandled error event reached main worker.
    at Worker.#pollControl (deno:runtime/js/11_workers.js:247:23)
</code></pre></div>
<h3 dir="auto">test.js</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="new Worker(
  new URL(&quot;./worker.js&quot;, import.meta.url).href,
  { type: &quot;module&quot; },
);"><pre class="notranslate"><span class="pl-k">new</span> <span class="pl-v">Worker</span><span class="pl-kos">(</span>
  <span class="pl-k">new</span> <span class="pl-c1">URL</span><span class="pl-kos">(</span><span class="pl-s">"./worker.js"</span><span class="pl-kos">,</span> <span class="pl-k">import</span><span class="pl-kos">.</span><span class="pl-c1">meta</span><span class="pl-kos">.</span><span class="pl-c1">url</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">href</span><span class="pl-kos">,</span>
  <span class="pl-kos">{</span> <span class="pl-c1">type</span>: <span class="pl-s">"module"</span> <span class="pl-kos">}</span><span class="pl-kos">,</span>
<span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<h3 dir="auto">worker.js</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="setTimeout(() =&gt; {
  throw new Error();
}, 1000);"><pre class="notranslate"><span class="pl-en">setTimeout</span><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-v">Error</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-c1">1000</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<hr>
<p dir="auto">This seems to have been introduced in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="926616235" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/11076" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/11076/hovercard" href="https://github.com/denoland/deno/pull/11076">#11076</a>, and it seems to be related to some of the WPT test failures in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="940109939" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/11338" data-hovercard-type="pull_request" data-hovercard-url="/denoland/deno/pull/11338/hovercard" href="https://github.com/denoland/deno/pull/11338">#11338</a>.</p>