Index: test/webkit/cached-call-uninitialized-arguments.js |
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/cached-call-uninitialized-arguments.js |
similarity index 56% |
copy from test/webkit/concat-while-having-a-bad-time.js |
copy to test/webkit/cached-call-uninitialized-arguments.js |
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..de3f098800776a4d3ea0493b4db7876824f0d1e4 100644 |
--- a/test/webkit/concat-while-having-a-bad-time.js |
+++ b/test/webkit/cached-call-uninitialized-arguments.js |
@@ -22,10 +22,45 @@ |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
description( |
-"Tests the behavior of Array.prototype.concat while the array is having a bad time due to one of the elements we are concatenating." |
+"This test checks that uninitialized parameters for cached call functions correctly defaults to undefined." |
+ |
); |
-Object.defineProperty(Array.prototype, 0, { writable: false }); |
-shouldBe("[42].concat()", "[42]"); |
+function doForEach(arr) { |
+ function callback(element, index, array, arg4, arg5, arg6) { |
+ |
+ function shouldBeUndefined(_a) { |
+ var exception; |
+ var _av; |
+ try { |
+ _av = eval(_a); |
+ } catch (e) { |
+ exception = e; |
+ } |
+ |
+ if (exception) |
+ testFailed(_a + " should be undefined. Threw exception " + exception); |
+ else if (typeof _av == "undefined") |
+ testPassed(_a + " is undefined."); |
+ else |
+ testFailed(_a + " should be undefined. Was " + _av); |
+ } |
+ |
+ shouldBeUndefined("arg4"); |
+ shouldBeUndefined("arg5"); |
+ shouldBeUndefined("arg6"); |
+ } |
+ |
+ arr.forEach(callback); |
+} |
+function callAfterRecursingForDepth(depth, func, arr) { |
+ if (depth > 0) { |
+ callAfterRecursingForDepth(depth - 1, func, arr); |
+ } else { |
+ func(arr); |
+ } |
+} |
+var arr = [1]; |
+callAfterRecursingForDepth(20, doForEach, arr); |