[OnionSoup] Replace WebConsoleMessage::Level with mojom::ConsoleMessageLevel
This CL - removes the nested enum definition WebConsoleMessage::Level, uses the mojom one mojom::ConsoleMessageLevel instead everywhere. - moves blink/public/web/console_message.mojom into blink/public/mojom/devtools/, makes it be able to be used from blink/public/mojom/ in the future. BUG=789854 Change-Id: I94b2b4909b45d83b78c0e03918554813bc97767b Reviewed-on: https://chromium-review.googlesource.com/c/1420299 Commit-Queue: Leon Han <leon.han@intel.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org> Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Reviewed-by: Evan Stade <estade@chromium.org> Cr-Commit-Position: refs/heads/master@{#624488}
This commit is contained in:
chrome
common
renderer
components
autofill
content
printing
renderer
content
browser
service_worker
common
service_worker
renderer
shell
test_runner
third_party/blink
@ -4,9 +4,6 @@
|
||||
|
||||
#include "content/public/common/browser_controls_state.h"
|
||||
#include "ipc/ipc_message_macros.h"
|
||||
#include "third_party/blink/public/web/web_console_message.h"
|
||||
|
||||
IPC_ENUM_TRAITS_MAX_VALUE(blink::WebConsoleMessage::Level,
|
||||
blink::WebConsoleMessage::kLevelLast)
|
||||
IPC_ENUM_TRAITS_MAX_VALUE(content::BrowserControlsState,
|
||||
content::BROWSER_CONTROLS_STATE_LAST)
|
||||
|
@ -848,7 +848,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
|
||||
"Portable Native Client must not be disabled in about:flags.";
|
||||
}
|
||||
frame->AddMessageToConsole(WebConsoleMessage(
|
||||
WebConsoleMessage::kLevelError, error_message));
|
||||
blink::mojom::ConsoleMessageLevel::kError, error_message));
|
||||
placeholder = create_blocked_plugin(
|
||||
IDR_BLOCKED_PLUGIN_HTML,
|
||||
#if defined(OS_CHROMEOS)
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
||||
#include "third_party/blink/public/platform/web_image.h"
|
||||
#include "third_party/blink/public/platform/web_url_request.h"
|
||||
#include "third_party/blink/public/web/web_console_message.h"
|
||||
#include "third_party/blink/public/web/web_document.h"
|
||||
#include "third_party/blink/public/web/web_document_loader.h"
|
||||
#include "third_party/blink/public/web/web_element.h"
|
||||
@ -284,7 +285,7 @@ void ChromeRenderFrameObserver::GetWebApplicationInfo(
|
||||
// if the Chromium build is running on a desktop. It will get more exposition.
|
||||
if (web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE_APPLE) {
|
||||
blink::WebConsoleMessage message(
|
||||
blink::WebConsoleMessage::kLevelWarning,
|
||||
blink::mojom::ConsoleMessageLevel::kWarning,
|
||||
"<meta name=\"apple-mobile-web-app-capable\" content=\"yes\"> is "
|
||||
"deprecated. Please include <meta name=\"mobile-web-app-capable\" "
|
||||
"content=\"yes\"> - "
|
||||
|
@ -152,7 +152,7 @@ bool ResourceRequestPolicy::CanRequestResource(
|
||||
"pages outside the extension.",
|
||||
resource_url.spec().c_str());
|
||||
frame->AddMessageToConsole(
|
||||
blink::WebConsoleMessage(blink::WebConsoleMessage::kLevelError,
|
||||
blink::WebConsoleMessage(blink::mojom::ConsoleMessageLevel::kError,
|
||||
blink::WebString::FromUTF8(message)));
|
||||
return false;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ void LogDeprecationMessages(const WebFormControlElement& element) {
|
||||
std::string msg = std::string("autocomplete='") + str +
|
||||
"' is deprecated and will soon be ignored. See http://goo.gl/YjeSsW";
|
||||
WebConsoleMessage console_message = WebConsoleMessage(
|
||||
WebConsoleMessage::kLevelWarning, WebString::FromASCII(msg));
|
||||
blink::mojom::ConsoleMessageLevel::kWarning, WebString::FromASCII(msg));
|
||||
element.GetDocument().GetFrame()->AddMessageToConsole(console_message);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
namespace autofill {
|
||||
|
||||
using ConsoleLevel = blink::WebConsoleMessage::Level;
|
||||
using ConsoleLevel = blink::mojom::ConsoleMessageLevel;
|
||||
|
||||
// ConsoleLogger provides a convenient interface for logging messages to the
|
||||
// DevTools console, both in terms of wrapping and formatting console messages
|
||||
@ -22,9 +22,11 @@ using ConsoleLevel = blink::WebConsoleMessage::Level;
|
||||
// warnings are displayed first.
|
||||
class PageFormAnalyserLogger {
|
||||
public:
|
||||
static const ConsoleLevel kError = blink::WebConsoleMessage::kLevelError;
|
||||
static const ConsoleLevel kWarning = blink::WebConsoleMessage::kLevelWarning;
|
||||
static const ConsoleLevel kVerbose = blink::WebConsoleMessage::kLevelVerbose;
|
||||
static const ConsoleLevel kError = blink::mojom::ConsoleMessageLevel::kError;
|
||||
static const ConsoleLevel kWarning =
|
||||
blink::mojom::ConsoleMessageLevel::kWarning;
|
||||
static const ConsoleLevel kVerbose =
|
||||
blink::mojom::ConsoleMessageLevel::kVerbose;
|
||||
|
||||
explicit PageFormAnalyserLogger(blink::WebLocalFrame* frame);
|
||||
~PageFormAnalyserLogger();
|
||||
|
@ -2548,7 +2548,7 @@ bool PrintRenderFrameHelper::ScriptingThrottler::IsAllowed(
|
||||
blink::WebString message(
|
||||
blink::WebString::FromASCII("Ignoring too frequent calls to print()."));
|
||||
frame->AddMessageToConsole(blink::WebConsoleMessage(
|
||||
blink::WebConsoleMessage::kLevelWarning, message));
|
||||
blink::mojom::ConsoleMessageLevel::kWarning, message));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "third_party/blink/public/common/service_worker/service_worker_utils.h"
|
||||
#include "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom.h"
|
||||
#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h"
|
||||
#include "third_party/blink/public/web/web_console_message.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace content {
|
||||
@ -715,7 +714,7 @@ void EmbeddedWorkerInstance::StopIfNotAttachedToDevTools() {
|
||||
// Check ShouldNotifyWorkerStopIgnored not to show the same message
|
||||
// multiple times in DevTools.
|
||||
if (devtools_proxy_->ShouldNotifyWorkerStopIgnored()) {
|
||||
AddMessageToConsole(blink::WebConsoleMessage::kLevelVerbose,
|
||||
AddMessageToConsole(blink::mojom::ConsoleMessageLevel::kVerbose,
|
||||
kServiceWorkerTerminationCanceledMesage);
|
||||
devtools_proxy_->WorkerStopIgnoredNotified();
|
||||
}
|
||||
@ -1043,7 +1042,7 @@ void EmbeddedWorkerInstance::OnSetupFailed(
|
||||
}
|
||||
|
||||
void EmbeddedWorkerInstance::AddMessageToConsole(
|
||||
blink::WebConsoleMessage::Level level,
|
||||
blink::mojom::ConsoleMessageLevel level,
|
||||
const std::string& message) {
|
||||
if (process_id() == ChildProcessHost::kInvalidUniqueID)
|
||||
return;
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom.h"
|
||||
#include "third_party/blink/public/mojom/service_worker/service_worker.mojom.h"
|
||||
#include "third_party/blink/public/mojom/service_worker/service_worker_installed_scripts_manager.mojom.h"
|
||||
#include "third_party/blink/public/web/web_console_message.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace content {
|
||||
@ -193,7 +194,7 @@ class CONTENT_EXPORT EmbeddedWorkerInstance
|
||||
void OnWorkerVersionDoomed();
|
||||
|
||||
// Add message to the devtools console.
|
||||
void AddMessageToConsole(blink::WebConsoleMessage::Level level,
|
||||
void AddMessageToConsole(blink::mojom::ConsoleMessageLevel level,
|
||||
const std::string& message);
|
||||
|
||||
static std::string StatusToString(EmbeddedWorkerStatus status);
|
||||
|
@ -742,18 +742,18 @@ class StoreMessageInstanceClient
|
||||
base::WeakPtr<EmbeddedWorkerTestHelper> helper)
|
||||
: EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient(helper) {}
|
||||
|
||||
const std::vector<std::pair<blink::WebConsoleMessage::Level, std::string>>&
|
||||
const std::vector<std::pair<blink::mojom::ConsoleMessageLevel, std::string>>&
|
||||
message() {
|
||||
return messages_;
|
||||
}
|
||||
|
||||
private:
|
||||
void AddMessageToConsole(blink::WebConsoleMessage::Level level,
|
||||
void AddMessageToConsole(blink::mojom::ConsoleMessageLevel level,
|
||||
const std::string& message) override {
|
||||
messages_.push_back(std::make_pair(level, message));
|
||||
}
|
||||
|
||||
std::vector<std::pair<blink::WebConsoleMessage::Level, std::string>>
|
||||
std::vector<std::pair<blink::mojom::ConsoleMessageLevel, std::string>>
|
||||
messages_;
|
||||
};
|
||||
|
||||
@ -773,8 +773,8 @@ TEST_P(EmbeddedWorkerInstanceTest, AddMessageToConsole) {
|
||||
|
||||
// Attempt to start the worker and immediate AddMessageToConsole should not
|
||||
// cause a crash.
|
||||
std::pair<blink::WebConsoleMessage::Level, std::string> test_message =
|
||||
std::make_pair(blink::WebConsoleMessage::kLevelVerbose, "");
|
||||
std::pair<blink::mojom::ConsoleMessageLevel, std::string> test_message =
|
||||
std::make_pair(blink::mojom::ConsoleMessageLevel::kVerbose, "");
|
||||
base::Optional<blink::ServiceWorkerStatusCode> status;
|
||||
worker->Start(CreateStartParams(pair.second),
|
||||
ReceiveStatus(&status, base::DoNothing()));
|
||||
|
@ -144,7 +144,7 @@ void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::
|
||||
}
|
||||
|
||||
void EmbeddedWorkerTestHelper::MockEmbeddedWorkerInstanceClient::
|
||||
AddMessageToConsole(blink::WebConsoleMessage::Level level,
|
||||
AddMessageToConsole(blink::mojom::ConsoleMessageLevel level,
|
||||
const std::string& message) {
|
||||
// TODO(shimazu): Pass these arguments to the test helper when a test is
|
||||
// necessary to check them individually.
|
||||
|
@ -77,7 +77,7 @@ class EmbeddedWorkerTestHelper {
|
||||
void StartWorker(mojom::EmbeddedWorkerStartParamsPtr params) override;
|
||||
void StopWorker() override;
|
||||
void ResumeAfterDownload() override;
|
||||
void AddMessageToConsole(blink::WebConsoleMessage::Level level,
|
||||
void AddMessageToConsole(blink::mojom::ConsoleMessageLevel level,
|
||||
const std::string& message) override;
|
||||
void BindDevToolsAgent(
|
||||
blink::mojom::DevToolsAgentHostAssociatedPtrInfo,
|
||||
|
@ -564,7 +564,7 @@ void ServiceWorkerNewScriptLoader::CommitCompleted(
|
||||
// TODO(nhiroki): Consider replacing this hacky way with the new error code
|
||||
// handling mechanism in URLLoader.
|
||||
version_->embedded_worker()->AddMessageToConsole(
|
||||
blink::WebConsoleMessage::kLevelError, status_message);
|
||||
blink::mojom::ConsoleMessageLevel::kError, status_message);
|
||||
}
|
||||
version_->script_cache_map()->NotifyFinishedCaching(
|
||||
request_url_, bytes_written, error_code, status_message);
|
||||
|
@ -770,8 +770,8 @@ void ServiceWorkerVersion::ReportError(blink::ServiceWorkerStatusCode status,
|
||||
}
|
||||
|
||||
void ServiceWorkerVersion::ReportForceUpdateToDevTools() {
|
||||
embedded_worker_->AddMessageToConsole(blink::WebConsoleMessage::kLevelWarning,
|
||||
kForceUpdateInfoMessage);
|
||||
embedded_worker_->AddMessageToConsole(
|
||||
blink::mojom::ConsoleMessageLevel::kWarning, kForceUpdateInfoMessage);
|
||||
}
|
||||
|
||||
void ServiceWorkerVersion::SetStartWorkerStatusCode(
|
||||
@ -1792,8 +1792,8 @@ void ServiceWorkerVersion::OnPingTimeout() {
|
||||
running_status() == EmbeddedWorkerStatus::RUNNING);
|
||||
// TODO(falken): Change the error code to
|
||||
// blink::ServiceWorkerStatusCode::kErrorTimeout.
|
||||
embedded_worker_->AddMessageToConsole(blink::WebConsoleMessage::kLevelVerbose,
|
||||
kNotRespondingErrorMesage);
|
||||
embedded_worker_->AddMessageToConsole(
|
||||
blink::mojom::ConsoleMessageLevel::kVerbose, kNotRespondingErrorMesage);
|
||||
embedded_worker_->StopIfNotAttachedToDevTools();
|
||||
}
|
||||
|
||||
|
@ -486,7 +486,7 @@ net::Error ServiceWorkerWriteToCacheJob::NotifyFinishedCaching(
|
||||
// occurred because the worker stops soon after receiving the error
|
||||
// response.
|
||||
version_->embedded_worker()->AddMessageToConsole(
|
||||
blink::WebConsoleMessage::kLevelError,
|
||||
blink::mojom::ConsoleMessageLevel::kError,
|
||||
status_message.empty() ? kServiceWorkerFetchScriptError
|
||||
: status_message);
|
||||
} else {
|
||||
|
@ -11,6 +11,7 @@ import "mojo/public/mojom/base/string16.mojom";
|
||||
import "mojo/public/mojom/base/time.mojom";
|
||||
import "mojo/public/mojom/base/unguessable_token.mojom";
|
||||
import "services/service_manager/public/mojom/interface_provider.mojom";
|
||||
import "third_party/blink/public/mojom/devtools/console_message.mojom";
|
||||
import "third_party/blink/public/mojom/devtools/devtools_agent.mojom";
|
||||
import "third_party/blink/public/mojom/loader/url_loader_factory_bundle.mojom";
|
||||
import "third_party/blink/public/mojom/script/script_type.mojom";
|
||||
@ -22,7 +23,6 @@ import "third_party/blink/public/mojom/service_worker/service_worker_provider.mo
|
||||
import "third_party/blink/public/mojom/service_worker/service_worker_registration.mojom";
|
||||
import "third_party/blink/public/mojom/worker/worker_content_settings_proxy.mojom";
|
||||
import "third_party/blink/public/platform/web_feature.mojom";
|
||||
import "third_party/blink/public/web/console_message.mojom";
|
||||
import "url/mojom/url.mojom";
|
||||
|
||||
// Parameters to launch a service worker. This is passed from the browser to the
|
||||
|
@ -121,10 +121,13 @@ void AppCacheFrontendImpl::SetSubresourceFactory(
|
||||
static_assert(static_cast<int>(a) == static_cast<int>(b), \
|
||||
"mismatched enum: " #a)
|
||||
|
||||
STATIC_ASSERT_ENUM(WebConsoleMessage::kLevelVerbose, APPCACHE_LOG_VERBOSE);
|
||||
STATIC_ASSERT_ENUM(WebConsoleMessage::kLevelInfo, APPCACHE_LOG_INFO);
|
||||
STATIC_ASSERT_ENUM(WebConsoleMessage::kLevelWarning, APPCACHE_LOG_WARNING);
|
||||
STATIC_ASSERT_ENUM(WebConsoleMessage::kLevelError, APPCACHE_LOG_ERROR);
|
||||
STATIC_ASSERT_ENUM(blink::mojom::ConsoleMessageLevel::kVerbose,
|
||||
APPCACHE_LOG_VERBOSE);
|
||||
STATIC_ASSERT_ENUM(blink::mojom::ConsoleMessageLevel::kInfo, APPCACHE_LOG_INFO);
|
||||
STATIC_ASSERT_ENUM(blink::mojom::ConsoleMessageLevel::kWarning,
|
||||
APPCACHE_LOG_WARNING);
|
||||
STATIC_ASSERT_ENUM(blink::mojom::ConsoleMessageLevel::kError,
|
||||
APPCACHE_LOG_ERROR);
|
||||
|
||||
#undef STATIC_ASSERT_ENUM
|
||||
|
||||
|
@ -159,8 +159,9 @@ void ManifestManager::OnManifestFetchComplete(
|
||||
|
||||
for (const auto& error : manifest_debug_info_->errors) {
|
||||
blink::WebConsoleMessage message;
|
||||
message.level = error->critical ? blink::WebConsoleMessage::kLevelError
|
||||
: blink::WebConsoleMessage::kLevelWarning;
|
||||
message.level = error->critical
|
||||
? blink::mojom::ConsoleMessageLevel::kError
|
||||
: blink::mojom::ConsoleMessageLevel::kWarning;
|
||||
message.text =
|
||||
blink::WebString::FromUTF8(GetMessagePrefix() + error->message);
|
||||
message.url =
|
||||
|
@ -53,17 +53,17 @@ void GetAllContainersForModule(PluginModule* module, ContainerSet* containers) {
|
||||
}
|
||||
}
|
||||
|
||||
WebConsoleMessage::Level LogLevelToWebLogLevel(PP_LogLevel level) {
|
||||
blink::mojom::ConsoleMessageLevel LogLevelToWebLogLevel(PP_LogLevel level) {
|
||||
switch (level) {
|
||||
case PP_LOGLEVEL_TIP:
|
||||
return WebConsoleMessage::kLevelVerbose;
|
||||
return blink::mojom::ConsoleMessageLevel::kVerbose;
|
||||
case PP_LOGLEVEL_LOG:
|
||||
return WebConsoleMessage::kLevelInfo;
|
||||
return blink::mojom::ConsoleMessageLevel::kInfo;
|
||||
case PP_LOGLEVEL_WARNING:
|
||||
return WebConsoleMessage::kLevelWarning;
|
||||
return blink::mojom::ConsoleMessageLevel::kWarning;
|
||||
case PP_LOGLEVEL_ERROR:
|
||||
default:
|
||||
return WebConsoleMessage::kLevelError;
|
||||
return blink::mojom::ConsoleMessageLevel::kError;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@ void PPB_Graphics3D_Impl::OnGpuControlErrorMessage(const char* message,
|
||||
if (!frame)
|
||||
return;
|
||||
WebConsoleMessage console_message = WebConsoleMessage(
|
||||
WebConsoleMessage::kLevelError, WebString::FromUTF8(message));
|
||||
blink::mojom::ConsoleMessageLevel::kError, WebString::FromUTF8(message));
|
||||
frame->AddMessageToConsole(console_message);
|
||||
}
|
||||
|
||||
|
@ -3120,20 +3120,20 @@ double RenderFrameImpl::GetZoomLevel() {
|
||||
|
||||
void RenderFrameImpl::AddMessageToConsole(ConsoleMessageLevel level,
|
||||
const std::string& message) {
|
||||
blink::WebConsoleMessage::Level target_level =
|
||||
blink::WebConsoleMessage::kLevelInfo;
|
||||
blink::mojom::ConsoleMessageLevel target_level =
|
||||
blink::mojom::ConsoleMessageLevel::kInfo;
|
||||
switch (level) {
|
||||
case CONSOLE_MESSAGE_LEVEL_VERBOSE:
|
||||
target_level = blink::WebConsoleMessage::kLevelVerbose;
|
||||
target_level = blink::mojom::ConsoleMessageLevel::kVerbose;
|
||||
break;
|
||||
case CONSOLE_MESSAGE_LEVEL_INFO:
|
||||
target_level = blink::WebConsoleMessage::kLevelInfo;
|
||||
target_level = blink::mojom::ConsoleMessageLevel::kInfo;
|
||||
break;
|
||||
case CONSOLE_MESSAGE_LEVEL_WARNING:
|
||||
target_level = blink::WebConsoleMessage::kLevelWarning;
|
||||
target_level = blink::mojom::ConsoleMessageLevel::kWarning;
|
||||
break;
|
||||
case CONSOLE_MESSAGE_LEVEL_ERROR:
|
||||
target_level = blink::WebConsoleMessage::kLevelError;
|
||||
target_level = blink::mojom::ConsoleMessageLevel::kError;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -4185,16 +4185,16 @@ void RenderFrameImpl::DidAddMessageToConsole(
|
||||
const blink::WebString& stack_trace) {
|
||||
logging::LogSeverity log_severity = logging::LOG_VERBOSE;
|
||||
switch (message.level) {
|
||||
case blink::WebConsoleMessage::kLevelVerbose:
|
||||
case blink::mojom::ConsoleMessageLevel::kVerbose:
|
||||
log_severity = logging::LOG_VERBOSE;
|
||||
break;
|
||||
case blink::WebConsoleMessage::kLevelInfo:
|
||||
case blink::mojom::ConsoleMessageLevel::kInfo:
|
||||
log_severity = logging::LOG_INFO;
|
||||
break;
|
||||
case blink::WebConsoleMessage::kLevelWarning:
|
||||
case blink::mojom::ConsoleMessageLevel::kWarning:
|
||||
log_severity = logging::LOG_WARNING;
|
||||
break;
|
||||
case blink::WebConsoleMessage::kLevelError:
|
||||
case blink::mojom::ConsoleMessageLevel::kError:
|
||||
log_severity = logging::LOG_ERROR;
|
||||
break;
|
||||
default:
|
||||
|
@ -44,9 +44,9 @@ void RendererWebApplicationCacheHostImpl::OnLogMessage(
|
||||
return;
|
||||
// TODO(michaeln): Make app cache host per-frame and correctly report to the
|
||||
// involved frame.
|
||||
frame->ToWebLocalFrame()->AddMessageToConsole(
|
||||
WebConsoleMessage(static_cast<WebConsoleMessage::Level>(log_level),
|
||||
blink::WebString::FromUTF8(message.c_str())));
|
||||
frame->ToWebLocalFrame()->AddMessageToConsole(WebConsoleMessage(
|
||||
static_cast<blink::mojom::ConsoleMessageLevel>(log_level),
|
||||
blink::WebString::FromUTF8(message.c_str())));
|
||||
}
|
||||
|
||||
void RendererWebApplicationCacheHostImpl::OnContentBlocked(
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "third_party/blink/public/platform/web_content_settings_client.h"
|
||||
#include "third_party/blink/public/platform/web_security_origin.h"
|
||||
#include "third_party/blink/public/platform/web_url.h"
|
||||
#include "third_party/blink/public/web/web_console_message.h"
|
||||
#include "third_party/blink/public/web/web_embedded_worker.h"
|
||||
#include "third_party/blink/public/web/web_embedded_worker_start_data.h"
|
||||
|
||||
@ -100,7 +101,7 @@ void EmbeddedWorkerInstanceClientImpl::ResumeAfterDownload() {
|
||||
}
|
||||
|
||||
void EmbeddedWorkerInstanceClientImpl::AddMessageToConsole(
|
||||
blink::WebConsoleMessage::Level level,
|
||||
blink::mojom::ConsoleMessageLevel level,
|
||||
const std::string& message) {
|
||||
DCHECK(worker_);
|
||||
worker_->AddMessageToConsole(
|
||||
|
@ -79,7 +79,7 @@ class EmbeddedWorkerInstanceClientImpl
|
||||
// mojom::EmbeddedWorkerInstanceClient implementation
|
||||
void StartWorker(mojom::EmbeddedWorkerStartParamsPtr params) override;
|
||||
void ResumeAfterDownload() override;
|
||||
void AddMessageToConsole(blink::WebConsoleMessage::Level level,
|
||||
void AddMessageToConsole(blink::mojom::ConsoleMessageLevel level,
|
||||
const std::string& message) override;
|
||||
void BindDevToolsAgent(
|
||||
blink::mojom::DevToolsAgentHostAssociatedPtrInfo host,
|
||||
|
@ -503,16 +503,16 @@ void WebFrameTestClient::DidAddMessageToConsole(
|
||||
return;
|
||||
std::string level;
|
||||
switch (message.level) {
|
||||
case blink::WebConsoleMessage::kLevelVerbose:
|
||||
case blink::mojom::ConsoleMessageLevel::kVerbose:
|
||||
level = "DEBUG";
|
||||
break;
|
||||
case blink::WebConsoleMessage::kLevelInfo:
|
||||
case blink::mojom::ConsoleMessageLevel::kInfo:
|
||||
level = "MESSAGE";
|
||||
break;
|
||||
case blink::WebConsoleMessage::kLevelWarning:
|
||||
case blink::mojom::ConsoleMessageLevel::kWarning:
|
||||
level = "WARNING";
|
||||
break;
|
||||
case blink::WebConsoleMessage::kLevelError:
|
||||
case blink::mojom::ConsoleMessageLevel::kError:
|
||||
level = "ERROR";
|
||||
break;
|
||||
default:
|
||||
|
17
third_party/blink/public/BUILD.gn
vendored
17
third_party/blink/public/BUILD.gn
vendored
@ -659,7 +659,6 @@ mojom("mojo_bindings") {
|
||||
"platform/site_engagement.mojom",
|
||||
"platform/ukm.mojom",
|
||||
"web/commit_result.mojom",
|
||||
"web/console_message.mojom",
|
||||
"web/devtools_frontend.mojom",
|
||||
"web/selection_menu_behavior.mojom",
|
||||
"web/window_features.mojom",
|
||||
@ -830,19 +829,3 @@ mojom("web_client_hints_types_mojo_bindings") {
|
||||
"platform/web_client_hints_types.mojom",
|
||||
]
|
||||
}
|
||||
|
||||
# Some mojom typemaps are shared between Chromium and Blink variants and
|
||||
# therefore require some shared traits implementation. These definitions are
|
||||
# relegated to a separate target to avoid duplication between the variants.
|
||||
source_set("shared_typemap_traits") {
|
||||
visibility = [ ":*" ]
|
||||
sources = [
|
||||
"web/console_message_struct_traits.cc",
|
||||
"web/console_message_struct_traits.h",
|
||||
]
|
||||
deps = [
|
||||
":blink_headers",
|
||||
":mojo_bindings_headers",
|
||||
"//mojo/public/cpp/bindings:struct_traits",
|
||||
]
|
||||
}
|
||||
|
1
third_party/blink/public/mojom/BUILD.gn
vendored
1
third_party/blink/public/mojom/BUILD.gn
vendored
@ -28,6 +28,7 @@ mojom("mojom_platform") {
|
||||
"cookie_store/cookie_store.mojom",
|
||||
"crash/crash_memory_metrics_reporter.mojom",
|
||||
"csp/content_security_policy.mojom",
|
||||
"devtools/console_message.mojom",
|
||||
"devtools/devtools_agent.mojom",
|
||||
"dom_storage/session_storage_namespace.mojom",
|
||||
"dom_storage/storage_area.mojom",
|
||||
|
14
third_party/blink/public/mojom/devtools/console_message.mojom
vendored
Normal file
14
third_party/blink/public/mojom/devtools/console_message.mojom
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
module blink.mojom;
|
||||
|
||||
// TODO(leonhsl) We can remove blink::MessageLevel and
|
||||
// content::ConsoleMessageLevel by using this mojom enum instead.
|
||||
enum ConsoleMessageLevel {
|
||||
kVerbose,
|
||||
kInfo,
|
||||
kWarning,
|
||||
kError
|
||||
};
|
1
third_party/blink/public/public_typemaps.gni
vendored
1
third_party/blink/public/public_typemaps.gni
vendored
@ -13,5 +13,4 @@ typemaps = [
|
||||
"//third_party/blink/public/common/mediastream/media_stream.typemap",
|
||||
"//third_party/blink/public/common/notifications/notification_types.typemap",
|
||||
"//third_party/blink/public/common/screen_orientation/screen_orientation_lock_types.typemap",
|
||||
"//third_party/blink/public/web/console_message.typemap",
|
||||
]
|
||||
|
@ -1,14 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
module blink.mojom;
|
||||
|
||||
// Mojom representation of blink::WebConsoleMessage.
|
||||
// The values and the order are the same with blink::WebConsoleMessage::Level.
|
||||
enum ConsoleMessageLevel {
|
||||
Verbose,
|
||||
Info,
|
||||
Warning,
|
||||
Error
|
||||
};
|
@ -1,13 +0,0 @@
|
||||
# Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
mojom = "//third_party/blink/public/web/console_message.mojom"
|
||||
public_headers = [ "//third_party/blink/public/web/web_console_message.h" ]
|
||||
traits_headers =
|
||||
[ "//third_party/blink/public/web/console_message_struct_traits.h" ]
|
||||
deps = [
|
||||
"//third_party/blink/public:shared_typemap_traits",
|
||||
]
|
||||
type_mappings =
|
||||
[ "blink.mojom.ConsoleMessageLevel=::blink::WebConsoleMessage::Level" ]
|
@ -1,43 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "third_party/blink/public/web/console_message_struct_traits.h"
|
||||
|
||||
#include "third_party/blink/public/platform/web_string.h"
|
||||
|
||||
namespace mojo {
|
||||
|
||||
// Ensure that the WebConsoleMessage::Level enum values stay in sync with the
|
||||
// mojom::ConsoleMessageLevel.
|
||||
#define STATIC_ASSERT_ENUM(a, b) \
|
||||
static_assert(static_cast<int>(a) == static_cast<int>(b), \
|
||||
"mismatching enum : " #a)
|
||||
|
||||
STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::kLevelVerbose,
|
||||
::blink::mojom::ConsoleMessageLevel::Verbose);
|
||||
STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::kLevelInfo,
|
||||
::blink::mojom::ConsoleMessageLevel::Info);
|
||||
STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::kLevelWarning,
|
||||
::blink::mojom::ConsoleMessageLevel::Warning);
|
||||
STATIC_ASSERT_ENUM(::blink::WebConsoleMessage::Level::kLevelError,
|
||||
::blink::mojom::ConsoleMessageLevel::Error);
|
||||
|
||||
// static
|
||||
::blink::mojom::ConsoleMessageLevel
|
||||
EnumTraits<::blink::mojom::ConsoleMessageLevel,
|
||||
::blink::WebConsoleMessage::Level>::
|
||||
ToMojom(::blink::WebConsoleMessage::Level level) {
|
||||
return static_cast<::blink::mojom::ConsoleMessageLevel>(level);
|
||||
}
|
||||
|
||||
// static
|
||||
bool EnumTraits<::blink::mojom::ConsoleMessageLevel,
|
||||
::blink::WebConsoleMessage::Level>::
|
||||
FromMojom(::blink::mojom::ConsoleMessageLevel in,
|
||||
::blink::WebConsoleMessage::Level* out) {
|
||||
*out = static_cast<::blink::WebConsoleMessage::Level>(in);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace mojo
|
@ -1,25 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_CONSOLE_MESSAGE_STRUCT_TRAITS_H_
|
||||
#define THIRD_PARTY_BLINK_PUBLIC_WEB_CONSOLE_MESSAGE_STRUCT_TRAITS_H_
|
||||
|
||||
#include "mojo/public/cpp/bindings/enum_traits.h"
|
||||
#include "third_party/blink/public/web/console_message.mojom-shared.h"
|
||||
#include "third_party/blink/public/web/web_console_message.h"
|
||||
|
||||
namespace mojo {
|
||||
|
||||
template <>
|
||||
struct EnumTraits<::blink::mojom::ConsoleMessageLevel,
|
||||
::blink::WebConsoleMessage::Level> {
|
||||
static ::blink::mojom::ConsoleMessageLevel ToMojom(
|
||||
::blink::WebConsoleMessage::Level);
|
||||
static bool FromMojom(::blink::mojom::ConsoleMessageLevel,
|
||||
::blink::WebConsoleMessage::Level* out);
|
||||
};
|
||||
|
||||
} // namespace mojo
|
||||
|
||||
#endif
|
@ -31,39 +31,28 @@
|
||||
#ifndef THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_CONSOLE_MESSAGE_H_
|
||||
#define THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_CONSOLE_MESSAGE_H_
|
||||
|
||||
#include "third_party/blink/public/mojom/devtools/console_message.mojom-shared.h"
|
||||
#include "third_party/blink/public/platform/web_string.h"
|
||||
#include "third_party/blink/public/web/web_node.h"
|
||||
|
||||
namespace blink {
|
||||
|
||||
struct WebConsoleMessage {
|
||||
enum Level {
|
||||
kLevelVerbose,
|
||||
kLevelInfo,
|
||||
kLevelWarning,
|
||||
kLevelError,
|
||||
kLevelLast = kLevelError
|
||||
};
|
||||
|
||||
Level level;
|
||||
mojom::ConsoleMessageLevel level = mojom::ConsoleMessageLevel::kInfo;
|
||||
WebString text;
|
||||
WebVector<blink::WebNode> nodes;
|
||||
WebString url;
|
||||
unsigned line_number;
|
||||
unsigned column_number;
|
||||
unsigned line_number = 0;
|
||||
unsigned column_number = 0;
|
||||
|
||||
WebConsoleMessage() : level(kLevelInfo), line_number(0), column_number(0) {}
|
||||
WebConsoleMessage(Level level,
|
||||
WebConsoleMessage() = default;
|
||||
WebConsoleMessage(mojom::ConsoleMessageLevel level,
|
||||
const WebString& text,
|
||||
const WebVector<blink::WebNode>& nodes)
|
||||
: level(level),
|
||||
text(text),
|
||||
nodes(nodes),
|
||||
line_number(0),
|
||||
column_number(0) {}
|
||||
WebConsoleMessage(Level level, const WebString& text)
|
||||
: level(level), text(text), nodes(nodes) {}
|
||||
WebConsoleMessage(mojom::ConsoleMessageLevel level, const WebString& text)
|
||||
: WebConsoleMessage(level, text, WebVector<blink::WebNode>()) {}
|
||||
WebConsoleMessage(Level level,
|
||||
WebConsoleMessage(mojom::ConsoleMessageLevel level,
|
||||
const WebString& text,
|
||||
const WebString url,
|
||||
unsigned line_number,
|
||||
|
@ -737,16 +737,16 @@ void WebLocalFrameImpl::AddMessageToConsole(const WebConsoleMessage& message) {
|
||||
|
||||
MessageLevel web_core_message_level = kInfoMessageLevel;
|
||||
switch (message.level) {
|
||||
case WebConsoleMessage::kLevelVerbose:
|
||||
case mojom::ConsoleMessageLevel::kVerbose:
|
||||
web_core_message_level = kVerboseMessageLevel;
|
||||
break;
|
||||
case WebConsoleMessage::kLevelInfo:
|
||||
case mojom::ConsoleMessageLevel::kInfo:
|
||||
web_core_message_level = kInfoMessageLevel;
|
||||
break;
|
||||
case WebConsoleMessage::kLevelWarning:
|
||||
case mojom::ConsoleMessageLevel::kWarning:
|
||||
web_core_message_level = kWarningMessageLevel;
|
||||
break;
|
||||
case WebConsoleMessage::kLevelError:
|
||||
case mojom::ConsoleMessageLevel::kError:
|
||||
web_core_message_level = kErrorMessageLevel;
|
||||
break;
|
||||
}
|
||||
@ -2141,7 +2141,7 @@ void WebLocalFrameImpl::RenderFallbackContent() const {
|
||||
void WebLocalFrameImpl::ReportContentSecurityPolicyViolation(
|
||||
const blink::WebContentSecurityPolicyViolation& violation) {
|
||||
AddMessageToConsole(blink::WebConsoleMessage(
|
||||
WebConsoleMessage::kLevelError, violation.console_message,
|
||||
mojom::ConsoleMessageLevel::kError, violation.console_message,
|
||||
violation.source_location.url, violation.source_location.line_number,
|
||||
violation.source_location.column_number));
|
||||
|
||||
|
@ -122,9 +122,9 @@ void ConsoleMessage::Trace(blink::Visitor* visitor) {
|
||||
visitor->Trace(frame_);
|
||||
}
|
||||
|
||||
STATIC_ASSERT_ENUM(WebConsoleMessage::kLevelVerbose, kVerboseMessageLevel);
|
||||
STATIC_ASSERT_ENUM(WebConsoleMessage::kLevelInfo, kInfoMessageLevel);
|
||||
STATIC_ASSERT_ENUM(WebConsoleMessage::kLevelWarning, kWarningMessageLevel);
|
||||
STATIC_ASSERT_ENUM(WebConsoleMessage::kLevelError, kErrorMessageLevel);
|
||||
STATIC_ASSERT_ENUM(mojom::ConsoleMessageLevel::kVerbose, kVerboseMessageLevel);
|
||||
STATIC_ASSERT_ENUM(mojom::ConsoleMessageLevel::kInfo, kInfoMessageLevel);
|
||||
STATIC_ASSERT_ENUM(mojom::ConsoleMessageLevel::kWarning, kWarningMessageLevel);
|
||||
STATIC_ASSERT_ENUM(mojom::ConsoleMessageLevel::kError, kErrorMessageLevel);
|
||||
|
||||
} // namespace blink
|
||||
|
@ -326,7 +326,7 @@ void ChromeClientImpl::AddMessageToConsole(LocalFrame* local_frame,
|
||||
WebLocalFrameImpl* frame = WebLocalFrameImpl::FromFrame(local_frame);
|
||||
if (frame && frame->Client()) {
|
||||
frame->Client()->DidAddMessageToConsole(
|
||||
WebConsoleMessage(static_cast<WebConsoleMessage::Level>(level),
|
||||
WebConsoleMessage(static_cast<mojom::ConsoleMessageLevel>(level),
|
||||
message),
|
||||
source_id, line_number, stack_trace);
|
||||
}
|
||||
@ -860,8 +860,8 @@ bool ChromeClientImpl::ShouldOpenUIElementDuringPageDismissal(
|
||||
builder.Append(DismissalTypeToString(dismissal_type));
|
||||
builder.Append(".");
|
||||
|
||||
WebLocalFrameImpl::FromFrame(frame)->AddMessageToConsole(
|
||||
WebConsoleMessage(WebConsoleMessage::kLevelError, builder.ToString()));
|
||||
WebLocalFrameImpl::FromFrame(frame)->AddMessageToConsole(WebConsoleMessage(
|
||||
mojom::ConsoleMessageLevel::kError, builder.ToString()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -3077,7 +3077,7 @@ TEST_F(ViewportTest, viewportWarnings2) {
|
||||
PageScaleConstraints constraints = RunViewportTest(page, 320, 352);
|
||||
|
||||
EXPECT_EQ(1U, web_frame_client.messages.size());
|
||||
EXPECT_EQ(WebConsoleMessage::kLevelWarning,
|
||||
EXPECT_EQ(mojom::ConsoleMessageLevel::kWarning,
|
||||
web_frame_client.messages[0].level);
|
||||
EXPECT_STREQ("The key \"wwidth\" is not recognized and ignored.",
|
||||
web_frame_client.messages[0].text.Utf8().c_str());
|
||||
@ -3104,7 +3104,7 @@ TEST_F(ViewportTest, viewportWarnings3) {
|
||||
PageScaleConstraints constraints = RunViewportTest(page, 320, 352);
|
||||
|
||||
EXPECT_EQ(1U, web_frame_client.messages.size());
|
||||
EXPECT_EQ(WebConsoleMessage::kLevelWarning,
|
||||
EXPECT_EQ(mojom::ConsoleMessageLevel::kWarning,
|
||||
web_frame_client.messages[0].level);
|
||||
EXPECT_STREQ(
|
||||
"The value \"unrecognized-width\" for key \"width\" is invalid, and has "
|
||||
@ -3133,7 +3133,7 @@ TEST_F(ViewportTest, viewportWarnings4) {
|
||||
PageScaleConstraints constraints = RunViewportTest(page, 320, 352);
|
||||
|
||||
EXPECT_EQ(1U, web_frame_client.messages.size());
|
||||
EXPECT_EQ(WebConsoleMessage::kLevelWarning,
|
||||
EXPECT_EQ(mojom::ConsoleMessageLevel::kWarning,
|
||||
web_frame_client.messages[0].level);
|
||||
EXPECT_STREQ(
|
||||
"The value \"123x456\" for key \"width\" was truncated to its numeric "
|
||||
@ -3163,7 +3163,7 @@ TEST_F(ViewportTest, viewportWarnings5) {
|
||||
|
||||
EXPECT_EQ(1U, web_frame_client.messages.size());
|
||||
|
||||
EXPECT_EQ(WebConsoleMessage::kLevelWarning,
|
||||
EXPECT_EQ(mojom::ConsoleMessageLevel::kWarning,
|
||||
web_frame_client.messages[0].level);
|
||||
EXPECT_STREQ(
|
||||
"Error parsing a meta element's content: ';' is not a valid key-value "
|
||||
@ -3192,7 +3192,7 @@ TEST_F(ViewportTest, viewportWarnings6) {
|
||||
PageScaleConstraints constraints = RunViewportTest(page, 320, 352);
|
||||
|
||||
EXPECT_EQ(1U, web_frame_client.messages.size());
|
||||
EXPECT_EQ(WebConsoleMessage::kLevelWarning,
|
||||
EXPECT_EQ(mojom::ConsoleMessageLevel::kWarning,
|
||||
web_frame_client.messages[0].level);
|
||||
EXPECT_STREQ(
|
||||
"The value \"\" for key \"width\" is invalid, and has been ignored.",
|
||||
|
@ -251,16 +251,16 @@ void WebEmbeddedWorkerImpl::AddMessageToConsole(
|
||||
const WebConsoleMessage& message) {
|
||||
MessageLevel web_core_message_level;
|
||||
switch (message.level) {
|
||||
case WebConsoleMessage::kLevelVerbose:
|
||||
case mojom::ConsoleMessageLevel::kVerbose:
|
||||
web_core_message_level = kVerboseMessageLevel;
|
||||
break;
|
||||
case WebConsoleMessage::kLevelInfo:
|
||||
case mojom::ConsoleMessageLevel::kInfo:
|
||||
web_core_message_level = kInfoMessageLevel;
|
||||
break;
|
||||
case WebConsoleMessage::kLevelWarning:
|
||||
case mojom::ConsoleMessageLevel::kWarning:
|
||||
web_core_message_level = kWarningMessageLevel;
|
||||
break;
|
||||
case WebConsoleMessage::kLevelError:
|
||||
case mojom::ConsoleMessageLevel::kError:
|
||||
web_core_message_level = kErrorMessageLevel;
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user