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

Unified Diff: Source/modules/serviceworkers/WaitUntilObserver.cpp

Issue 777483004: Bind Window focus ability to the ExecutionContext instead of the process. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sw_client_focus
Patch Set: rebase Created 6 years 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: Source/modules/serviceworkers/WaitUntilObserver.cpp
diff --git a/Source/modules/serviceworkers/WaitUntilObserver.cpp b/Source/modules/serviceworkers/WaitUntilObserver.cpp
index 28359e332684f192ecfa75cd111a5db9cf2b7cb6..d03bf9e79f1622e55a09b74f975d34460a5ceeea 100644
--- a/Source/modules/serviceworkers/WaitUntilObserver.cpp
+++ b/Source/modules/serviceworkers/WaitUntilObserver.cpp
@@ -88,6 +88,16 @@ void WaitUntilObserver::waitUntil(ScriptState* scriptState, const ScriptValue& v
return;
}
+ if (!executionContext())
+ return;
+
+ // When handling a notificationclick event, we want to allow one window to
+ // be focused. Regardless of whether one window was focused,
+ // |consumeWindowFocus| will be called when all the pending activities will
+ // be resolved.
+ if (m_type == NotificationClick)
+ executionContext()->allowWindowFocus();
+
incrementPendingActivity();
ScriptPromise::cast(scriptState, value).then(
ThenFunction::createFunction(scriptState, this, ThenFunction::Fulfilled),
@@ -134,6 +144,7 @@ void WaitUntilObserver::decrementPendingActivity()
break;
case NotificationClick:
client->didHandleNotificationClickEvent(m_eventID, result);
+ executionContext()->consumeWindowFocus();
break;
case Push:
client->didHandlePushEvent(m_eventID, result);
« no previous file with comments | « Source/modules/serviceworkers/ServiceWorkerClient.cpp ('k') | Source/web/WebScopedWindowFocusAllowedIndicator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698