Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: test/mjsunit/harmony/sharedarraybuffer.js

Issue 1186733002: Add %TypedArray% to proto chain (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/mjsunit/harmony/sharedarraybuffer.js
diff --git a/test/mjsunit/harmony/sharedarraybuffer.js b/test/mjsunit/harmony/sharedarraybuffer.js
index bac42681ab32fd1f521b976e65c96fbb79b2cd2a..d7f63a6898a758a2c538c8e18aea6688dfae0093 100644
--- a/test/mjsunit/harmony/sharedarraybuffer.js
+++ b/test/mjsunit/harmony/sharedarraybuffer.js
@@ -87,6 +87,15 @@ function MakeSharedTypedArray(constr, numElements) {
return new constr(sab);
}
+function GetPropertyDescriptor(object, field) {
adamk 2015/06/13 00:49:38 Same worry here, I'd prefer not to do a prototype
+ 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);
@@ -203,8 +212,7 @@ function TestTypedArray(constr, elementSize, typicalElement) {
var a = new constr(sab, 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);
@@ -310,17 +318,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 = MakeSharedTypedArray(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 on any type
}
}

Powered by Google App Engine
This is Rietveld 408576698