| Index: Source/core/dom/Document.cpp
|
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
|
| index a9db629ba87a096cbe51212a2f4bd80f661800cd..8ea797a2520330ac7ee72048ed93fc142160af18 100644
|
| --- a/Source/core/dom/Document.cpp
|
| +++ b/Source/core/dom/Document.cpp
|
| @@ -2612,7 +2612,7 @@ bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, bool& didAllowNavigatio
|
| return true;
|
|
|
| if (didAllowNavigation) {
|
| - addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt to show multiple 'beforeunload' confirmation panels for a single navigation.");
|
| + addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, "Blocked attempt to show multiple 'beforeunload' confirmation panels for a single navigation."));
|
| return true;
|
| }
|
|
|
| @@ -2731,7 +2731,7 @@ void Document::write(const SegmentedString& text, Document* ownerDocument, Excep
|
| bool hasInsertionPoint = m_parser && m_parser->hasInsertionPoint();
|
|
|
| if (!hasInsertionPoint && m_ignoreDestructiveWriteCount) {
|
| - addConsoleMessage(JSMessageSource, WarningMessageLevel, ExceptionMessages::failedToExecute("write", "Document", "It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened."));
|
| + addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, ExceptionMessages::failedToExecute("write", "Document", "It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.")));
|
| return;
|
| }
|
|
|
| @@ -2778,9 +2778,9 @@ EventTarget* Document::errorEventTarget()
|
| return domWindow();
|
| }
|
|
|
| -void Document::logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack)
|
| +void Document::logExceptionToConsole(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleError)
|
| {
|
| - internalAddMessage(JSMessageSource, ErrorMessageLevel, errorMessage, sourceURL, lineNumber, callStack, 0);
|
| + internalAddMessage(consoleError);
|
| }
|
|
|
| void Document::setURL(const KURL& url)
|
| @@ -3072,13 +3072,13 @@ void Document::maybeHandleHttpRefresh(const String& content, HttpRefreshType htt
|
|
|
| if (protocolIsJavaScript(refreshURL)) {
|
| String message = "Refused to refresh " + m_url.elidedString() + " to a javascript: URL";
|
| - addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
|
| + addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, message));
|
| return;
|
| }
|
|
|
| if (httpRefreshType == HttpRefreshFromMetaTag && isSandboxed(SandboxAutomaticFeatures)) {
|
| String message = "Refused to execute the redirect specified via '<meta http-equiv='refresh' content='...'>'. The document is sandboxed, and the 'allow-scripts' keyword is not set.";
|
| - addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
|
| + addConsoleMessage(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, message));
|
| return;
|
| }
|
| m_frame->navigationScheduler().scheduleRedirect(delay, refreshURL);
|
| @@ -3109,7 +3109,7 @@ void Document::processHttpEquivXFrameOptions(const AtomicString& content)
|
| // intent, we must navigate away from the possibly partially-rendered document to a location that
|
| // doesn't inherit the parent's SecurityOrigin.
|
| frame->navigationScheduler().scheduleLocationChange(this, SecurityOrigin::urlWithUniqueSecurityOrigin(), Referrer());
|
| - addConsoleMessageWithRequestIdentifier(SecurityMessageSource, ErrorMessageLevel, message, requestIdentifier);
|
| + addConsoleMessageWithRequestIdentifier(ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, message, requestIdentifier));
|
| }
|
| }
|
|
|
| @@ -3170,7 +3170,7 @@ void Document::processReferrerPolicy(const String& policy)
|
| } else if (equalIgnoringCase(policy, "default")) {
|
| setReferrerPolicy(ReferrerPolicyDefault);
|
| } else {
|
| - addConsoleMessage(RenderingMessageSource, ErrorMessageLevel, "Failed to set referrer policy: The value '" + policy + "' is not one of 'always', 'default', 'never', or 'origin'. Defaulting to 'never'.");
|
| + addConsoleMessage(ConsoleMessage::create(RenderingMessageSource, ErrorMessageLevel, "Failed to set referrer policy: The value '" + policy + "' is not one of 'always', 'default', 'never', or 'origin'. Defaulting to 'never'."));
|
| setReferrerPolicy(ReferrerPolicyNever);
|
| }
|
| }
|
| @@ -4326,7 +4326,7 @@ bool Document::execCommand(const String& commandName, bool userInterface, const
|
| static bool inExecCommand = false;
|
| if (inExecCommand) {
|
| String message = "We don't execute document.execCommand() this time, because it is called recursively.";
|
| - addConsoleMessage(JSMessageSource, WarningMessageLevel, message);
|
| + addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message));
|
| return false;
|
| }
|
| TemporaryChange<bool> executeScope(inExecCommand, true);
|
| @@ -4999,42 +4999,41 @@ void Document::reportBlockedScriptExecutionToInspector(const String& directiveTe
|
| InspectorInstrumentation::scriptExecutionBlockedByCSP(this, directiveText);
|
| }
|
|
|
| -void Document::addMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber, ScriptState* scriptState)
|
| +void Document::addMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleError)
|
| {
|
| - internalAddMessage(source, level, message, sourceURL, lineNumber, nullptr, scriptState);
|
| + internalAddMessage(consoleError);
|
| }
|
|
|
| -void Document::internalAddMessage(MessageSource source, MessageLevel level, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack, ScriptState* scriptState)
|
| +void Document::internalAddMessage(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleError)
|
| {
|
| if (!isContextThread()) {
|
| - m_taskRunner->postTask(AddConsoleMessageTask::create(source, level, message));
|
| + m_taskRunner->postTask(AddConsoleMessageTask::create(consoleError->source(), consoleError->level(), consoleError->message()));
|
| return;
|
| }
|
|
|
| if (!m_frame)
|
| return;
|
|
|
| - String messageURL = sourceURL;
|
| - if (!scriptState && sourceURL.isNull() && !lineNumber) {
|
| - messageURL = url().string();
|
| + if (!consoleError->scriptState() && consoleError->url().isNull() && !consoleError->lineNumber()) {
|
| + consoleError->setURL(url().string());
|
| if (parsing() && !isInDocumentWrite() && scriptableDocumentParser()) {
|
| ScriptableDocumentParser* parser = scriptableDocumentParser();
|
| if (!parser->isWaitingForScripts() && !parser->isExecutingScript())
|
| - lineNumber = parser->lineNumber().oneBasedInt();
|
| + consoleError->setLineNumber(parser->lineNumber().oneBasedInt());
|
| }
|
| }
|
| - m_frame->console().addMessage(source, level, message, messageURL, lineNumber, 0, callStack, scriptState, 0);
|
| + m_frame->console().addMessage(consoleError);
|
| }
|
|
|
| -void Document::addConsoleMessageWithRequestIdentifier(MessageSource source, MessageLevel level, const String& message, unsigned long requestIdentifier)
|
| +void Document::addConsoleMessageWithRequestIdentifier(PassRefPtrWillBeRawPtr<ConsoleMessage> consoleError)
|
| {
|
| if (!isContextThread()) {
|
| - m_taskRunner->postTask(AddConsoleMessageTask::create(source, level, message));
|
| + m_taskRunner->postTask(AddConsoleMessageTask::create(consoleError->source(), consoleError->level(), consoleError->message()));
|
| return;
|
| }
|
|
|
| if (m_frame)
|
| - m_frame->console().addMessage(source, level, message, String(), 0, 0, nullptr, 0, requestIdentifier);
|
| + m_frame->console().addMessage(consoleError);
|
| }
|
|
|
| // FIXME(crbug.com/305497): This should be removed after ExecutionContext-LocalDOMWindow migration.
|
|
|