- arguments[i] = toRef(args[i]);
-
- JSLock::DropAllLocks dropAllLocks;
- return toJS(m_callback(ctx, thisRef, argumentCount, arguments.data(), toRef(exec->exceptionSlot())));
+ arguments[i] = toRef(exec, exec->argument(i));
+
+ JSValueRef exception = 0;
+ JSObjectRef result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = callback(ctx, constructorRef, argumentCount, arguments.data(), &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+ return JSValue::encode(toJS(result));