summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/LexicalEnvironment/unscopables-delete.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/ecma_6/LexicalEnvironment/unscopables-delete.js')
-rw-r--r--js/src/tests/ecma_6/LexicalEnvironment/unscopables-delete.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/tests/ecma_6/LexicalEnvironment/unscopables-delete.js b/js/src/tests/ecma_6/LexicalEnvironment/unscopables-delete.js
new file mode 100644
index 000000000..3cd296f4b
--- /dev/null
+++ b/js/src/tests/ecma_6/LexicalEnvironment/unscopables-delete.js
@@ -0,0 +1,27 @@
+// If obj[@@unscopables][id], then `delete id` works across `with (obj)` scope.
+
+this.niche = 7;
+let obj = { niche: 8, [Symbol.unscopables]: { niche: true } };
+with (obj) {
+ delete niche;
+}
+
+assertEq(obj.niche, 8);
+assertEq("niche" in this, false);
+
+// Same thing, but delete a variable introduced by sloppy direct eval.
+this.niche = 9;
+function f() {
+ eval("var niche = 10;");
+ with (obj) {
+ assertEq(niche, 10);
+ delete niche;
+ }
+ assertEq(niche, 9);
+}
+
+// Of course none of this affects a qualified delete.
+assertEq(delete this.niche, true);
+assertEq("niche" in this, false);
+
+reportCompare(0, 0);