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

Unified Diff: src/proxy.js

Issue 8271005: Adapt to latest spec changes for Proxy.create[Function]. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | « src/messages.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/proxy.js
diff --git a/src/proxy.js b/src/proxy.js
index a51f09ae50ff3eee75840e970413ddd75909d9a9..d93b58ac6a4b9e281347b733a0a98eca9b630d9d 100644
--- a/src/proxy.js
+++ b/src/proxy.js
@@ -32,7 +32,10 @@ var $Proxy = global.Proxy
$Proxy.create = function(handler, proto) {
if (!IS_SPEC_OBJECT(handler))
throw MakeTypeError("handler_non_object", ["create"])
- if (!IS_SPEC_OBJECT(proto)) proto = null // Mozilla does this...
+ if (IS_UNDEFINED(proto))
+ proto = null
+ else if (!(IS_SPEC_OBJECT(proto) || proto === null))
+ throw MakeTypeError("proto_non_object", ["create"])
return %CreateJSProxy(handler, proto)
}
@@ -43,18 +46,13 @@ $Proxy.createFunction = function(handler, callTrap, constructTrap) {
throw MakeTypeError("trap_function_expected", ["createFunction", "call"])
var construct
Michael Starzinger 2011/10/13 16:22:48 I think that "var" can be removed now.
rossberg 2011/10/24 15:59:49 Done.
if (IS_UNDEFINED(constructTrap)) {
- construct = DerivedConstructTrap(callTrap)
- } else if (IS_SPEC_FUNCTION(constructTrap)) {
- construct = function() {
- // Make sure the trap receives 'undefined' as this.
- return %Apply(constructTrap, void 0, arguments, 0, %_ArgumentsLength());
- }
- } else {
+ constructTrap = DerivedConstructTrap(callTrap)
+ } else if (!IS_SPEC_FUNCTION(constructTrap)) {
throw MakeTypeError("trap_function_expected",
["createFunction", "construct"])
}
return %CreateJSFunctionProxy(
- handler, callTrap, construct, $Function.prototype)
+ handler, callTrap, constructTrap, $Function.prototype)
}
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/harmony/proxies.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698