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

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

Issue 2123263002: [builtins] Migrate SharedArrayBuffer.byteLength to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@ArrayBufferGetByteLen
Patch Set: Minor typo fixes Created 4 years, 5 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
« no previous file with comments | « src/v8.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/sharedarraybuffer.js
diff --git a/test/mjsunit/harmony/sharedarraybuffer.js b/test/mjsunit/harmony/sharedarraybuffer.js
index 7bd4e5b121e99fcb7684e9f7d3000cd0380cd39d..7c34ed3009224b3fdd389131a6de5e80695cb683 100644
--- a/test/mjsunit/harmony/sharedarraybuffer.js
+++ b/test/mjsunit/harmony/sharedarraybuffer.js
@@ -572,3 +572,21 @@ for(i = 0; i < typedArrayConstructors.length; i++) {
assertThrows(function(i) { typedArrayConstructors[i](); }.bind(this, i),
TypeError);
}
+
+// byteLength from prototype can be overwritten
+var s = new SharedArrayBuffer(10);
+assertEquals(10, s.byteLength);
+Object.defineProperty(s, 'byteLength', {value: 42});
+assertEquals(42, s.byteLength);
+
+// byteLength on incompatible type (shared vs. regular ArrayBuffer)
+var desc = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'byteLength');
+s = new SharedArrayBuffer(10);
+Object.defineProperty(s, 'byteLength', desc);
+assertThrows(function() {s.byteLength}, TypeError);
+
+desc = Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype,
+ 'byteLength');
+var a = new ArrayBuffer(10);
+Object.defineProperty(a, 'byteLength', desc);
+assertThrows(function() {a.byteLength}, TypeError);
« no previous file with comments | « src/v8.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698