From 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c Mon Sep 17 00:00:00 2001 From: Lorry Tar Creator Date: Tue, 27 Jun 2017 06:07:23 +0000 Subject: webkitgtk-2.16.5 --- Source/JavaScriptCore/API/APICallbackFunction.h | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'Source/JavaScriptCore/API/APICallbackFunction.h') diff --git a/Source/JavaScriptCore/API/APICallbackFunction.h b/Source/JavaScriptCore/API/APICallbackFunction.h index 65c519b7a..e5283b5b4 100644 --- a/Source/JavaScriptCore/API/APICallbackFunction.h +++ b/Source/JavaScriptCore/API/APICallbackFunction.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Apple Inc. All rights reserved. + * Copyright (C) 2013, 2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,9 +27,9 @@ #define APICallbackFunction_h #include "APICast.h" -#include "APIShims.h" #include "Error.h" #include "JSCallbackConstructor.h" +#include "JSLock.h" #include namespace JSC { @@ -44,9 +44,11 @@ template static EncodedJSValue JSC_HOST_CALL construct(ExecState*); template EncodedJSValue JSC_HOST_CALL APICallbackFunction::call(ExecState* exec) { + VM& vm = exec->vm(); + auto scope = DECLARE_THROW_SCOPE(vm); JSContextRef execRef = toRef(exec); - JSObjectRef functionRef = toRef(exec->callee()); - JSObjectRef thisObjRef = toRef(jsCast(exec->hostThisValue().toThis(exec, NotStrictMode))); + JSObjectRef functionRef = toRef(exec->jsCallee()); + JSObjectRef thisObjRef = toRef(jsCast(exec->thisValue().toThis(exec, NotStrictMode))); int argumentCount = static_cast(exec->argumentCount()); Vector arguments; @@ -57,11 +59,11 @@ EncodedJSValue JSC_HOST_CALL APICallbackFunction::call(ExecState* exec) JSValueRef exception = 0; JSValueRef result; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); result = jsCast(toJS(functionRef))->functionCallback()(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception); } if (exception) - exec->vm().throwException(exec, toJS(exec, exception)); + throwException(exec, scope, toJS(exec, exception)); // result must be a valid JSValue. if (!result) @@ -73,7 +75,9 @@ EncodedJSValue JSC_HOST_CALL APICallbackFunction::call(ExecState* exec) template EncodedJSValue JSC_HOST_CALL APICallbackFunction::construct(ExecState* exec) { - JSObject* constructor = exec->callee(); + VM& vm = exec->vm(); + auto scope = DECLARE_THROW_SCOPE(vm); + JSObject* constructor = exec->jsCallee(); JSContextRef ctx = toRef(exec); JSObjectRef constructorRef = toRef(constructor); @@ -88,16 +92,16 @@ EncodedJSValue JSC_HOST_CALL APICallbackFunction::construct(ExecState* exec) JSValueRef exception = 0; JSObjectRef result; { - APICallbackShim callbackShim(exec); + JSLock::DropAllLocks dropAllLocks(exec); result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception); } if (exception) { - exec->vm().throwException(exec, toJS(exec, exception)); + throwException(exec, scope, toJS(exec, exception)); return JSValue::encode(toJS(exec, exception)); } // result must be a valid JSValue. if (!result) - return throwVMTypeError(exec); + return throwVMTypeError(exec, scope); return JSValue::encode(toJS(result)); } -- cgit v1.2.1