本文整理汇总了C++中SourceLocation::scriptId方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceLocation::scriptId方法的具体用法?C++ SourceLocation::scriptId怎么用?C++ SourceLocation::scriptId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceLocation
的用法示例。
在下文中一共展示了SourceLocation::scriptId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exceptionThrown
void MainThreadDebugger::exceptionThrown(ExecutionContext* context,
ErrorEvent* event) {
LocalFrame* frame = nullptr;
ScriptState* scriptState = nullptr;
if (context->isDocument()) {
frame = toDocument(context)->frame();
if (!frame)
return;
scriptState = event->world() ? ScriptState::forWorld(frame, *event->world())
: nullptr;
} else if (context->isMainThreadWorkletGlobalScope()) {
frame = toMainThreadWorkletGlobalScope(context)->frame();
if (!frame)
return;
scriptState = toMainThreadWorkletGlobalScope(context)
->scriptController()
->getScriptState();
} else {
NOTREACHED();
}
frame->console().reportMessageToClient(JSMessageSource, ErrorMessageLevel,
event->messageForConsole(),
event->location());
const String defaultMessage = "Uncaught";
if (scriptState && scriptState->contextIsValid()) {
ScriptState::Scope scope(scriptState);
v8::Local<v8::Value> exception =
V8ErrorHandler::loadExceptionFromErrorEventWrapper(
scriptState, event, scriptState->context()->Global());
SourceLocation* location = event->location();
String message = event->messageForConsole();
String url = location->url();
v8Inspector()->exceptionThrown(
scriptState->context(), toV8InspectorStringView(defaultMessage),
exception, toV8InspectorStringView(message),
toV8InspectorStringView(url), location->lineNumber(),
location->columnNumber(), location->takeStackTrace(),
location->scriptId());
}
}