Remove dependency on the DevTools agent for console logs.
With the upcoming change of having web security related checks made in the browser process there's the need of sending messages to the affected frame console. The current implementation depended on the devtools agent being set for the renderer; when that was not true logs would be dropped silently. This was the case when running layout tests. This change removes that dependency so that log requests coming from the browser process during layout tests are executed. BUG=576270 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:linux_site_isolation TBR=nasko@chromium.org Review URL: https://codereview.chromium.org/1890513004 Cr-Commit-Position: refs/heads/master@{#389441}
This commit is contained in:
content
third_party/WebKit/Source/web
@ -669,7 +669,7 @@ IPC_MESSAGE_ROUTED0(FrameMsg_DidStopLoading)
|
||||
IPC_MESSAGE_ROUTED1(FrameMsg_CSSInsertRequest,
|
||||
std::string /* css */)
|
||||
|
||||
// Add message to the devtools console.
|
||||
// Add message to the frame console.
|
||||
IPC_MESSAGE_ROUTED2(FrameMsg_AddMessageToConsole,
|
||||
content::ConsoleMessageLevel /* level */,
|
||||
std::string /* message */)
|
||||
|
@ -21,11 +21,9 @@
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "third_party/WebKit/public/platform/WebPoint.h"
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/web/WebConsoleMessage.h"
|
||||
#include "third_party/WebKit/public/web/WebDevToolsAgent.h"
|
||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
|
||||
using blink::WebConsoleMessage;
|
||||
using blink::WebDevToolsAgent;
|
||||
using blink::WebDevToolsAgentClient;
|
||||
using blink::WebLocalFrame;
|
||||
@ -245,29 +243,6 @@ void DevToolsAgent::OnRequestNewWindowACK(bool success) {
|
||||
GetWebAgent()->failedToRequestDevTools();
|
||||
}
|
||||
|
||||
void DevToolsAgent::AddMessageToConsole(ConsoleMessageLevel level,
|
||||
const std::string& message) {
|
||||
WebLocalFrame* web_frame = frame_->GetWebFrame();
|
||||
|
||||
WebConsoleMessage::Level target_level = WebConsoleMessage::LevelLog;
|
||||
switch (level) {
|
||||
case CONSOLE_MESSAGE_LEVEL_DEBUG:
|
||||
target_level = WebConsoleMessage::LevelDebug;
|
||||
break;
|
||||
case CONSOLE_MESSAGE_LEVEL_LOG:
|
||||
target_level = WebConsoleMessage::LevelLog;
|
||||
break;
|
||||
case CONSOLE_MESSAGE_LEVEL_WARNING:
|
||||
target_level = WebConsoleMessage::LevelWarning;
|
||||
break;
|
||||
case CONSOLE_MESSAGE_LEVEL_ERROR:
|
||||
target_level = WebConsoleMessage::LevelError;
|
||||
break;
|
||||
}
|
||||
web_frame->addMessageToConsole(
|
||||
WebConsoleMessage(target_level, WebString::fromUTF8(message)));
|
||||
}
|
||||
|
||||
void DevToolsAgent::ContinueProgram() {
|
||||
GetWebAgent()->continueProgram();
|
||||
}
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "base/callback.h"
|
||||
#include "base/macros.h"
|
||||
#include "content/common/content_export.h"
|
||||
#include "content/public/common/console_message_level.h"
|
||||
#include "content/public/renderer/render_frame_observer.h"
|
||||
#include "third_party/WebKit/public/web/WebDevToolsAgentClient.h"
|
||||
|
||||
@ -48,9 +47,6 @@ class CONTENT_EXPORT DevToolsAgent
|
||||
|
||||
bool IsAttached();
|
||||
|
||||
void AddMessageToConsole(ConsoleMessageLevel level,
|
||||
const std::string& message);
|
||||
|
||||
private:
|
||||
friend class DevToolsAgentTest;
|
||||
|
||||
|
@ -161,6 +161,7 @@
|
||||
#include "third_party/WebKit/public/platform/WebURLResponse.h"
|
||||
#include "third_party/WebKit/public/platform/WebVector.h"
|
||||
#include "third_party/WebKit/public/web/WebColorSuggestion.h"
|
||||
#include "third_party/WebKit/public/web/WebConsoleMessage.h"
|
||||
#include "third_party/WebKit/public/web/WebDocument.h"
|
||||
#include "third_party/WebKit/public/web/WebFindOptions.h"
|
||||
#include "third_party/WebKit/public/web/WebFrameSerializer.h"
|
||||
@ -2359,8 +2360,25 @@ void RenderFrameImpl::EnsureMojoBuiltinsAreAvailable(
|
||||
|
||||
void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level,
|
||||
const std::string& message) {
|
||||
if (devtools_agent_)
|
||||
devtools_agent_->AddMessageToConsole(level, message);
|
||||
blink::WebConsoleMessage::Level target_level =
|
||||
blink::WebConsoleMessage::LevelLog;
|
||||
switch (level) {
|
||||
case CONSOLE_MESSAGE_LEVEL_DEBUG:
|
||||
target_level = blink::WebConsoleMessage::LevelDebug;
|
||||
break;
|
||||
case CONSOLE_MESSAGE_LEVEL_LOG:
|
||||
target_level = blink::WebConsoleMessage::LevelLog;
|
||||
break;
|
||||
case CONSOLE_MESSAGE_LEVEL_WARNING:
|
||||
target_level = blink::WebConsoleMessage::LevelWarning;
|
||||
break;
|
||||
case CONSOLE_MESSAGE_LEVEL_ERROR:
|
||||
target_level = blink::WebConsoleMessage::LevelError;
|
||||
break;
|
||||
}
|
||||
|
||||
blink::WebConsoleMessage wcm(target_level, WebString::fromUTF8(message));
|
||||
frame_->addMessageToConsole(wcm);
|
||||
}
|
||||
|
||||
bool RenderFrameImpl::IsUsingLoFi() const {
|
||||
|
@ -746,7 +746,7 @@ void WebLocalFrameImpl::addMessageToConsole(const WebConsoleMessage& message)
|
||||
{
|
||||
DCHECK(frame());
|
||||
|
||||
MessageLevel webCoreMessageLevel;
|
||||
MessageLevel webCoreMessageLevel = LogMessageLevel;
|
||||
switch (message.level) {
|
||||
case WebConsoleMessage::LevelDebug:
|
||||
webCoreMessageLevel = DebugMessageLevel;
|
||||
@ -760,9 +760,10 @@ void WebLocalFrameImpl::addMessageToConsole(const WebConsoleMessage& message)
|
||||
case WebConsoleMessage::LevelError:
|
||||
webCoreMessageLevel = ErrorMessageLevel;
|
||||
break;
|
||||
default:
|
||||
NOTREACHED();
|
||||
return;
|
||||
// Unsupported values.
|
||||
case WebConsoleMessage::LevelInfo:
|
||||
case WebConsoleMessage::LevelRevokedError:
|
||||
break;
|
||||
}
|
||||
|
||||
frame()->document()->addConsoleMessage(ConsoleMessage::create(OtherMessageSource, webCoreMessageLevel, message.text, message.url, message.lineNumber, message.columnNumber));
|
||||
|
Reference in New Issue
Block a user