summaryrefslogtreecommitdiff
path: root/Source/WebCore/bindings/js/JSErrorHandler.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/bindings/js/JSErrorHandler.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/bindings/js/JSErrorHandler.cpp')
-rw-r--r--Source/WebCore/bindings/js/JSErrorHandler.cpp35
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();