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

Side by Side Diff: test/mjsunit/harmony/proxies-set-prototype-of.js

Issue 1680133002: [proxies] Implement spec change to consistency check in [[SetPrototypeOf]]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-proxies --harmony-reflect 5 // Flags: --harmony-proxies --harmony-reflect
6 6
7 var target = { target: 1 }; 7 var target = { target: 1 };
8 target.__proto__ = {}; 8 target.__proto__ = {};
9 var handler = { handler: 1 }; 9 var handler = { handler: 1 };
10 var proxy = new Proxy(target, handler); 10 var proxy = new Proxy(target, handler);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 assertEquals([3], Reflect.getPrototypeOf(target)); 113 assertEquals([3], Reflect.getPrototypeOf(target));
114 114
115 // Setting the prototype of a non-extensible target is fine if the prototype 115 // Setting the prototype of a non-extensible target is fine if the prototype
116 // doesn't change. 116 // doesn't change.
117 delete handler.getPrototypeOf; 117 delete handler.getPrototypeOf;
118 Reflect.setPrototypeOf(proxy2, prototype); 118 Reflect.setPrototypeOf(proxy2, prototype);
119 // Changing the prototype will throw. 119 // Changing the prototype will throw.
120 prototype = [5]; 120 prototype = [5];
121 assertThrows(() => {Reflect.setPrototypeOf(proxy2, prototype)}, TypeError); 121 assertThrows(() => {Reflect.setPrototypeOf(proxy2, prototype)}, TypeError);
122 })(); 122 })();
123
124 (function testProxyTrapReturnsFalse() {
125 var handler = {};
126 handler.setPrototypeOf = () => false;
127 var target = new Proxy({}, {isExtensible: () => assertUnreachable()});
128 var object = new Proxy(target, handler);
129 assertFalse(Reflect.setPrototypeOf(object, {}));
130 })();
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698