Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Service worker registration soft updates happen too frequently
https://bugs.webkit.org/show_bug.cgi?id=182296
<rdar://problem/37031862>

Reviewed by Youenn Fablet.

Move code that updates the registration's last update check time from after
the script bytecheck to before, as per:
- https://w3c.github.io/ServiceWorker/#update (step 7.19)

This way, the last update check time gets updated even if the newly fetched
script is identical to the previous one, which is the common case.

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::updateWorker):
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):


Canonical link: https://commits.webkit.org/198099@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@227796 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Jan 30, 2018
1 parent b5edd91 commit 848cc84
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,23 @@
2018-01-30 Chris Dumez <cdumez@apple.com>

Service worker registration soft updates happen too frequently
https://bugs.webkit.org/show_bug.cgi?id=182296
<rdar://problem/37031862>

Reviewed by Youenn Fablet.

Move code that updates the registration's last update check time from after
the script bytecheck to before, as per:
- https://w3c.github.io/ServiceWorker/#update (step 7.19)

This way, the last update check time gets updated even if the newly fetched
script is identical to the previous one, which is the common case.

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::updateWorker):
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptFetchFinished):

2018-01-30 Zalan Bujtas <zalan@apple.com>

[RenderTreeBuilder] Move childBecameNonInline to RenderTreeBuilder
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/workers/service/server/SWServer.cpp
Expand Up @@ -462,7 +462,6 @@ void SWServer::removeClientServiceWorkerRegistration(Connection& connection, Ser

void SWServer::updateWorker(Connection&, const ServiceWorkerJobDataIdentifier& jobDataIdentifier, SWServerRegistration& registration, const URL& url, const String& script, const ContentSecurityPolicyResponseHeaders& contentSecurityPolicy, WorkerType type)
{
registration.setLastUpdateTime(WallTime::now());
tryInstallContextData({ jobDataIdentifier, registration.data(), generateObjectIdentifier<ServiceWorkerIdentifierType>(), script, contentSecurityPolicy, url, type, false });
}

Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/workers/service/server/SWServerJobQueue.cpp
Expand Up @@ -81,6 +81,8 @@ void SWServerJobQueue::scriptFetchFinished(SWServer::Connection& connection, con
return;
}

registration->setLastUpdateTime(WallTime::now());

// If newestWorker is not null, newestWorker's script url equals job's script url with the exclude fragments
// flag set, and script's source text is a byte-for-byte match with newestWorker's script resource's source
// text, then:
Expand Down

0 comments on commit 848cc84

Please sign in to comment.