summaryrefslogtreecommitdiffstats
path: root/js/xpconnect/tests/unit/envChain_subscript.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'js/xpconnect/tests/unit/envChain_subscript.jsm')
-rw-r--r--js/xpconnect/tests/unit/envChain_subscript.jsm27
1 files changed, 27 insertions, 0 deletions
diff --git a/js/xpconnect/tests/unit/envChain_subscript.jsm b/js/xpconnect/tests/unit/envChain_subscript.jsm
new file mode 100644
index 0000000000..473f6eb2d9
--- /dev/null
+++ b/js/xpconnect/tests/unit/envChain_subscript.jsm
@@ -0,0 +1,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"];