diff --git a/src/runtime.cc b/src/runtime.cc index 27e02efb06..7b61c3e13f 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -8181,7 +8181,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionBindArguments) { RUNTIME_FUNCTION(MaybeObject*, Runtime_BoundFunctionGetBindings) { HandleScope handles(isolate); ASSERT(args.length() == 1); - CONVERT_ARG_CHECKED(JSObject, callable, 0); + CONVERT_ARG_CHECKED(JSReceiver, callable, 0); if (callable->IsJSFunction()) { Handle function = Handle::cast(callable); if (function->shared()->bound()) { diff --git a/test/mjsunit/harmony/proxies.js b/test/mjsunit/harmony/proxies.js index 1ce7a32d8e..50c8613b63 100644 --- a/test/mjsunit/harmony/proxies.js +++ b/test/mjsunit/harmony/proxies.js @@ -1437,7 +1437,7 @@ TestHasOwnThrow(Proxy.create({ // Instanceof (instanceof) -function TestInstanceof() { +function TestProxyInstanceof() { var o1 = {} var p1 = Proxy.create({}) var p2 = Proxy.create({}, o1) @@ -1483,7 +1483,70 @@ function TestInstanceof() { assertTrue(f instanceof Function) } -TestInstanceof() +TestProxyInstanceof() + + +function TestInstanceofProxy() { + var o0 = Object.create(null) + var o1 = {} + var o2 = Object.create(o0) + var o3 = Object.create(o1) + var o4 = Object.create(o2) + var o5 = Object.create(o3) + + function handler(o) { return {get: function() { return o } } } + var f0 = Proxy.createFunction(handler(o0), function() {}) + var f1 = Proxy.createFunction(handler(o1), function() {}) + var f2 = Proxy.createFunction(handler(o2), function() {}) + var f3 = Proxy.createFunction(handler(o3), function() {}) + var f4 = Proxy.createFunction(handler(o4), function() {}) + var f5 = Proxy.createFunction(handler(o4), function() {}) + + assertFalse(null instanceof f0) + assertFalse(o0 instanceof f0) + assertFalse(o0 instanceof f1) + assertFalse(o0 instanceof f2) + assertFalse(o0 instanceof f3) + assertFalse(o0 instanceof f4) + assertFalse(o0 instanceof f5) + assertFalse(o1 instanceof f0) + assertFalse(o1 instanceof f1) + assertFalse(o1 instanceof f2) + assertFalse(o1 instanceof f3) + assertFalse(o1 instanceof f4) + assertFalse(o1 instanceof f5) + assertTrue(o2 instanceof f0) + assertFalse(o2 instanceof f1) + assertFalse(o2 instanceof f2) + assertFalse(o2 instanceof f3) + assertFalse(o2 instanceof f4) + assertFalse(o2 instanceof f5) + assertFalse(o3 instanceof f0) + assertTrue(o3 instanceof f1) + assertFalse(o3 instanceof f2) + assertFalse(o3 instanceof f3) + assertFalse(o3 instanceof f4) + assertFalse(o3 instanceof f5) + assertTrue(o4 instanceof f0) + assertFalse(o4 instanceof f1) + assertTrue(o4 instanceof f2) + assertFalse(o4 instanceof f3) + assertFalse(o4 instanceof f4) + assertFalse(o4 instanceof f5) + assertFalse(o5 instanceof f0) + assertTrue(o5 instanceof f1) + assertFalse(o5 instanceof f2) + assertTrue(o5 instanceof f3) + assertFalse(o5 instanceof f4) + assertFalse(o5 instanceof f5) + + var f = Proxy.createFunction({}, function() {}) + var ff = Proxy.createFunction(handler(Function), function() {}) + assertTrue(f instanceof Function) + assertFalse(f instanceof ff) +} + +TestInstanceofProxy()