Update the test to ensure OutOfMemoryError is thrown as intended
authorysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2019 00:27:58 +0000 (00:27 +0000)
committerysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Mar 2019 00:27:58 +0000 (00:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196032
<rdar://problem/46842740>

Rubber stamped by Saam Barati.

* stress/create-error-out-of-memory-rope-string.js:
(assert):
(catch):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243265 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JSTests/ChangeLog
JSTests/stress/create-error-out-of-memory-rope-string.js

index d7c5ee8..de15dd7 100644 (file)
@@ -1,3 +1,15 @@
+2019-03-20  Yusuke Suzuki  <ysuzuki@apple.com>
+
+        Update the test to ensure OutOfMemoryError is thrown as intended
+        https://bugs.webkit.org/show_bug.cgi?id=196032
+        <rdar://problem/46842740>
+
+        Rubber stamped by Saam Barati.
+
+        * stress/create-error-out-of-memory-rope-string.js:
+        (assert):
+        (catch):
+
 2019-03-20  Tadeu Zagallo  <tzagallo@apple.com>
 
         JSC::createError needs to check for OOM in errorDescriptionForValue
index c34191c..33fff7c 100644 (file)
@@ -1,3 +1,13 @@
-var foo = 'yy?x\uFFFD$w    5?\uFFFDo\uFFFD?\uFFFD\'i?\uFFFDE-N\uFFFD\uFFFD6_\uFFFD\\ d';
-foo = foo.padEnd(2147483644, 1);
-eval('foo()');
+function assert(a, message) {
+    if (!a)
+        throw new Error(message);
+}
+
+try {
+    var foo = 'yy?x\uFFFD$w    5?\uFFFDo\uFFFD?\uFFFD\'i?\uFFFDE-N\uFFFD\uFFFD6_\uFFFD\\ d';
+    foo = foo.padEnd(2147483644, 1);
+    eval('foo()');
+    assert(false, `Should throw OOM error`);
+} catch (error) {
+    assert(error.message == "Out of memory", "Expected OutOfMemoryError, but got: " + error);
+}