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

Unified Diff: test/mjsunit/regress/regress-95920.js

Issue 1419823008: Fix Object.preventExtensions, .seal, .freeze on typed arrays (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | « test/mjsunit/messages.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-95920.js
diff --git a/test/mjsunit/regress/regress-95920.js b/test/mjsunit/regress/regress-95920.js
index 20e73fbc4026c3969877b6d2e5850d7d2fb2c5c6..55849655614a499d89390b814151302227f85727 100644
--- a/test/mjsunit/regress/regress-95920.js
+++ b/test/mjsunit/regress/regress-95920.js
@@ -28,31 +28,23 @@
// Tests that objects with external arrays cannot be sealed or have their
// properties redefined.
-(function() {
- assertThrows(function() {
- [0].every(function(){ Object.seal((new Int8Array(42))); });
- assertUnreable();
- }, TypeError)
-})();
+Object.preventExtensions(new Int8Array(42));
+Object.seal(new Int8Array(42));
-(function() {
- assertThrows(function() {
- [0].every(function(){ Object.freeze((new Int8Array(42))); });
- assertUnreable();
- }, TypeError)
-})();
+// No elements, so should succeed.
+Object.freeze(new Int8Array(0));
-(function() {
- assertThrows(function() {
- [0].every(function(){ Object.preventExtensions((new Int8Array(42))); });
- assertUnreable();
- }, TypeError)
-})();
+var o = new Int8Array(42);
+assertThrows(function() {
+ Object.freeze(o);
+ assertUnreable();
+ }, TypeError);
-(function() {
- assertThrows(function() {
- Object.defineProperty(new Int8Array(42), "1",
- { writable: false, value: "1" });
- assertUnreable();
- })
-})();
+// Freeze should still have managed to preventExtensions o.
+assertFalse(Object.isExtensible(o));
+
+assertThrows(function() {
+ Object.defineProperty(new Int8Array(42), "1",
+ { writable: false, value: "1" });
+ assertUnreable();
+ });
« no previous file with comments | « test/mjsunit/messages.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698