Index: Source/modules/serviceworkers/WaitUntilObserver.cpp |
diff --git a/Source/modules/serviceworkers/WaitUntilObserver.cpp b/Source/modules/serviceworkers/WaitUntilObserver.cpp |
index 5cbd6c40cdd334c206f18a13cfab9940dc88be46..55a289762c41b04b169f44c82d53ba69c9955492 100644 |
--- a/Source/modules/serviceworkers/WaitUntilObserver.cpp |
+++ b/Source/modules/serviceworkers/WaitUntilObserver.cpp |
@@ -92,13 +92,11 @@ void WaitUntilObserver::waitUntil(ScriptState* scriptState, const ScriptValue& v |
return; |
// When handling a notificationclick event, we want to allow one window to |
- // be focused or opened. Regardless of whether such action happened, |
- // |consumeWindowInteraction| will be called when all the pending activities |
- // will be resolved or after a |
- if (m_type == NotificationClick) { |
- executionContext()->allowWindowInteraction(); |
- m_consumeWindowInteractionTimer.startOneShot(ServiceWorkerGlobalScope::kWindowInteractionTimeout, FROM_HERE); |
- } |
+ // 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( |
@@ -113,7 +111,6 @@ WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, EventType type, |
, m_pendingActivity(0) |
, m_hasError(false) |
, m_eventDispatched(false) |
- , m_consumeWindowInteractionTimer(this, &WaitUntilObserver::consumeWindowInteraction) |
{ |
} |
@@ -147,21 +144,13 @@ void WaitUntilObserver::decrementPendingActivity() |
break; |
case NotificationClick: |
client->didHandleNotificationClickEvent(m_eventID, result); |
- m_consumeWindowInteractionTimer.stop(); |
- consumeWindowInteraction(nullptr); |
+ executionContext()->consumeWindowFocus(); |
break; |
case Push: |
client->didHandlePushEvent(m_eventID, result); |
break; |
} |
- setContext(nullptr); |
-} |
- |
-void WaitUntilObserver::consumeWindowInteraction(Timer<WaitUntilObserver>*) |
-{ |
- if (!executionContext()) |
- return; |
- executionContext()->consumeWindowInteraction(); |
+ observeContext(0); |
} |
void WaitUntilObserver::trace(Visitor* visitor) |