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

Side by Side Diff: test/mjsunit/es6/regress/regress-cr493566.js

Issue 1161073002: [es6] Make sure we call add property when adding a new property (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Only test left 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 unified diff | Download patch
« no previous file with comments | « no previous file | 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
(Empty)
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
3 // found in the LICENSE file.
4
5 // Flags: --harmony-proxies
6
7 "use strict";
8
9
10 var global = this;
11
12
13 (function TestGlobalReceiver() {
14 class A {
15 s() {
16 super.bla = 10;
17 }
18 }
19 new A().s.call(global);
20 assertEquals(10, global.bla);
21 })();
22
23
24 (function TestProxyProto() {
25 var calls = 0;
26 var handler = {
27 getPropertyDescriptor: function(name) {
28 calls++;
29 return undefined;
30 }
31 };
32
33 var proto = {};
34 var proxy = Proxy.create(handler, proto);
35 var object = {
36 __proto__: proxy,
37 setX(v) {
38 super.x = v;
39 },
40 setSymbol(sym, v) {
41 super[sym] = v;
42 }
43 };
44
45 object.setX(1);
46 assertEquals(1, Object.getOwnPropertyDescriptor(object, 'x').value);
47 assertEquals(1, calls);
48
49 var sym = Symbol();
50 object.setSymbol.call(global, sym, 2);
51 assertEquals(2, Object.getOwnPropertyDescriptor(global, sym).value);
52 // We currently do not invoke proxy traps for symbols
53 assertEquals(1, calls);
54 })();
55
56
57 (function TestProxyReceiver() {
58 var object = {
59 setY(v) {
60 super.y = v;
61 }
62 };
63
64 var calls = 0;
65 var handler = {
66 getPropertyDescriptor(name) {
67 assertUnreachable();
68 },
69 set(receiver, name, value) {
70 calls++;
71 assertEquals(proxy, receiver);
72 assertEquals('y', name);
73 assertEquals(3, value);
74 }
75 };
76
77 var proxy = Proxy.create(handler);
78 object.setY.call(proxy, 3);
79 assertEquals(1, calls);
80 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698