Index: test/mjsunit/harmony/typedarrays.js |
diff --git a/test/mjsunit/harmony/typedarrays.js b/test/mjsunit/harmony/typedarrays.js |
index 70bd17e3382db1cdb115d5aae6e48cf9141bc82a..1c6bb1fd29f06b278b5dde543307240b9e87d661 100644 |
--- a/test/mjsunit/harmony/typedarrays.js |
+++ b/test/mjsunit/harmony/typedarrays.js |
@@ -121,6 +121,15 @@ TestArrayBufferSlice(); |
// Typed arrays |
+function GetPropertyDescriptor(object, field) { |
adamk
2015/06/13 00:49:38
And here.
Maybe I'm missing something as to why t
|
+ var descriptor; |
+ while (descriptor === undefined && object !== Object.prototype) { |
+ descriptor = Object.getOwnPropertyDescriptor(object, field); |
+ object = object.__proto__; |
+ } |
+ return descriptor; |
+} |
+ |
function TestTypedArray(constr, elementSize, typicalElement) { |
assertSame(elementSize, constr.BYTES_PER_ELEMENT); |
@@ -269,8 +278,7 @@ function TestTypedArray(constr, elementSize, typicalElement) { |
var a = new constr(ab, 64*elementSize, 128); |
assertEquals("[object " + constr.name + "]", |
Object.prototype.toString.call(a)); |
- var desc = Object.getOwnPropertyDescriptor( |
- constr.prototype, Symbol.toStringTag); |
+ var desc = GetPropertyDescriptor(constr.prototype, Symbol.toStringTag); |
assertTrue(desc.configurable); |
assertFalse(desc.enumerable); |
assertFalse(!!desc.writable); |
@@ -380,17 +388,13 @@ var typedArrayConstructors = [ |
function TestPropertyTypeChecks(constructor) { |
function CheckProperty(name) { |
- var d = Object.getOwnPropertyDescriptor(constructor.prototype, name); |
+ var d = GetPropertyDescriptor(constructor.prototype, name); |
var o = {}; |
assertThrows(function() {d.get.call(o);}, TypeError); |
for (var i = 0; i < typedArrayConstructors.length; i++) { |
var ctor = typedArrayConstructors[i]; |
var a = new ctor(10); |
- if (ctor === constructor) { |
- d.get.call(a); // shouldn't throw |
- } else { |
- assertThrows(function() {d.get.call(a);}, TypeError); |
- } |
+ d.get.call(a); // shouldn't throw, even from a different type |
} |
} |