New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate requests due to speculative parsing with active service worker #21729
Merged
webkit-commit-queue
merged 1 commit into
WebKit:main
from
youennf:eng/Duplicate-requests-due-to-speculative-parsing-with-active-service-worker
Dec 14, 2023
Merged
Duplicate requests due to speculative parsing with active service worker #21729
webkit-commit-queue
merged 1 commit into
WebKit:main
from
youennf:eng/Duplicate-requests-due-to-speculative-parsing-with-active-service-worker
Dec 14, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EWS run on previous version of this PR (hash e9cc9b8) |
youennf
force-pushed
the
eng/Duplicate-requests-due-to-speculative-parsing-with-active-service-worker
branch
from
December 13, 2023 15:06
e9cc9b8
to
e4bd6c7
Compare
EWS run on previous version of this PR (hash e4bd6c7) |
cdumez
approved these changes
Dec 13, 2023
youennf
force-pushed
the
eng/Duplicate-requests-due-to-speculative-parsing-with-active-service-worker
branch
from
December 13, 2023 17:16
e4bd6c7
to
09c7f96
Compare
EWS run on current version of this PR (hash 09c7f96) |
webkit-ews-buildbot
added
the
merging-blocked
Applied to prevent a change from being merged
label
Dec 13, 2023
youennf
added
merge-queue
Applied to send a pull request to merge-queue
and removed
merging-blocked
Applied to prevent a change from being merged
labels
Dec 14, 2023
https://bugs.webkit.org/show_bug.cgi?id=250454 rdar://104377727 Reviewed by Chris Dumez. In case a service worker is located in the same process as a controlled document, they both share the same memory cache. Before the patch, in case of preloads triggered byt he speculative parser and the preloads are not cacheable, the following would happen: - Trigger a preload, which gets registered in the memory cache. - Let the service worker handle the preload, which triggers a fetch of the same resource. - This fetch will remove the preload resource from the memory cache and do the actual network load. - The real load of the HTML resource kicks in and tries to load the resource from the memory cache. - Given the resource is not a preload and is not reusable according the HTTP headers, a new load is triggered. This makes it so that two loads are happening for the same resource (one for the preload and one for the actual load). To resolve the issue, we do not add the service worker fetch resource in the memory cache in the following case: - There is an existing cached resource, which is a preload, and not a service worker request. - The new request is a service worker request. This ensures that we keep the preload cached resource in the memory cache which allows reuse when the actual load happens. * LayoutTests/http/wpt/service-workers/resources/serviceworker-and-preloads-iframe.html: Added. * LayoutTests/http/wpt/service-workers/resources/serviceworker-preload-img.png: Added. * LayoutTests/http/wpt/service-workers/resources/serviceworker-preload-img.png.headers: Added. * LayoutTests/http/wpt/service-workers/resources/serviceworker-preload-script.js: Added. * LayoutTests/http/wpt/service-workers/resources/serviceworker-preload-script.js.headers: Added. * LayoutTests/http/wpt/service-workers/serviceworker-and-preloads-expected.txt: Added. * LayoutTests/http/wpt/service-workers/serviceworker-and-preloads-worker.js: Added. * LayoutTests/http/wpt/service-workers/serviceworker-and-preloads.html: Added. * Source/WebCore/loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): (WebCore::computeShouldAddToMemoryCache): (WebCore::CachedResourceLoader::requestResource): (WebCore::CachedResourceLoader::loadResource): * Source/WebCore/loader/cache/CachedResourceLoader.h: Canonical link: https://commits.webkit.org/272024@main
webkit-commit-queue
force-pushed
the
eng/Duplicate-requests-due-to-speculative-parsing-with-active-service-worker
branch
from
December 14, 2023 09:34
09c7f96
to
c68a38f
Compare
Committed 272024@main (c68a38f): https://commits.webkit.org/272024@main Reviewed commits have been landed. Closing PR #21729 and removing active labels. |
webkit-commit-queue
removed
the
merge-queue
Applied to send a pull request to merge-queue
label
Dec 14, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
c68a38f
09c7f96