void revoke() { ExecutionContext* executionContext = m_scriptState->getExecutionContext(); if (!executionContext) return; ScriptState::Scope scope(m_scriptState); v8::Local<v8::Value> value = m_promise.newLocal(m_scriptState->isolate()); v8::Local<v8::Value> reason = m_exception.newLocal(m_scriptState->isolate()); // Either collected or https://crbug.com/450330 if (value.IsEmpty() || !value->IsPromise()) return; EventTarget* target = executionContext->errorEventTarget(); if (RuntimeEnabledFeatures::promiseRejectionEventEnabled() && target && !executionContext->shouldSanitizeScriptError(m_resourceName, m_corsStatus)) { PromiseRejectionEventInit init; init.setPromise(ScriptPromise(m_scriptState, value)); init.setReason(ScriptValue(m_scriptState, reason)); RawPtr<PromiseRejectionEvent> event = PromiseRejectionEvent::create(m_scriptState, EventTypeNames::rejectionhandled, init); target->dispatchEvent(event); } if (m_shouldLogToConsole) { RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessageSource, RevokedErrorMessageLevel, "Handler added to rejected promise"); consoleMessage->setRelatedMessageId(m_consoleMessageId); executionContext->addConsoleMessage(consoleMessage.release()); } }