| Index: Source/modules/serviceworkers/WaitUntilObserver.cpp
|
| diff --git a/Source/modules/serviceworkers/WaitUntilObserver.cpp b/Source/modules/serviceworkers/WaitUntilObserver.cpp
|
| index 55a289762c41b04b169f44c82d53ba69c9955492..bf4ed4e459ed914644c38adc2f24df6041e8e076 100644
|
| --- a/Source/modules/serviceworkers/WaitUntilObserver.cpp
|
| +++ b/Source/modules/serviceworkers/WaitUntilObserver.cpp
|
| @@ -92,11 +92,13 @@ void WaitUntilObserver::waitUntil(ScriptState* scriptState, const ScriptValue& v
|
| 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();
|
| + // 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);
|
| + }
|
|
|
| incrementPendingActivity();
|
| ScriptPromise::cast(scriptState, value).then(
|
| @@ -111,6 +113,7 @@ WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, EventType type,
|
| , m_pendingActivity(0)
|
| , m_hasError(false)
|
| , m_eventDispatched(false)
|
| + , m_consumeWindowInteractionTimer(this, &WaitUntilObserver::consumeWindowInteraction)
|
| {
|
| }
|
|
|
| @@ -144,7 +147,8 @@ void WaitUntilObserver::decrementPendingActivity()
|
| break;
|
| case NotificationClick:
|
| client->didHandleNotificationClickEvent(m_eventID, result);
|
| - executionContext()->consumeWindowFocus();
|
| + m_consumeWindowInteractionTimer.stop();
|
| + consumeWindowInteraction(nullptr);
|
| break;
|
| case Push:
|
| client->didHandlePushEvent(m_eventID, result);
|
| @@ -153,6 +157,13 @@ void WaitUntilObserver::decrementPendingActivity()
|
| observeContext(0);
|
| }
|
|
|
| +void WaitUntilObserver::consumeWindowInteraction(Timer<WaitUntilObserver>*)
|
| +{
|
| + if (!executionContext())
|
| + return;
|
| + executionContext()->consumeWindowInteraction();
|
| +}
|
| +
|
| void WaitUntilObserver::trace(Visitor* visitor)
|
| {
|
| ContextLifecycleObserver::trace(visitor);
|
|
|