static bool populateContextMenuItems(v8::Isolate* isolate, const v8::Local<v8::Array>& itemArray, ContextMenu& menu) { v8::Local<v8::Context> context = isolate->GetCurrentContext(); for (size_t i = 0; i < itemArray->Length(); ++i) { v8::Local<v8::Object> item = itemArray->Get(context, i).ToLocalChecked().As<v8::Object>(); v8::Local<v8::Value> type; v8::Local<v8::Value> id; v8::Local<v8::Value> label; v8::Local<v8::Value> enabled; v8::Local<v8::Value> checked; v8::Local<v8::Value> subItems; if (!item->Get(context, v8AtomicString(isolate, "type")).ToLocal(&type) || !item->Get(context, v8AtomicString(isolate, "id")).ToLocal(&id) || !item->Get(context, v8AtomicString(isolate, "label")).ToLocal(&label) || !item->Get(context, v8AtomicString(isolate, "enabled")) .ToLocal(&enabled) || !item->Get(context, v8AtomicString(isolate, "checked")) .ToLocal(&checked) || !item->Get(context, v8AtomicString(isolate, "subItems")) .ToLocal(&subItems)) return false; if (!type->IsString()) continue; String typeString = toCoreStringWithNullCheck(type.As<v8::String>()); if (typeString == "separator") { ContextMenuItem item(ContextMenuItem( SeparatorType, ContextMenuItemCustomTagNoAction, String(), String())); menu.appendItem(item); } else if (typeString == "subMenu" && subItems->IsArray()) { ContextMenu subMenu; v8::Local<v8::Array> subItemsArray = v8::Local<v8::Array>::Cast(subItems); if (!populateContextMenuItems(isolate, subItemsArray, subMenu)) return false; TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, labelString, label, false); ContextMenuItem item(SubmenuType, ContextMenuItemCustomTagNoAction, labelString, String(), &subMenu); menu.appendItem(item); } else { int32_t int32Id; if (!v8Call(id->Int32Value(context), int32Id)) return false; ContextMenuAction typedId = static_cast<ContextMenuAction>( ContextMenuItemBaseCustomTag + int32Id); TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, labelString, label, false); ContextMenuItem menuItem( (typeString == "checkbox" ? CheckableActionType : ActionType), typedId, labelString, String()); if (checked->IsBoolean()) menuItem.setChecked(checked.As<v8::Boolean>()->Value()); if (enabled->IsBoolean()) menuItem.setEnabled(enabled.As<v8::Boolean>()->Value()); menu.appendItem(menuItem); } } return true; }
static void messageHandlerInWorker(v8::Local<v8::Message> message, v8::Local<v8::Value> data) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); V8PerIsolateData* perIsolateData = V8PerIsolateData::from(isolate); // During the frame teardown, there may not be a valid context. ScriptState* scriptState = ScriptState::current(isolate); if (!scriptState->contextIsValid()) return; // Exceptions that occur in error handler should be ignored since in that case // WorkerGlobalScope::reportException will send the exception to the worker object. if (perIsolateData->isReportingException()) return; perIsolateData->setReportingException(true); ExecutionContext* context = scriptState->getExecutionContext(); std::unique_ptr<SourceLocation> location = SourceLocation::fromMessage(isolate, message, context); ErrorEvent* event = ErrorEvent::create(toCoreStringWithNullCheck(message->Get()), std::move(location), &scriptState->world()); AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin; // If execution termination has been triggered as part of constructing // the error event from the v8::Message, quietly leave. if (!isolate->IsExecutionTerminating()) { V8ErrorHandler::storeExceptionOnErrorEventWrapper(scriptState, event, data, scriptState->context()->Global()); scriptState->getExecutionContext()->reportException(event, corsStatus); } perIsolateData->setReportingException(false); }
static void messageHandlerInMainThread(v8::Local<v8::Message> message, v8::Local<v8::Value> data) { ASSERT(isMainThread()); v8::Isolate* isolate = v8::Isolate::GetCurrent(); if (isolate->GetEnteredContext().IsEmpty()) return; // If called during context initialization, there will be no entered context. ScriptState* scriptState = ScriptState::current(isolate); if (!scriptState->contextIsValid()) return; ExecutionContext* context = scriptState->getExecutionContext(); std::unique_ptr<SourceLocation> location = SourceLocation::fromMessage(isolate, message, context); AccessControlStatus accessControlStatus = NotSharableCrossOrigin; if (message->IsOpaque()) accessControlStatus = OpaqueResource; else if (message->IsSharedCrossOrigin()) accessControlStatus = SharableCrossOrigin; ErrorEvent* event = ErrorEvent::create(toCoreStringWithNullCheck(message->Get()), std::move(location), &scriptState->world()); String messageForConsole = extractMessageForConsole(isolate, data); if (!messageForConsole.isEmpty()) event->setUnsanitizedMessage("Uncaught " + messageForConsole); // This method might be called while we're creating a new context. In this // case, we avoid storing the exception object, as we can't create a wrapper // during context creation. // FIXME: Can we even get here during initialization now that we bail out when // GetEntered returns an empty handle? if (context->isDocument()) { LocalFrame* frame = toDocument(context)->frame(); if (frame && frame->script().existingWindowProxy(scriptState->world())) { V8ErrorHandler::storeExceptionOnErrorEventWrapper( scriptState, event, data, scriptState->context()->Global()); } } if (scriptState->world().isPrivateScriptIsolatedWorld()) { // We allow a private script to dispatch error events even in a // EventDispatchForbiddenScope scope. Without having this ability, it's // hard to debug the private script because syntax errors in the private // script are not reported to console (the private script just crashes // silently). Allowing error events in private scripts is safe because // error events don't propagate to other isolated worlds (which means that // the error events won't fire any event listeners in user's scripts). EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents; context->dispatchErrorEvent(event, accessControlStatus); } else { context->dispatchErrorEvent(event, accessControlStatus); } }
static void promiseRejectHandlerInMainThread(v8::PromiseRejectMessage data) { ASSERT(isMainThread()); if (data.GetEvent() == v8::kPromiseHandlerAddedAfterReject) { rejectedPromisesOnMainThread().handlerAdded(data); return; } ASSERT(data.GetEvent() == v8::kPromiseRejectWithNoHandler); v8::Local<v8::Promise> promise = data.GetPromise(); v8::Isolate* isolate = promise->GetIsolate(); // There is no entered window during microtask callbacks from V8, // thus we call toDOMWindow() instead of enteredDOMWindow(). LocalDOMWindow* window = currentDOMWindow(isolate); if (!window || !window->isCurrentlyDisplayedInFrame()) return; v8::Local<v8::Value> exception = data.GetValue(); if (V8DOMWrapper::isWrapper(isolate, exception)) { // Try to get the stack & location from a wrapped exception object (e.g. DOMException). ASSERT(exception->IsObject()); v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(exception); v8::Local<v8::Value> error = V8HiddenValue::getHiddenValue(isolate, obj, V8HiddenValue::error(isolate)); if (!error.IsEmpty()) exception = error; } int scriptId = 0; int lineNumber = 0; int columnNumber = 0; String resourceName; String errorMessage; RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr; v8::Local<v8::Message> message = v8::Exception::CreateMessage(exception); if (!message.IsEmpty()) { if (v8Call(message->GetLineNumber(isolate->GetCurrentContext()), lineNumber) && v8Call(message->GetStartColumn(isolate->GetCurrentContext()), columnNumber)) ++columnNumber; resourceName = extractResourceName(message, window->document()); errorMessage = toCoreStringWithNullCheck(message->Get()); callStack = extractCallStack(isolate, message, &scriptId); } else if (!exception.IsEmpty() && exception->IsInt32()) { // For Smi's the message would be empty. errorMessage = "Uncaught " + String::number(exception.As<v8::Integer>()->Value()); } String messageForConsole = extractMessageForConsole(isolate, data.GetValue()); if (!messageForConsole.isEmpty()) errorMessage = "Uncaught " + messageForConsole; ScriptState* scriptState = ScriptState::current(isolate); rejectedPromisesOnMainThread().rejectedWithNoHandler(scriptState, data, errorMessage, resourceName, scriptId, lineNumber, columnNumber, callStack); }
static PassRefPtr<JSONValue> v8ToJSONValueInternal(v8::Handle<v8::Value> value, int maxDepth, v8::Isolate* isolate) { if (value.IsEmpty()) { ASSERT_NOT_REACHED(); return nullptr; } if (!maxDepth) return nullptr; maxDepth--; if (value->IsNull() || value->IsUndefined()) return JSONValue::null(); if (value->IsBoolean()) return JSONBasicValue::create(value->BooleanValue()); if (value->IsNumber()) return JSONBasicValue::create(value->NumberValue()); if (value->IsString()) return JSONString::create(toCoreString(value.As<v8::String>())); if (value->IsArray()) { v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value); RefPtr<JSONArray> inspectorArray = JSONArray::create(); uint32_t length = array->Length(); for (uint32_t i = 0; i < length; i++) { v8::Local<v8::Value> value = array->Get(v8::Int32::New(isolate, i)); RefPtr<JSONValue> element = v8ToJSONValueInternal(value, maxDepth, isolate); if (!element) return nullptr; inspectorArray->pushValue(element); } return inspectorArray; } if (value->IsObject()) { RefPtr<JSONObject> jsonObject = JSONObject::create(); v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value); v8::Local<v8::Array> propertyNames = object->GetPropertyNames(); uint32_t length = propertyNames->Length(); for (uint32_t i = 0; i < length; i++) { v8::Local<v8::Value> name = propertyNames->Get(v8::Int32::New(isolate, i)); // FIXME(yurys): v8::Object should support GetOwnPropertyNames if (name->IsString() && !object->HasRealNamedProperty(v8::Handle<v8::String>::Cast(name))) continue; RefPtr<JSONValue> propertyValue = v8ToJSONValueInternal(object->Get(name), maxDepth, isolate); if (!propertyValue) return nullptr; v8::Local<v8::String> nameString = name.As<v8::String>(); jsonObject->setValue(toCoreStringWithNullCheck(nameString), propertyValue); } return jsonObject; } ASSERT_NOT_REACHED(); return nullptr; }
static void promiseRejectHandler(v8::PromiseRejectMessage data, RejectedPromises& rejectedPromises, const String& fallbackResourceName) { if (data.GetEvent() == v8::kPromiseHandlerAddedAfterReject) { rejectedPromises.handlerAdded(data); return; } ASSERT(data.GetEvent() == v8::kPromiseRejectWithNoHandler); v8::Local<v8::Promise> promise = data.GetPromise(); v8::Isolate* isolate = promise->GetIsolate(); ScriptState* scriptState = ScriptState::current(isolate); v8::Local<v8::Value> exception = data.GetValue(); if (V8DOMWrapper::isWrapper(isolate, exception)) { // Try to get the stack & location from a wrapped exception object (e.g. DOMException). ASSERT(exception->IsObject()); v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(exception); v8::Local<v8::Value> error = V8HiddenValue::getHiddenValue(scriptState, obj, V8HiddenValue::error(isolate)); if (!error.IsEmpty()) exception = error; } int scriptId = 0; int lineNumber = 0; int columnNumber = 0; String resourceName = fallbackResourceName; String errorMessage; AccessControlStatus corsStatus = NotSharableCrossOrigin; RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr; v8::Local<v8::Message> message = v8::Exception::CreateMessage(isolate, exception); if (!message.IsEmpty()) { V8StringResource<> v8ResourceName(message->GetScriptOrigin().ResourceName()); if (v8ResourceName.prepare()) resourceName = v8ResourceName; scriptId = message->GetScriptOrigin().ScriptID()->Value(); if (v8Call(message->GetLineNumber(scriptState->context()), lineNumber) && v8Call(message->GetStartColumn(scriptState->context()), columnNumber)) ++columnNumber; // message->Get() can be empty here. https://crbug.com/450330 errorMessage = toCoreStringWithNullCheck(message->Get()); callStack = extractCallStack(isolate, message, &scriptId); if (message->IsSharedCrossOrigin()) corsStatus = SharableCrossOrigin; } String messageForConsole = extractMessageForConsole(isolate, data.GetValue()); if (!messageForConsole.isEmpty()) errorMessage = "Uncaught " + messageForConsole; rejectedPromises.rejectedWithNoHandler(scriptState, data, errorMessage, resourceName, scriptId, lineNumber, columnNumber, callStack, corsStatus); }
static void messageHandlerInMainThread(v8::Local<v8::Message> message, v8::Local<v8::Value> data) { ASSERT(isMainThread()); v8::Isolate* isolate = v8::Isolate::GetCurrent(); // If called during context initialization, there will be no entered window. LocalDOMWindow* enteredWindow = enteredDOMWindow(isolate); if (!enteredWindow || !enteredWindow->isCurrentlyDisplayedInFrame()) return; int scriptId = 0; RefPtrWillBeRawPtr<ScriptCallStack> callStack = extractCallStack(isolate, message, &scriptId); String resourceName = extractResourceName(message, enteredWindow->document()); AccessControlStatus accessControlStatus = NotSharableCrossOrigin; if (message->IsOpaque()) accessControlStatus = OpaqueResource; else if (message->IsSharedCrossOrigin()) accessControlStatus = SharableCrossOrigin; ScriptState* scriptState = ScriptState::current(isolate); String errorMessage = toCoreStringWithNullCheck(message->Get()); int lineNumber = 0; int columnNumber = 0; if (v8Call(message->GetLineNumber(scriptState->context()), lineNumber) && v8Call(message->GetStartColumn(scriptState->context()), columnNumber)) ++columnNumber; RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resourceName, lineNumber, columnNumber, &scriptState->world()); String messageForConsole = extractMessageForConsole(isolate, data); if (!messageForConsole.isEmpty()) event->setUnsanitizedMessage("Uncaught " + messageForConsole); // This method might be called while we're creating a new context. In this case, we // avoid storing the exception object, as we can't create a wrapper during context creation. // FIXME: Can we even get here during initialization now that we bail out when GetEntered returns an empty handle? LocalFrame* frame = enteredWindow->document()->frame(); if (frame && frame->script().existingWindowProxy(scriptState->world())) { V8ErrorHandler::storeExceptionOnErrorEventWrapper(isolate, event.get(), data, scriptState->context()->Global()); } if (scriptState->world().isPrivateScriptIsolatedWorld()) { // We allow a private script to dispatch error events even in a EventDispatchForbiddenScope scope. // Without having this ability, it's hard to debug the private script because syntax errors // in the private script are not reported to console (the private script just crashes silently). // Allowing error events in private scripts is safe because error events don't propagate to // other isolated worlds (which means that the error events won't fire any event listeners // in user's scripts). EventDispatchForbiddenScope::AllowUserAgentEvents allowUserAgentEvents; enteredWindow->document()->reportException(event.release(), scriptId, callStack, accessControlStatus); } else { enteredWindow->document()->reportException(event.release(), scriptId, callStack, accessControlStatus); } }
static void promiseRejectHandler(v8::PromiseRejectMessage data, RejectedPromises& rejectedPromises, ScriptState* scriptState) { if (data.GetEvent() == v8::kPromiseHandlerAddedAfterReject) { rejectedPromises.handlerAdded(data); return; } ASSERT(data.GetEvent() == v8::kPromiseRejectWithNoHandler); v8::Local<v8::Promise> promise = data.GetPromise(); v8::Isolate* isolate = promise->GetIsolate(); ExecutionContext* context = scriptState->getExecutionContext(); v8::Local<v8::Value> exception = data.GetValue(); if (V8DOMWrapper::isWrapper(isolate, exception)) { // Try to get the stack & location from a wrapped exception object (e.g. // DOMException). ASSERT(exception->IsObject()); auto privateError = V8PrivateProperty::getDOMExceptionError(isolate); v8::Local<v8::Value> error = privateError.getOrUndefined( scriptState->context(), exception.As<v8::Object>()); if (!error->IsUndefined()) exception = error; } String errorMessage; AccessControlStatus corsStatus = NotSharableCrossOrigin; std::unique_ptr<SourceLocation> location; v8::Local<v8::Message> message = v8::Exception::CreateMessage(isolate, exception); if (!message.IsEmpty()) { // message->Get() can be empty here. https://crbug.com/450330 errorMessage = toCoreStringWithNullCheck(message->Get()); location = SourceLocation::fromMessage(isolate, message, context); if (message->IsSharedCrossOrigin()) corsStatus = SharableCrossOrigin; } else { location = SourceLocation::create(context->url().getString(), 0, 0, nullptr); } String messageForConsole = extractMessageForConsole(isolate, data.GetValue()); if (!messageForConsole.isEmpty()) errorMessage = "Uncaught " + messageForConsole; rejectedPromises.rejectedWithNoHandler(scriptState, data, errorMessage, std::move(location), corsStatus); }
void V8LazyEventListener::fireErrorEvent(v8::Local<v8::Context> v8Context, ExecutionContext* executionContext, v8::Local<v8::Message> message) { String messageText = toCoreStringWithNullCheck(message->Get()); int lineNumber = 0; int columnNumber = 0; if (v8Call(message->GetLineNumber(v8Context), lineNumber) && v8Call(message->GetStartColumn(v8Context), columnNumber)) ++columnNumber; RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(messageText, m_sourceURL, lineNumber, columnNumber, &world()); AccessControlStatus accessControlStatus = NotSharableCrossOrigin; if (message->IsOpaque()) accessControlStatus = OpaqueResource; else if (message->IsSharedCrossOrigin()) accessControlStatus = SharableCrossOrigin; executionContext->reportException(event.release(), 0, nullptr, accessControlStatus); }
static void promiseRejectHandlerInWorker(v8::PromiseRejectMessage data) { v8::Local<v8::Promise> promise = data.GetPromise(); // Bail out if called during context initialization. v8::Isolate* isolate = promise->GetIsolate(); ScriptState* scriptState = ScriptState::current(isolate); if (!scriptState->contextIsValid()) return; ExecutionContext* executionContext = scriptState->executionContext(); if (!executionContext) return; ASSERT(executionContext->isWorkerGlobalScope()); WorkerScriptController* scriptController = toWorkerGlobalScope(executionContext)->script(); ASSERT(scriptController); if (data.GetEvent() == v8::kPromiseHandlerAddedAfterReject) { scriptController->rejectedPromises()->handlerAdded(data); return; } ASSERT(data.GetEvent() == v8::kPromiseRejectWithNoHandler); int scriptId = 0; int lineNumber = 0; int columnNumber = 0; String resourceName; String errorMessage; v8::Local<v8::Message> message = v8::Exception::CreateMessage(data.GetValue()); if (!message.IsEmpty()) { TOSTRING_VOID(V8StringResource<>, resourceName, message->GetScriptOrigin().ResourceName()); scriptId = message->GetScriptOrigin().ScriptID()->Value(); if (v8Call(message->GetLineNumber(scriptState->context()), lineNumber) && v8Call(message->GetStartColumn(scriptState->context()), columnNumber)) ++columnNumber; // message->Get() can be empty here. https://crbug.com/450330 errorMessage = toCoreStringWithNullCheck(message->Get()); } scriptController->rejectedPromises()->rejectedWithNoHandler(scriptState, data, errorMessage, resourceName, scriptId, lineNumber, columnNumber, nullptr); }
static bool populateContextMenuItems(v8::Local<v8::Array>& itemArray, ContextMenu& menu, v8::Isolate* isolate) { for (size_t i = 0; i < itemArray->Length(); ++i) { v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(itemArray->Get(i)); v8::Local<v8::Value> type = item->Get(v8AtomicString(isolate, "type")); v8::Local<v8::Value> id = item->Get(v8AtomicString(isolate, "id")); v8::Local<v8::Value> label = item->Get(v8AtomicString(isolate, "label")); v8::Local<v8::Value> enabled = item->Get(v8AtomicString(isolate, "enabled")); v8::Local<v8::Value> checked = item->Get(v8AtomicString(isolate, "checked")); v8::Local<v8::Value> subItems = item->Get(v8AtomicString(isolate, "subItems")); if (!type->IsString()) continue; String typeString = toCoreStringWithNullCheck(type.As<v8::String>()); if (typeString == "separator") { ContextMenuItem item(ContextMenuItem(SeparatorType, ContextMenuItemCustomTagNoAction, String())); menu.appendItem(item); } else if (typeString == "subMenu" && subItems->IsArray()) { ContextMenu subMenu; v8::Local<v8::Array> subItemsArray = v8::Local<v8::Array>::Cast(subItems); if (!populateContextMenuItems(subItemsArray, subMenu, isolate)) return false; V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithNullCheck>, labelString, label, false); ContextMenuItem item(SubmenuType, ContextMenuItemCustomTagNoAction, labelString, &subMenu); menu.appendItem(item); } else { ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id->ToInt32()->Value()); V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithNullCheck>, labelString, label, false); ContextMenuItem menuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, labelString); if (checked->IsBoolean()) menuItem.setChecked(checked->ToBoolean()->Value()); if (enabled->IsBoolean()) menuItem.setEnabled(enabled->ToBoolean()->Value()); menu.appendItem(menuItem); } } return true; }
String ScriptPreprocessor::preprocessSourceCode(const String& sourceCode, const String& sourceName, v8::Handle<v8::Value> functionName) { if (!isValid()) return sourceCode; v8::HandleScope handleScope(m_isolate); v8::Context::Scope contextScope(m_context.newLocal(m_isolate)); v8::Handle<v8::String> sourceCodeString = v8String(m_isolate, sourceCode); v8::Handle<v8::String> sourceNameString = v8String(m_isolate, sourceName); v8::Handle<v8::Value> argv[] = { sourceCodeString, sourceNameString, functionName}; v8::TryCatch tryCatch; tryCatch.SetVerbose(true); TemporaryChange<bool> isPreprocessing(m_isPreprocessing, true); v8::Handle<v8::Value> resultValue = V8ScriptRunner::callAsFunction(m_preprocessorFunction.newLocal(m_isolate), m_context.newLocal(m_isolate)->Global(), WTF_ARRAY_LENGTH(argv), argv); if (!resultValue.IsEmpty() && resultValue->IsString()) return toCoreStringWithNullCheck(resultValue.As<v8::String>()); return sourceCode; }
static void messageHandlerInWorker(v8::Local<v8::Message> message, v8::Local<v8::Value> data) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); V8PerIsolateData* perIsolateData = V8PerIsolateData::from(isolate); // Exceptions that occur in error handler should be ignored since in that case // WorkerGlobalScope::reportException will send the exception to the worker object. if (perIsolateData->isReportingException()) return; perIsolateData->setReportingException(true); ScriptState* scriptState = ScriptState::current(isolate); // During the frame teardown, there may not be a valid context. if (ExecutionContext* context = scriptState->executionContext()) { String errorMessage = toCoreStringWithNullCheck(message->Get()); TOSTRING_VOID(V8StringResource<>, sourceURL, message->GetScriptOrigin().ResourceName()); int scriptId = 0; RefPtrWillBeRawPtr<ScriptCallStack> callStack = extractCallStack(isolate, message, &scriptId); int lineNumber = 0; int columnNumber = 0; if (v8Call(message->GetLineNumber(scriptState->context()), lineNumber) && v8Call(message->GetStartColumn(scriptState->context()), columnNumber)) ++columnNumber; RefPtrWillBeRawPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, sourceURL, lineNumber, columnNumber, &DOMWrapperWorld::current(isolate)); AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin; // If execution termination has been triggered as part of constructing // the error event from the v8::Message, quietly leave. if (!v8::V8::IsExecutionTerminating(isolate)) { V8ErrorHandler::storeExceptionOnErrorEventWrapper(isolate, event.get(), data, scriptState->context()->Global()); context->reportException(event.release(), scriptId, callStack, corsStatus); } } perIsolateData->setReportingException(false); }