summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/tests/unit/envChain_subscript.jsm
blob: 473f6eb2d9cf52fc16a9f4e56ff82da76706902d (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
const target = {};
Services.scriptloader.loadSubScript(`data:,
var qualified = 10;
unqualified = 20;
let lexical = 30;
this.prop = 40;

const funcs = Cu.getJSTestingFunctions();
const envs = [];
let env = funcs.getInnerMostEnvironmentObject();
while (env) {
  envs.push({
    type: funcs.getEnvironmentObjectType(env) || "*BackstagePass*",
    qualified: !!Object.getOwnPropertyDescriptor(env, "qualified"),
    unqualified: !!Object.getOwnPropertyDescriptor(env, "unqualified"),
    lexical: !!Object.getOwnPropertyDescriptor(env, "lexical"),
    prop: !!Object.getOwnPropertyDescriptor(env, "prop"),
  });

  env = funcs.getEnclosingEnvironmentObject(env);
}

this.ENVS = envs;
`, target);

const envs = target.ENVS;
const EXPORTED_SYMBOLS = ["envs"];