summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/tests/unit/lazy_shared_in_worker.js
blob: 148cdefb3ea04cec33e2411256b4df660aba9d05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
onmessage = event => {
  let caught1 = false;
  try {
    const lazy = {};
    ChromeUtils.defineESModuleGetters(lazy, {
      obj: "resource://test/esmified-1.sys.mjs"
    });
    lazy.obj;
  } catch (e) {
    caught1 = true;
  }

  let caught2 = false;
  try {
    const lazy = {};
    ChromeUtils.defineESModuleGetters(lazy, {
      obj: "resource://test/esmified-1.sys.mjs"
    }, {
      global: "shared",
    });
    lazy.obj;
  } catch (e) {
    caught2 = true;
  }

  let caught3 = false;
  try {
    const lazy = {};
    ChromeUtils.defineESModuleGetters(lazy, {
      obj: "resource://test/esmified-1.sys.mjs"
    }, {
      global: "devtools",
    });
    lazy.obj;
  } catch (e) {
    caught3 = true;
  }

  let caught4 = false;
  try {
    const lazy = {};
    ChromeUtils.defineESModuleGetters(lazy, {
      obj: "resource://test/esmified-1.sys.mjs"
    }, {
      loadInDevToolsLoader: true,
    });
    lazy.obj;
  } catch (e) {
    caught4 = true;
  }
  postMessage({ caught1, caught2, caught3, caught4 });
};