1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18

content / test / data / fedcm / eval_worker.js [blame]

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

self.addEventListener('message', async (e) => {
  if (!e.data.nested) {
    e.ports[0].postMessage(await eval(e.data.script));
    return;
  }
  const worker = new Worker('./eval_worker.js');
  worker.postMessage(
    {
      nested: false,
      script: e.data.script,
    },
    [e.ports[0]]
  );
});