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

Unified Diff: test/mjsunit/proto-accessor.js

Issue 1198523002: [es6] throw TypeError when setting cyclic prototype value (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add proto-accessor tests 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/proto-accessor.js
diff --git a/test/mjsunit/proto-accessor.js b/test/mjsunit/proto-accessor.js
index 513a044023e9db5d74449f5f4d46fb02a74ff571..935ea8dbeb3a4ef48be46c3961ea4c69e5e6cf8a 100644
--- a/test/mjsunit/proto-accessor.js
+++ b/test/mjsunit/proto-accessor.js
@@ -29,6 +29,24 @@
this.Symbol = typeof Symbol != 'undefined' ? Symbol : String;
+function TestSetProtoValueCyclic() {
+ var objects = [
+ Object.prototype, {},
+ Array.prototype, [],
+ Error.prototype, new TypeError,
+ // etc ...
+ ];
+ for (var i = 0; i < objects.length; i += 2) {
+ var object = objects[i];
+ var value = objects[i+1];
+ assertThrows(function() {
+ object.__proto__ = value;
+ }, TypeError);
+ }
+};
+TestSetProtoValueCyclic();
+
+
var desc = Object.getOwnPropertyDescriptor(Object.prototype, "__proto__");
var getProto = desc.get;
var setProto = desc.set;
« test/mjsunit/harmony/set-prototype-of.js ('K') | « test/mjsunit/harmony/set-prototype-of.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698