diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/API/APICallbackFunction.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/API/APICallbackFunction.h')
-rw-r--r-- | Source/JavaScriptCore/API/APICallbackFunction.h | 24 |
1 files changed, 14 insertions, 10 deletions
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 <wtf/Vector.h> namespace JSC { @@ -44,9 +44,11 @@ template <typename T> static EncodedJSValue JSC_HOST_CALL construct(ExecState*); template <typename T> 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<JSObject*>(exec->hostThisValue().toThis(exec, NotStrictMode))); + JSObjectRef functionRef = toRef(exec->jsCallee()); + JSObjectRef thisObjRef = toRef(jsCast<JSObject*>(exec->thisValue().toThis(exec, NotStrictMode))); int argumentCount = static_cast<int>(exec->argumentCount()); Vector<JSValueRef, 16> 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<T*>(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 <typename T> 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)); } |