Modify JSTests/stress/string-overflow-createError-*.js tests to allow an OOME result.
https://bugs.webkit.org/show_bug.cgi?id=202828

Reviewed by Yusuke Suzuki.

The tests intentionally allocate a very large string.  Hence, for some memory
limited configurations, it is perfectly reasonable for the test to throw an Out
Of Memory error.

* stress/string-overflow-createError-builder.js:
* stress/string-overflow-createError-fit.js:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@250995 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JSTests/ChangeLog b/JSTests/ChangeLog
index 25632e9..ab30a8d 100644
--- a/JSTests/ChangeLog
+++ b/JSTests/ChangeLog
@@ -1,3 +1,17 @@
+2019-10-10  Mark Lam  <mark.lam@apple.com>
+
+        Modify JSTests/stress/string-overflow-createError-*.js tests to allow an OOME result.
+        https://bugs.webkit.org/show_bug.cgi?id=202828
+
+        Reviewed by Yusuke Suzuki.
+
+        The tests intentionally allocate a very large string.  Hence, for some memory
+        limited configurations, it is perfectly reasonable for the test to throw an Out
+        Of Memory error.
+
+        * stress/string-overflow-createError-builder.js:
+        * stress/string-overflow-createError-fit.js:
+
 2019-10-09  Yusuke Suzuki  <ysuzuki@apple.com>
 
         Unreviewed, roll out r250878
diff --git a/JSTests/stress/string-overflow-createError-builder.js b/JSTests/stress/string-overflow-createError-builder.js
index 7af309e..c1f39ed 100644
--- a/JSTests/stress/string-overflow-createError-builder.js
+++ b/JSTests/stress/string-overflow-createError-builder.js
@@ -11,5 +11,6 @@
 
 // when the StringBuilder for the error message overflows,
 // "object is not a function" is used as message for the TypeError.
-if (exception.message != "object is not a function.")
+if (exception.message != "object is not a function."
+    && exception != "Error: Out of memory")
     throw "FAILED";
diff --git a/JSTests/stress/string-overflow-createError-fit.js b/JSTests/stress/string-overflow-createError-fit.js
index dc05937..2744cc7 100644
--- a/JSTests/stress/string-overflow-createError-fit.js
+++ b/JSTests/stress/string-overflow-createError-fit.js
@@ -12,5 +12,6 @@
 // Although the message of the TypeError is quite long,
 // it still fits into String::MaxLength. Check the start
 // of the error message.
-if (!exception.message.startsWith("foo is not a function"))
+if (!exception.message.startsWith("foo is not a function")
+    && exception != "Error: Out of memory")
     throw "FAILED";