Index: test/webkit/array-proto-func-length-getter-except.js |
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/array-proto-func-length-getter-except.js |
similarity index 53% |
copy from test/webkit/concat-while-having-a-bad-time.js |
copy to test/webkit/array-proto-func-length-getter-except.js |
index dfda1e08a0b36194b787a44ee12a9693acd8aeaf..658479596935abc34c2aeb6ab42fe6f3643c0b52 100644 |
--- a/test/webkit/concat-while-having-a-bad-time.js |
+++ b/test/webkit/array-proto-func-length-getter-except.js |
@@ -22,10 +22,43 @@ |
// 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 functions on the array prototype correctly handle exceptions from length getters when called on non-array objects." |
); |
-Object.defineProperty(Array.prototype, 0, { writable: false }); |
-shouldBe("[42].concat()", "[42]"); |
+var testObj = { |
+ 0: "a", |
+ 1: "b", |
+ 2: "c" |
+}; |
+var lengthGetter = { |
+ get: (function() { throw true; }) |
+} |
+Object.defineProperty(testObj, "length", lengthGetter); |
+function test(f) { |
+ try { |
+ f.call(testObj, undefined); |
+ return false; |
+ } catch (e) { |
+ return e === true; |
+ } |
+} |
+shouldBeTrue("test(Array.prototype.join)"); |
+shouldBeTrue("test(Array.prototype.pop)"); |
+shouldBeTrue("test(Array.prototype.push)"); |
+shouldBeTrue("test(Array.prototype.reverse)"); |
+shouldBeTrue("test(Array.prototype.shift)"); |
+shouldBeTrue("test(Array.prototype.slice)"); |
+shouldBeTrue("test(Array.prototype.sort)"); |
+shouldBeTrue("test(Array.prototype.splice)"); |
+shouldBeTrue("test(Array.prototype.unshift)"); |
+shouldBeTrue("test(Array.prototype.indexOf)"); |
+shouldBeTrue("test(Array.prototype.lastIndexOf)"); |
+shouldBeTrue("test(Array.prototype.every)"); |
+shouldBeTrue("test(Array.prototype.some)"); |
+shouldBeTrue("test(Array.prototype.forEach)"); |
+shouldBeTrue("test(Array.prototype.map)"); |
+shouldBeTrue("test(Array.prototype.filter)"); |
+shouldBeTrue("test(Array.prototype.reduce)"); |
+shouldBeTrue("test(Array.prototype.reduceRight)"); |