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

Side by Side Diff: src/js/proxy.js

Issue 1427743011: [proxies] Remove "fix" functionality, add (still unused) target property. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Test Created 5 years, 1 month 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/factory.cc ('k') | src/js/v8natives.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 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 (function(global, utils) { 5 (function(global, utils) {
6 6
7 "use strict"; 7 "use strict";
8 8
9 %CheckIsBootstrapping(); 9 %CheckIsBootstrapping();
10 10
11 // ---------------------------------------------------------------------------- 11 // ----------------------------------------------------------------------------
(...skipping 11 matching lines...) Expand all
23 23
24 //---------------------------------------------------------------------------- 24 //----------------------------------------------------------------------------
25 25
26 function ProxyCreate(handler, proto) { 26 function ProxyCreate(handler, proto) {
27 if (!IS_SPEC_OBJECT(handler)) 27 if (!IS_SPEC_OBJECT(handler))
28 throw MakeTypeError(kProxyHandlerNonObject, "create") 28 throw MakeTypeError(kProxyHandlerNonObject, "create")
29 if (IS_UNDEFINED(proto)) 29 if (IS_UNDEFINED(proto))
30 proto = null 30 proto = null
31 else if (!(IS_SPEC_OBJECT(proto) || IS_NULL(proto))) 31 else if (!(IS_SPEC_OBJECT(proto) || IS_NULL(proto)))
32 throw MakeTypeError(kProxyProtoNonObject) 32 throw MakeTypeError(kProxyProtoNonObject)
33 return %CreateJSProxy(handler, proto) 33 return %CreateJSProxy({}, handler, proto)
34 } 34 }
35 35
36 function ProxyCreateFunction(handler, callTrap, constructTrap) { 36 function ProxyCreateFunction(handler, callTrap, constructTrap) {
37 if (!IS_SPEC_OBJECT(handler)) 37 if (!IS_SPEC_OBJECT(handler))
38 throw MakeTypeError(kProxyHandlerNonObject, "createFunction") 38 throw MakeTypeError(kProxyHandlerNonObject, "createFunction")
39 if (!IS_CALLABLE(callTrap)) 39 if (!IS_CALLABLE(callTrap))
40 throw MakeTypeError(kProxyTrapFunctionExpected, "call") 40 throw MakeTypeError(kProxyTrapFunctionExpected, "call")
41 if (IS_UNDEFINED(constructTrap)) { 41 if (IS_UNDEFINED(constructTrap)) {
42 constructTrap = DerivedConstructTrap(callTrap) 42 constructTrap = DerivedConstructTrap(callTrap)
43 } else if (IS_CALLABLE(constructTrap)) { 43 } else if (IS_CALLABLE(constructTrap)) {
44 // Make sure the trap receives 'undefined' as this. 44 // Make sure the trap receives 'undefined' as this.
45 var construct = constructTrap 45 var construct = constructTrap
46 constructTrap = function() { 46 constructTrap = function() {
47 return %Apply(construct, UNDEFINED, arguments, 0, %_ArgumentsLength()); 47 return %Apply(construct, UNDEFINED, arguments, 0, %_ArgumentsLength());
48 } 48 }
49 } else { 49 } else {
50 throw MakeTypeError(kProxyTrapFunctionExpected, "construct") 50 throw MakeTypeError(kProxyTrapFunctionExpected, "construct")
51 } 51 }
52 return %CreateJSFunctionProxy( 52 return %CreateJSFunctionProxy(
53 handler, callTrap, constructTrap, GlobalFunction.prototype) 53 {}, handler, callTrap, constructTrap, GlobalFunction.prototype)
54 } 54 }
55 55
56 // ------------------------------------------------------------------- 56 // -------------------------------------------------------------------
57 // Proxy Builtins 57 // Proxy Builtins
58 58
59 function DerivedConstructTrap(callTrap) { 59 function DerivedConstructTrap(callTrap) {
60 return function() { 60 return function() {
61 var proto = this.prototype 61 var proto = this.prototype
62 if (!IS_SPEC_OBJECT(proto)) proto = GlobalObject.prototype 62 if (!IS_SPEC_OBJECT(proto)) proto = GlobalObject.prototype
63 var obj = { __proto__: proto }; 63 var obj = { __proto__: proto };
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 }); 202 });
203 203
204 %InstallToContext([ 204 %InstallToContext([
205 "derived_get_trap", DerivedGetTrap, 205 "derived_get_trap", DerivedGetTrap,
206 "derived_has_trap", DerivedHasTrap, 206 "derived_has_trap", DerivedHasTrap,
207 "derived_set_trap", DerivedSetTrap, 207 "derived_set_trap", DerivedSetTrap,
208 "proxy_enumerate", ProxyEnumerate, 208 "proxy_enumerate", ProxyEnumerate,
209 ]); 209 ]);
210 210
211 }) 211 })
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/js/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698