forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Worker: Apply origin trial tokens after off-the-main-thread shared/se…
…rvice worker script fetch > TL;DR Inside origin trial tokens - Dedicated Workers: - On-the-main-thread: no change (inherit outside tokens) - Off-the-main-thread: no change (inherit outside tokens) - Shared/Service Workers: - On-the-main-thread: no change (use response's tokens) - Off-the-main-thread: change (no tokens => use response's tokens) Outside origin trial tokens used for script fetch - Dedicated Workers: - On-the-main-thread: no change (use outside tokens) - Off-the-main-thread: no change (use outsied tokens) - Shared/Service Workers: - On-the-main-thread: no change (no tokens) - Off-the-main-thread: no change (no tokens) > Details For origin trial tokens, expected behavior is as follows: - Dedicated Workers inherit outside's origin trial tokens. On the other hand, Shared Workers and Service Workers use their own origin trial tokens served via script response's header. This behavior was described in the CL that implemented the mechanism (https://codereview.chromium.org/1828063002). - Installed Service Workers use origin trial tokens stored in the service worker script storage. Currently, on-the-main-thread worker script fetch implements this behavior, but off-the-main-thread workers script fetch other than dedicated workers completely ignores the origin trial tokens. To fix it, this CL moves OriginTrialContext::AddTokens() calls from WorkerGlobalScope constructor to WorkerGlobalScope::Initialize() except for DedicatedWorkerGlobalScope, and makes sure the origin trial tokens are applied in any code paths. DedicatedWorkerGlobalScope still applies the origin trial tokens to itself in its constructor (see below for the reason). This affects the existing behavior as follows: - For on-the-main-thread worker script fetch, this doesn't change the existing expected behavior because Initialize() is called immediately after the constructor, and OriginTrialContext is not used during the period. - For off-the-main-thread shared/service worker script fetch including module workers, this changes the existing behavior. Before this CL, they don't apply origin trial tokens, and some tests fail. After this CL, they apply the tokens in Initialize() after script fetch, and the tests pass. - For off-the-main-thread dedicated worker script fetch including module workers, this doesn't change the existing behavior because dedicated workers still apply the origin trial tokens in the constructor. - During off-the-main-thread top-level shared/service worker script fetch, origin trial tokens are not available. This is aligned with the existing behavior, but probably we might want to make fetch client's origin trial tokens available during the period. This needs more discussion, and it is out of the scope of this CL. On the other hand, off-the-main-thread top-level dedicated worker script fetch can use the fetch client's origin trial tokens because Dedicated Workers applies the outside's origin trial tokens in the constructor. This is also aligned with the existing behavior. Design doc: https://docs.google.com/document/d/1JCv8TD2nPLNC2iRCp_D1OM4I3uTS0HoEobuTymaMqgw/edit?usp=sharing Bug: 945215 Change-Id: I619baf0e52f8b6cc89f696cf9bb2f2b5e234d545 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1599756 Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org> Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org> Reviewed-by: Kenichi Ishibashi <bashi@chromium.org> Cr-Commit-Position: refs/heads/master@{#659845}
- Loading branch information
Showing
13 changed files
with
112 additions
and
64 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.