Bug 1780841 [wpt PR 34941] - Policy container inheritance for service workers, a=testonly

Automatic update from web-platform-tests
Policy container inheritance for service workers

Project: https://docs.google.com/document/d/1mAuxWRLcmhghtCoapc30nLo0H12XTMZUJWqw079XOR8/edit?hl=en&forcehl=1

This is the part about service worker.

Attach a PolicyContainerHost to ServiceWorkerVersion. This
PolicyContainerHost is obtained:
- for local schemes by cloning the creator’s PolicyContainerHost in
  ServiceWorkerRegisterJob::StartWorkerForUpdate
- for network schemes by parsing the policies from the response headers
  inside ServiceWorkerNewScriptLoader::OnReceiveResponse (new script) or
  ServiceWorkerSingleScriptUpdateChecker::OnReceiveResponse (updated
  script).
- for previously loaded script which is stored in the database, we write
  the policy container policies to db just like the existing service
  worker data, hence the changes around service worker database and
  protocol buffer. - The sandbox flags is represented as a int32 instead
  of a enum because protocol buffer enums can't be or'ed like a flag.
- CSP is skipped in this CL because the type is quite complicated and
  require a lot more work.  We don't seem to use the policy container CSP
  in the renderer anyway.
- I added a test to make sure that the encoding and decoding works

The policy container is then passed down to renderer and set as the
execution context's policy container.

This CL also fixes
external/wpt/html/cross-origin-embedder-policy/reflection-credentialless.tentative.https.any.serviceworker.html
and
external/wpt/html/cross-origin-embedder-policy/reflection-require-corp.tentative.https.any.serviceworker.html
because the passed down policy container contains the correct COEP.

Follow-ups: merge CSPs into our policy container.

Bug: 1177199
Change-Id: Ie90c02b8dd3e295c5456e7e2ff03685339277d6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3766681
Commit-Queue: Jonathan Hao <[email protected]>
Reviewed-by: Arthur Sonzogni <[email protected]>
Reviewed-by: Dominick Ng <[email protected]>
Reviewed-by: Hiroki Nakagawa <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1039661}

--

wpt-commits: 5b5083629de65e454d9204dd1b4abeb42524f6f2
wpt-pr: 34941
This commit is contained in:
Jonathan Hao authored and moz-wptsync-bot committed 2022-09-04 17:59:59 +00:00
1 parent 74389b8bf0
commit 2025060ec0
3 files changed
+3 -3

No files matched your search

@@ -1,2 +1,2 @@
// META: global=window,worker,sharedworker-module
// META: global=window,worker,sharedworker-module,serviceworker-module
test(t => assert_equals(crossOriginEmbedderPolicy, "credentialless"));
@@ -1,2 +1,2 @@
// META: global=window,worker,sharedworker-module
// META: global=window,worker,sharedworker-module,serviceworker-module
test(t => assert_equals(crossOriginEmbedderPolicy, "require-corp"));
@@ -1,2 +1,2 @@
// META: global=window,worker,sharedworker-module
// META: global=window,worker,sharedworker-module,serviceworker-module
test(t => assert_equals(crossOriginEmbedderPolicy, "unsafe-none"));