]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/global-environment-does-not-trap-unscopables.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / global-environment-does-not-trap-unscopables.js
diff --git a/tests/stress/global-environment-does-not-trap-unscopables.js b/tests/stress/global-environment-does-not-trap-unscopables.js
new file mode 100644 (file)
index 0000000..de96608
--- /dev/null
@@ -0,0 +1,19 @@
+function test(actual, expected) {
+    if (actual !== expected)
+        throw new Error('bad value: ' + actual);
+}
+
+var global = new Function('return this')();
+var Cocoa = 'Cocoa';
+
+global[Symbol.unscopables] = {
+    Cocoa: true
+};
+
+test(Cocoa, "Cocoa");
+(function () {
+    var Cocoa = 'local'
+    with (global) {
+        test(Cocoa, "local");
+    }
+}());