本文整理汇总了C++中ErrorEvent::message方法的典型用法代码示例。如果您正苦于以下问题:C++ ErrorEvent::message方法的具体用法?C++ ErrorEvent::message怎么用?C++ ErrorEvent::message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorEvent
的用法示例。
在下文中一共展示了ErrorEvent::message方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getListenerObject
v8::Local<v8::Value> V8ErrorHandler::callListenerFunction(v8::Handle<v8::Value> jsEvent, Event* event)
{
if (!event->hasInterface(EventNames::ErrorEvent))
return V8EventListener::callListenerFunction(jsEvent, event);
ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event);
if (errorEvent->world() && errorEvent->world() != &world())
return v8::Null(isolate());
v8::Local<v8::Object> listener = getListenerObject(scriptState()->executionContext());
v8::Local<v8::Value> returnValue;
if (!listener.IsEmpty() && listener->IsFunction()) {
v8::Local<v8::Function> callFunction = v8::Local<v8::Function>::Cast(listener);
v8::Local<v8::Object> thisValue = scriptState()->context()->Global();
v8::Local<v8::Value> error = V8HiddenValue::getHiddenValue(isolate(), jsEvent->ToObject(), V8HiddenValue::error(isolate()));
if (error.IsEmpty())
error = v8::Null(isolate());
v8::Handle<v8::Value> parameters[5] = { v8String(isolate(), errorEvent->message()), v8String(isolate(), errorEvent->filename()), v8::Integer::New(isolate(), errorEvent->lineno()), v8::Integer::New(isolate(), errorEvent->colno()), error };
v8::TryCatch tryCatch;
tryCatch.SetVerbose(true);
returnValue = ScriptController::callFunction(scriptState()->executionContext(), callFunction, thisValue, WTF_ARRAY_LENGTH(parameters), parameters, isolate());
}
return returnValue;
}
示例2: jsErrorEventMessage
JSValue jsErrorEventMessage(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSErrorEvent* castedThis = static_cast<JSErrorEvent*>(asObject(slotBase));
UNUSED_PARAM(exec);
ErrorEvent* imp = static_cast<ErrorEvent*>(castedThis->impl());
JSValue result = jsString(exec, imp->message());
return result;
}
示例3: handleEvent
void JSWorkerContextErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event)
{
ASSERT(scriptExecutionContext);
if (!scriptExecutionContext)
return;
JSLock lock(SilenceAssertionsOnly);
JSObject* jsFunction = this->jsFunction(scriptExecutionContext);
if (!jsFunction)
return;
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext, isolatedWorld());
if (!globalObject)
return;
ExecState* exec = globalObject->globalExec();
CallData callData;
CallType callType = jsFunction->getCallData(callData);
if (callType != CallTypeNone) {
ref();
Event* savedEvent = globalObject->currentEvent();
globalObject->setCurrentEvent(event);
ASSERT(event->isErrorEvent());
ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event);
MarkedArgumentBuffer args;
args.append(jsString(exec, errorEvent->message()));
args.append(jsString(exec, errorEvent->filename()));
args.append(jsNumber(exec, errorEvent->lineno()));
JSGlobalData* globalData = globalObject->globalData();
DynamicGlobalObjectScope globalObjectScope(exec, globalData->dynamicGlobalObject ? globalData->dynamicGlobalObject : globalObject);
JSValue thisValue = globalObject->toThisObject(exec);
globalData->timeoutChecker.start();
JSValue returnValue = JSC::call(exec, jsFunction, callType, callData, thisValue, args);
globalData->timeoutChecker.stop();
globalObject->setCurrentEvent(savedEvent);
if (exec->hadException())
reportCurrentException(exec);
else {
bool retvalbool;
if (returnValue.getBoolean(retvalbool) && !retvalbool)
event->preventDefault();
}
deref();
}
}
示例4: handleEvent
void JSErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event)
{
if (!event->hasInterface(eventNames().interfaceForErrorEvent))
return JSEventListener::handleEvent(scriptExecutionContext, event);
ASSERT(scriptExecutionContext);
if (!scriptExecutionContext)
return;
ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event);
JSLock lock(SilenceAssertionsOnly);
JSObject* jsFunction = this->jsFunction(scriptExecutionContext);
if (!jsFunction)
return;
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext, isolatedWorld());
if (!globalObject)
return;
ExecState* exec = globalObject->globalExec();
CallData callData;
CallType callType = jsFunction->methodTable()->getCallData(jsFunction, callData);
if (callType != CallTypeNone) {
RefPtr<JSErrorHandler> protectedctor(this);
Event* savedEvent = globalObject->currentEvent();
globalObject->setCurrentEvent(event);
MarkedArgumentBuffer args;
args.append(jsString(exec, errorEvent->message()));
args.append(jsString(exec, errorEvent->filename()));
args.append(jsNumber(errorEvent->lineno()));
JSGlobalData& globalData = globalObject->globalData();
DynamicGlobalObjectScope globalObjectScope(globalData, globalData.dynamicGlobalObject ? globalData.dynamicGlobalObject : globalObject);
JSValue thisValue = globalObject->methodTable()->toThisObject(globalObject, exec);
globalData.timeoutChecker.start();
JSValue returnValue = scriptExecutionContext->isDocument()
? JSMainThreadExecState::call(exec, jsFunction, callType, callData, thisValue, args)
: JSC::call(exec, jsFunction, callType, callData, thisValue, args);
globalData.timeoutChecker.stop();
globalObject->setCurrentEvent(savedEvent);
if (exec->hadException())
reportCurrentException(exec);
else {
if (returnValue.isTrue())
event->preventDefault();
}
}
}
示例5: handleEvent
void JSErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event)
{
if (event->eventInterface() != ErrorEventInterfaceType)
return JSEventListener::handleEvent(scriptExecutionContext, event);
ASSERT(scriptExecutionContext);
if (!scriptExecutionContext)
return;
ErrorEvent* errorEvent = toErrorEvent(event);
JSLockHolder lock(scriptExecutionContext->vm());
JSObject* jsFunction = this->jsFunction(scriptExecutionContext);
if (!jsFunction)
return;
JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(scriptExecutionContext, isolatedWorld());
if (!globalObject)
return;
ExecState* exec = globalObject->globalExec();
CallData callData;
CallType callType = jsFunction->methodTable()->getCallData(jsFunction, callData);
if (callType != CallTypeNone) {
Ref<JSErrorHandler> protectedctor(*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()));
VM& vm = globalObject->vm();
VMEntryScope entryScope(vm, vm.entryScope ? vm.entryScope->globalObject() : globalObject);
JSValue returnValue = scriptExecutionContext->isDocument()
? JSMainThreadExecState::call(exec, jsFunction, callType, callData, globalObject, args)
: JSC::call(exec, jsFunction, callType, callData, globalObject, args);
globalObject->setCurrentEvent(savedEvent);
if (exec->hadException())
reportCurrentException(exec);
else {
if (returnValue.isTrue())
event->preventDefault();
}
}
}
示例6: tryCatch
v8::Local<v8::Value> V8ErrorHandler::callListenerFunction(
ScriptState* scriptState,
v8::Local<v8::Value> jsEvent,
Event* event) {
ASSERT(!jsEvent.IsEmpty());
if (!event->hasInterface(EventNames::ErrorEvent))
return V8EventListener::callListenerFunction(scriptState, jsEvent, event);
ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event);
if (errorEvent->world() && errorEvent->world() != &world())
return v8::Null(isolate());
v8::Local<v8::Object> listener =
getListenerObject(scriptState->getExecutionContext());
if (listener.IsEmpty() || !listener->IsFunction())
return v8::Null(isolate());
v8::Local<v8::Function> callFunction =
v8::Local<v8::Function>::Cast(listener);
v8::Local<v8::Object> thisValue = scriptState->context()->Global();
v8::Local<v8::Object> eventObject;
if (!jsEvent->ToObject(scriptState->context()).ToLocal(&eventObject))
return v8::Null(isolate());
auto privateError = V8PrivateProperty::getErrorEventError(isolate());
v8::Local<v8::Value> error =
privateError.getOrUndefined(scriptState->context(), eventObject);
if (error->IsUndefined())
error = v8::Null(isolate());
v8::Local<v8::Value> parameters[5] = {
v8String(isolate(), errorEvent->message()),
v8String(isolate(), errorEvent->filename()),
v8::Integer::New(isolate(), errorEvent->lineno()),
v8::Integer::New(isolate(), errorEvent->colno()), error};
v8::TryCatch tryCatch(isolate());
tryCatch.SetVerbose(true);
v8::MaybeLocal<v8::Value> result;
if (scriptState->getExecutionContext()->isWorkerGlobalScope()) {
result = V8ScriptRunner::callFunction(
callFunction, scriptState->getExecutionContext(), thisValue,
WTF_ARRAY_LENGTH(parameters), parameters, isolate());
} else {
result = V8ScriptRunner::callFunction(
callFunction, scriptState->getExecutionContext(), thisValue,
WTF_ARRAY_LENGTH(parameters), parameters, isolate());
}
v8::Local<v8::Value> returnValue;
if (!result.ToLocal(&returnValue))
return v8::Null(isolate());
return returnValue;
}
示例7: ASSERT
v8::Local<v8::Value> V8WorkerContextErrorHandler::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event)
{
ASSERT(event->isErrorEvent());
v8::Local<v8::Object> listener = getListenerObject(context);
v8::Local<v8::Value> returnValue;
if (!listener.IsEmpty() && listener->IsFunction()) {
ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event);
v8::Local<v8::Function> callFunction = v8::Local<v8::Function>::Cast(listener);
v8::Local<v8::Object> thisValue = v8::Context::GetCurrent()->Global();
v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message()), v8String(errorEvent->filename()), v8::Integer::New(errorEvent->lineno()) };
returnValue = callFunction->Call(thisValue, 3, parameters);
}
return returnValue;
}