Title: [262847] trunk/JSTests
Revision
262847
Author
ca...@igalia.com
Date
2020-06-10 12:08:32 -0700 (Wed, 10 Jun 2020)

Log Message

[JSC] add stress test for op_get_private_name
https://bugs.webkit.org/show_bug.cgi?id=213024

Reviewed by Mark Lam.

* stress/get-private-name.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/JSTests/ChangeLog (262846 => 262847)


--- trunk/JSTests/ChangeLog	2020-06-10 19:04:56 UTC (rev 262846)
+++ trunk/JSTests/ChangeLog	2020-06-10 19:08:32 UTC (rev 262847)
@@ -1,3 +1,12 @@
+2020-06-10  Caitlin Potter  <ca...@igalia.com>
+
+        [JSC] add stress test for op_get_private_name
+        https://bugs.webkit.org/show_bug.cgi?id=213024
+
+        Reviewed by Mark Lam.
+
+        * stress/get-private-name.js: Added.
+
 2020-06-09  Mark Lam  <mark....@apple.com>
 
         Stringifier::appendStringifiedValue() should not assume it is always safe to recurse.

Added: trunk/JSTests/stress/get-private-name.js (0 => 262847)


--- trunk/JSTests/stress/get-private-name.js	                        (rev 0)
+++ trunk/JSTests/stress/get-private-name.js	2020-06-10 19:08:32 UTC (rev 262847)
@@ -0,0 +1,29 @@
+// FIXME: //@ requireOptions("--usePrivateClassFields=1") --- Run this in all variants once https://bugs.webkit.org/show_bug.cgi?id=212781 is fixed
+//@ runNoJIT("--usePrivateClassFields=1")
+//@ runNoLLInt("--usePrivateClassFields=1")
+
+// GetPrivateName should throw when the receiver does not have the requested private property
+let i, threw = false;
+class C {
+    #x = i;
+    constructor() { if (i === 30) return { [Symbol.toStringTag]: "without #x"}; }
+    static x(obj) { return obj.#x; }
+    get [Symbol.toStringTag]() { return "with #x"; }
+}
+
+try {
+    for (i = 0; i < 50; ++i) {
+        let c = new C;
+        let result = C.x(c);
+        if (result !== i)
+            throw new Error(`Expected C.x(${c}) to be ${i}, but found ${result}`);
+    }
+} catch (e) {
+    threw = true;
+    if (i !== 30 || e.constructor !== TypeError) {
+        throw e;
+    }
+}
+
+if (!threw)
+    throw new Error("Expected TypeError, but no exception was thrown");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to