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

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

Issue 2319563003: ServiceWorker: Shows a warning when adding event handlers asynchronously (Closed)
Patch Set: Rebased and updated the expectation 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..18690e7bd0d36c1e2729872479c2a0df7c2b9a6d 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.utf8().data());
+ addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message));
}
return WorkerGlobalScope::addEventListenerInternal(eventType, listener, options);
}
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/service-workers/resources/service-worker-lazy-addeventlistener.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698