diff options
Diffstat (limited to 'Source/WebCore/bindings/js/JSErrorHandler.cpp')
-rw-r--r-- | Source/WebCore/bindings/js/JSErrorHandler.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/Source/WebCore/bindings/js/JSErrorHandler.cpp b/Source/WebCore/bindings/js/JSErrorHandler.cpp index f72c334bd..a99c808fa 100644 --- a/Source/WebCore/bindings/js/JSErrorHandler.cpp +++ b/Source/WebCore/bindings/js/JSErrorHandler.cpp @@ -30,15 +30,15 @@ */ #include "config.h" - #include "JSErrorHandler.h" #include "Document.h" #include "ErrorEvent.h" #include "Event.h" -#include "EventNames.h" +#include "JSDOMConvert.h" #include "JSEvent.h" #include "JSMainThreadExecState.h" +#include "JSMainThreadExecStateInstrumentation.h" #include <runtime/JSLock.h> #include <runtime/VMEntryScope.h> #include <wtf/Ref.h> @@ -58,15 +58,14 @@ JSErrorHandler::~JSErrorHandler() void JSErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event) { - - if (event->eventInterface() != ErrorEventInterfaceType) + if (!is<ErrorEvent>(*event)) return JSEventListener::handleEvent(scriptExecutionContext, event); ASSERT(scriptExecutionContext); if (!scriptExecutionContext) return; - ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event); + ErrorEvent& errorEvent = downcast<ErrorEvent>(*event); JSLockHolder lock(scriptExecutionContext->vm()); @@ -83,29 +82,35 @@ void JSErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext, CallData callData; CallType callType = jsFunction->methodTable()->getCallData(jsFunction, callData); - if (callType != CallTypeNone) { - Ref<JSErrorHandler> protectedctor(*this); + if (callType != CallType::None) { + Ref<JSErrorHandler> protectedThis(*this); Event* savedEvent = globalObject->currentEvent(); globalObject->setCurrentEvent(event); MarkedArgumentBuffer args; - args.append(jsStringWithCache(exec, errorEvent->message())); - args.append(jsStringWithCache(exec, errorEvent->filename())); - args.append(jsNumber(errorEvent->lineno())); - args.append(jsNumber(errorEvent->colno())); + args.append(toJS<IDLDOMString>(*exec, errorEvent.message())); + args.append(toJS<IDLUSVString>(*exec, errorEvent.filename())); + args.append(toJS<IDLUnsignedLong>(errorEvent.lineno())); + args.append(toJS<IDLUnsignedLong>(errorEvent.colno())); + args.append(errorEvent.error(*exec, *globalObject)); VM& vm = globalObject->vm(); VMEntryScope entryScope(vm, vm.entryScope ? vm.entryScope->globalObject() : globalObject); + InspectorInstrumentationCookie cookie = JSMainThreadExecState::instrumentFunctionCall(scriptExecutionContext, callType, callData); + + NakedPtr<JSC::Exception> exception; JSValue returnValue = scriptExecutionContext->isDocument() - ? JSMainThreadExecState::call(exec, jsFunction, callType, callData, globalObject, args) - : JSC::call(exec, jsFunction, callType, callData, globalObject, args); + ? JSMainThreadExecState::profiledCall(exec, JSC::ProfilingReason::Other, jsFunction, callType, callData, globalObject, args, exception) + : JSC::profiledCall(exec, JSC::ProfilingReason::Other, jsFunction, callType, callData, globalObject, args, exception); + + InspectorInstrumentation::didCallFunction(cookie, scriptExecutionContext); globalObject->setCurrentEvent(savedEvent); - if (exec->hadException()) - reportCurrentException(exec); + if (exception) + reportException(exec, exception); else { if (returnValue.isTrue()) event->preventDefault(); |