[wpt-sync] Sync PR 63357 - Enforce CORS in Background Fetch
Categories
(Core :: DOM: Service Workers, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 63357 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/63357
Details from upstream follow.
Hubert Chao <hchao@chromium.org> wrote:
Enforce CORS in Background Fetch
Previously, the DownloadService previously defaulted all fetch requests
tokNavigate(which bypasses CORS). This CL updates the Background
Fetch delegate to pass the original fetch request mode down to the
DownloadService, so that the network service can correctly enforce CORS
checks on Background Fetch requests.This additionally updates the proto serialization to persist the request
mode across browser restarts, and modify testing handlers to ensure the
CORS enforcement properly blocks requests that lack required
Access-Control headers. The browser tests have been updated to initiate
these fetches from the Window context instead of the Service Worker to
sidestepkRestrictBackgroundFetchFromServiceWorkerrestrictions.Additionally, to prevent old suspended downloads from resuming and
bypassing CORS after the browser updates, EntryFromProto explicitly
upgrades the request mode to kCors if the fetch_request_mode is missing
and the client is BACKGROUND_FETCH.The CORS enforcement and legacy proto upgrade logic are gated behind a
newkBackgroundFetchCorsEnforcementfeature kill switch.TAG=agy
CONV=96c12324-004c-4da1-bec2-9436ea828a56Bug: 515243254, 496008447, 495903812, 485855931, 40059500, 500171457, 498000798
Change-Id: I1dc5266d08c20c23ee56340a3c20b7b988befb59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8103044
Reviewed-by: Colin Blundell \<blundell@chromium.org>
Reviewed-by: Yoshisato Yanagisawa \<yyanagisawa@chromium.org>
Commit-Queue: Hubert Chao \<hchao@chromium.org>
Reviewed-by: Camille Lamy \<clamy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1713422}
| Assignee | ||
Updated•1 month ago
|
| Assignee | ||
Comment 1•1 month ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=101887
| Assignee | ||
Comment 2•1 month ago
|
||
CI Results
Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 14 tests
Status Summary
Firefox
OK : 1
FAIL : 14
Chrome
PASS : 2
TIMEOUT: 2
NOTRUN : 11
Safari
OK : 1
FAIL : 14
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
New Tests That Don't Pass
- /background-fetch/abort.https.window.html [wpt.fyi]:
SKIP - /background-fetch/content-security-policy.https.window.html [wpt.fyi]:
SKIP - /background-fetch/fetch-uploads.https.window.html [wpt.fyi]:
SKIP - /background-fetch/fetch.https.window.html [wpt.fyi]:
OK[GitHub],SKIP[Gecko-android-em-14-x86_64-debug-geckoview,Gecko-android-em-14-x86_64-lite-opt-geckoview,Gecko-android-em-14-x86_64-opt-geckoview,Gecko-linux2404-64-debug,Gecko-linux2404-64-opt,Gecko-windows11-32-25h2-debug,Gecko-windows11-32-25h2-opt,Gecko-windows11-64-25h2-debug,Gecko-windows11-64-25h2-opt] (Chrome:TIMEOUT, Safari:OK)- Background Fetch requires an activated Service Worker:
FAIL(Chrome:PASS, Safari:FAIL) - Argument verification is done for BackgroundFetchManager.fetch():
FAIL(Chrome:PASS, Safari:FAIL) - IDs must be unique among active Background Fetch registrations:
FAIL(Chrome:TIMEOUT, Safari:FAIL) - Empty URL is OK.:
FAIL(Chrome:NOTRUN, Safari:FAIL) - Requests with PUT method require CORS Preflight and succeed.:
FAIL(Chrome:NOTRUN, Safari:FAIL) - Requests with text/json content type require CORS Preflight and succeed.:
FAIL(Chrome:NOTRUN, Safari:FAIL) - Using Background Fetch to successfully fetch a single resource:
FAIL(Chrome:NOTRUN, Safari:FAIL) - Registration object gets updated values when a background fetch completes.:
FAIL(Chrome:NOTRUN, Safari:FAIL) - Background Fetch that exceeds the quota throws a QuotaExceededError:
FAIL(Chrome:NOTRUN, Safari:FAIL) - Fetches can have requests with duplicate URLs:
FAIL(Chrome:NOTRUN, Safari:FAIL) - recordsAvailable is false after onbackgroundfetchsuccess finishes execution.:
FAIL(Chrome:NOTRUN, Safari:FAIL) - Using Background Fetch to fetch a non-existent resource should fail.:
FAIL(Chrome:NOTRUN, Safari:FAIL) - Fetches with mixed content should fail.:
FAIL(Chrome:NOTRUN, Safari:FAIL) - Responses failing CORS checks are not leaked:
FAIL(Chrome:NOTRUN, Safari:FAIL)
- Background Fetch requires an activated Service Worker:
- /background-fetch/get-ids.https.window.html [wpt.fyi]:
SKIP - /background-fetch/get.https.window.html [wpt.fyi]:
SKIP - /background-fetch/idlharness.https.any.sharedworker.html [wpt.fyi]:
SKIP - /background-fetch/idlharness.https.any.serviceworker.html [wpt.fyi]:
SKIP - /background-fetch/idlharness.https.any.worker.html [wpt.fyi]:
SKIP - /background-fetch/idlharness.https.any.html [wpt.fyi]:
SKIP - /background-fetch/match.https.window.html [wpt.fyi]:
SKIP - /background-fetch/mixed-content-and-allowed-schemes.https.window.html [wpt.fyi]:
SKIP - /background-fetch/port-blocking.https.window.html [wpt.fyi]:
SKIP - /background-fetch/update-ui.https.window.html [wpt.fyi]:
SKIP
Tests Disabled in Gecko Infrastructure
- /background-fetch/abort.https.window.html [wpt.fyi]:
SKIP - /background-fetch/content-security-policy.https.window.html [wpt.fyi]:
SKIP - /background-fetch/fetch-uploads.https.window.html [wpt.fyi]:
SKIP - /background-fetch/fetch.https.window.html [wpt.fyi]:
OK[GitHub],SKIP[Gecko-android-em-14-x86_64-debug-geckoview,Gecko-android-em-14-x86_64-lite-opt-geckoview,Gecko-android-em-14-x86_64-opt-geckoview,Gecko-linux2404-64-debug,Gecko-linux2404-64-opt,Gecko-windows11-32-25h2-debug,Gecko-windows11-32-25h2-opt,Gecko-windows11-64-25h2-debug,Gecko-windows11-64-25h2-opt] (Chrome:TIMEOUT, Safari:OK) - /background-fetch/get-ids.https.window.html [wpt.fyi]:
SKIP - /background-fetch/get.https.window.html [wpt.fyi]:
SKIP - /background-fetch/idlharness.https.any.sharedworker.html [wpt.fyi]:
SKIP - /background-fetch/idlharness.https.any.serviceworker.html [wpt.fyi]:
SKIP - /background-fetch/idlharness.https.any.worker.html [wpt.fyi]:
SKIP - /background-fetch/idlharness.https.any.html [wpt.fyi]:
SKIP - /background-fetch/match.https.window.html [wpt.fyi]:
SKIP - /background-fetch/mixed-content-and-allowed-schemes.https.window.html [wpt.fyi]:
SKIP - /background-fetch/port-blocking.https.window.html [wpt.fyi]:
SKIP - /background-fetch/update-ui.https.window.html [wpt.fyi]:
SKIP
Comment 4•1 month ago
|
||
| bugherder | ||
Description
•