1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 // Verify the environment chain for subscripts in JSM described in
8 // js/src/vm/EnvironmentObject.h.
10 add_task(async function() {
11 const { envs } = ChromeUtils.import("resource://test/envChain_subscript.jsm");
13 Assert.equal(envs.length, 6);
18 Assert.equal(env.type, "NonSyntacticLexicalEnvironmentObject");
19 Assert.equal(env.qualified, false);
20 Assert.equal(env.unqualified, false);
21 Assert.equal(env.lexical, true, "lexical must live in the NSLEO");
22 Assert.equal(env.prop, false);
25 Assert.equal(env.type, "WithEnvironmentObject");
26 Assert.equal(env.qualified, true, "qualified var must live in the with env");
27 Assert.equal(env.unqualified, false);
28 Assert.equal(env.lexical, false);
29 Assert.equal(env.prop, true, "this property must live in the with env");
32 Assert.equal(env.type, "NonSyntacticLexicalEnvironmentObject");
33 Assert.equal(env.qualified, false);
34 Assert.equal(env.unqualified, false);
35 Assert.equal(env.lexical, false);
36 Assert.equal(env.prop, false);
39 Assert.equal(env.type, "NonSyntacticVariablesObject");
40 Assert.equal(env.qualified, false);
41 Assert.equal(env.unqualified, true, "unqualified var must live in the global");
42 Assert.equal(env.lexical, false);
43 Assert.equal(env.prop, false);
46 Assert.equal(env.type, "GlobalLexicalEnvironmentObject");
47 Assert.equal(env.qualified, false);
48 Assert.equal(env.unqualified, false);
49 Assert.equal(env.lexical, false);
50 Assert.equal(env.prop, false);
53 Assert.equal(env.type, "*SystemGlobal*");
54 Assert.equal(env.qualified, false);
55 Assert.equal(env.unqualified, false);
56 Assert.equal(env.lexical, false);
57 Assert.equal(env.prop, false);