Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(668)

Unified Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp

Issue 2319563003: ServiceWorker: Shows a warning when adding event handlers asynchronously (Closed)
Patch Set: Fixed indent Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
index d1172c5530a44876553805bf315ae4cd7ec7cedc..0fff6cb0f95eb9df1fac85abdeea42af6c5cbdd0 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerGlobalScope.cpp
@@ -160,13 +160,8 @@ void ServiceWorkerGlobalScope::setRegistration(std::unique_ptr<WebServiceWorkerR
bool ServiceWorkerGlobalScope::addEventListenerInternal(const AtomicString& eventType, EventListener* listener, const AddEventListenerOptionsResolved& options)
{
if (m_didEvaluateScript) {
- if (eventType == EventTypeNames::install) {
- ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "Event handler of 'install' event must be added on the initial evaluation of worker script.");
- addConsoleMessage(consoleMessage);
- } else if (eventType == EventTypeNames::activate) {
- ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "Event handler of 'activate' event must be added on the initial evaluation of worker script.");
- addConsoleMessage(consoleMessage);
- }
+ String message = String::format("Event handler of '%s' event must be added on the initial evaluation of worker script.", eventType.ascii().data());
falken 2016/09/20 01:46:41 Maybe I'm paranoid but I'd just utf8() instead of
shimazu 2016/09/20 06:07:52 Done.
+ addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message));
}
return WorkerGlobalScope::addEventListenerInternal(eventType, listener, options);
}

Powered by Google App Engine
This is Rietveld 408576698