From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- js/xpconnect/tests/unit/test_envChain_JSM.js | 40 ++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 js/xpconnect/tests/unit/test_envChain_JSM.js (limited to 'js/xpconnect/tests/unit/test_envChain_JSM.js') diff --git a/js/xpconnect/tests/unit/test_envChain_JSM.js b/js/xpconnect/tests/unit/test_envChain_JSM.js new file mode 100644 index 0000000000..0c5b2e1b80 --- /dev/null +++ b/js/xpconnect/tests/unit/test_envChain_JSM.js @@ -0,0 +1,40 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +// Verify the environment chain for JSM described in +// js/src/vm/EnvironmentObject.h. + +add_task(async function() { + const { envs } = ChromeUtils.import("resource://test/envChain.jsm"); + + Assert.equal(envs.length, 4); + + let i = 0, env; + + env = envs[i]; i++; + Assert.equal(env.type, "NonSyntacticLexicalEnvironmentObject"); + Assert.equal(env.qualified, false); + Assert.equal(env.lexical, true, "lexical must live in the NSLEO"); + Assert.equal(env.prop, false); + + env = envs[i]; i++; + Assert.equal(env.type, "NonSyntacticVariablesObject"); + Assert.equal(env.qualified, true, "qualified var must live in the NSVO"); + Assert.equal(env.lexical, false); + Assert.equal(env.prop, true, "prop var must live in the NSVO"); + + env = envs[i]; i++; + Assert.equal(env.type, "GlobalLexicalEnvironmentObject"); + Assert.equal(env.qualified, false); + Assert.equal(env.lexical, false); + Assert.equal(env.prop, false); + + env = envs[i]; i++; + Assert.equal(env.type, "*BackstagePass*"); + Assert.equal(env.qualified, false); + Assert.equal(env.lexical, false); + Assert.equal(env.prop, false); +}); -- cgit v1.2.3