]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/class-syntax-tdz-in-catch.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / class-syntax-tdz-in-catch.js
diff --git a/tests/stress/class-syntax-tdz-in-catch.js b/tests/stress/class-syntax-tdz-in-catch.js
new file mode 100644 (file)
index 0000000..3704bcf
--- /dev/null
@@ -0,0 +1,30 @@
+
+class A {
+    constructor() { }
+}
+
+class B extends A {
+    constructor() {
+        try {
+            this;
+        } catch (e) {
+            this;
+            super();
+        }
+    }
+}
+
+noInline(B);
+
+for (var i = 0; i < 10000; ++i) {
+    var exception = null;
+    try {
+         new B(false);
+    } catch (e) {
+        exception = e;
+        if (!(e instanceof ReferenceError))
+            throw "Exception thrown in iteration " + i + " was not a reference error";
+    }
+    if (!exception)
+        throw "Exception not thrown for an unitialized this at iteration " + i;
+}