0
Commit Graph

981 Commits

Author SHA1 Message Date
Andrey Kosyakov
1598b6392d Split WorkerDevToolsAgentHost into Worker... and Worklet... [2/2]
This introduces DedicatedWorkerDevToolsAgentHost and
WorkletDevToolsAgentHost and moves target-specific
functionality from WorkerOrWorkletDevToolsAgentHost to
respective derived classes.

Bug: 1517088
Change-Id: Id47f2c4d70a7e3293ac26554318a8a0120986fce
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5185611
Reviewed-by: Peter Kvitek <kvitekp@chromium.org>
Reviewed-by: Ben Kelly <wanderview@chromium.org>
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1246242}
2024-01-12 04:21:34 +00:00
Andrey Kosyakov
626300716c Split WorkerDevToolsAgentHost into Worker... and Worklet... [1/2]
This is part 1 of a series of CL to split DevTools agent hosts for
workers and regular (CSS/Animation/Audio) worklets. These differ
notably in the domains they support and other aspects of handling
and are already handled differently on the renderer side, so they
deserve specific classes on the browser side as well. This CL
just renames WorkerDevToolsAgentHost to WorkerOrWorkletDevToolsAgentHost, with the intent of it serving as
a common base for DedicatedWorkerDevToolsAgentHost and
WorkletDevToolsAgentHost, to be introduced in the follow-up CLs.

Bug: 1517088
Change-Id: Ie7b02361b10ad18555194217f26f74585b7ab2f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5186137
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Peter Kvitek <kvitekp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1246220}
2024-01-12 03:56:19 +00:00
Xinghui Lu
eddfce30a3 [AsyncSB] Pass navigation_id into CreateURLLoaderThrottles
This info will eventually be used to implement
AsyncCheckTracker::IsMainPageLoadPending[1]. We will add navigation_id
in security_interstitials::UnsafeResource and use it to determine
whether DidFinishNavigation has been called and whether we should
show a post commit error. The navigation_id is needed to map
UnsafeResource back to the original navigation that triggered this Safe
Browsing check.

This CL only bubbles up navigation_id to the embedder layer without
actual usage. The actual usage will be done in the following sequence:
  1) Inject navigation_id into safe_browsing/ layer:
     https://crrev.com/c/5171128.
  2) Consume the navigation_id in safe_browsing::AsyncCheckTracker:
     https://crrev.com/c/5171302.

More context in http://shortn/_92fIErC6tC (google only).

[1] https://source.chromium.org/chromium/chromium/src/+/main:components/safe_browsing/content/browser/async_check_tracker.cc;l=35;drc=e71b6befbb758f58280989b2a83b583a7394fe06

Bug: 1501194
Change-Id: I52c0394004c21d338c7e312d24dcd6f3ce5ea233
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5171446
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Commit-Queue: Xinghui Lu <xinghuilu@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: David Song <wintermelons@google.com>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1246021}
2024-01-11 19:32:16 +00:00
Arthur Sonzogni
c686e8f4fd Rename {absl => std}::optional in //content/
Automated patch, intended to be effectively a no-op.

Context:
https://groups.google.com/a/chromium.org/g/cxx/c/nBD_1LaanTc/m/ghh-ZZhWAwAJ?utm_medium=email&utm_source=footer

As of https://crrev.com/1204351, absl::optional is now a type alias for
std::optional. We should migrate toward it.

Script:
```
function replace {
  echo "Replacing $1 by $2"
  git grep -l "$1" \
    | cut -f1 -d: \
    | grep \
      -e "^content" \
    | sort \
    | uniq \
    | grep \
      -e "\.h" \
      -e "\.cc" \
      -e "\.mm" \
      -e "\.py" \
    | xargs sed -i "s/$1/$2/g"
}
replace "absl::make_optional" "std::make_optional"
replace "absl::optional" "std::optional"
replace "absl::nullopt" "std::nullopt"
replace "absl::in_place" "std::in_place"
replace "absl::in_place_t" "std::in_place_t"
replace "\"third_party\/abseil-cpp\/absl\/types\/optional.h\"" "<optional>"
git cl format
```

# Skipping unrelated "check_network_annotation" errors.
NOTRY=True

Bug: chromium:1500249
Change-Id: Icfd31a71d8faf63a2e8d5401127e7ee74cc1c413
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5185537
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1245739}
2024-01-11 08:36:37 +00:00
Wei4 Wang
3be3f9a230 [ComputePressure] Add permission policy control for workers
According to the spec[1], we should also add permission policy control
for workers(dedicated worker and shared worker).

[1] https://www.w3.org/TR/compute-pressure/#policy-control

Bug: 1511907
Change-Id: I33c8ca3d92642a815a8b11d1585d63b362905a1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5125793
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Commit-Queue: Wei4 Wang <wei4.wang@intel.com>
Cr-Commit-Position: refs/heads/main@{#1240855}
2023-12-25 07:05:55 +00:00
Wei4 Wang
4db5fa3d03 [ComputePressure] Use HasImplicitFocus() for workers.
This CL uses HasImplicitFocus() for workers to support workers in
privacy algos and also makes the change covered by corresponding
browser tests.

Bug: 1425053
Change-Id: If76c1bf7c27d4c776aa463b63546f64b0c5e267d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4976057
Commit-Queue: Wei4 Wang <wei4.wang@intel.com>
Reviewed-by: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1237402}
2023-12-14 06:39:25 +00:00
Wei4 Wang
353aca0476 [ComputePressure] Add PressureServiceForWorker.
This CL adds a class named PressureServiceForWorker which holds
functions only for workers.

Bug: 1500467
Change-Id: Ief9d92dc470c141846a1fe9d2701980a70363e93
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4951586
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Raphael Kubo Da Costa <raphael.kubo.da.costa@intel.com>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Wei4 Wang <wei4.wang@intel.com>
Reviewed-by: Matthew Denton <mpdenton@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1237362}
2023-12-14 03:40:58 +00:00
Patrick Monette
36031967ad Implement ServiceWorkerClientInfo using absl::variant
This CL contains a bunch of IWYU fixes due to the removal of many
headers in service_worker_client_info.h.

Change-Id: I16b058da387074a8a90ba07787a8d8332c0c1be8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064388
Reviewed-by: Avi Drissman <avi@chromium.org>
Auto-Submit: Patrick Monette <pmonette@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231017}
2023-11-30 00:13:03 +00:00
Patrick Monette
bb98bf6fda Expose nested information about dedicated workers
This CL modifies the DedicatedWorkerService observer interface
to expose information about nested workers.

Before this change, only the ancestor frame was exposed, making
it impossible to know if a worker was nested or not.

Now, a new variant type called DedicatedWorkerCreator represents
either the creator frame or the creator dedicated worker.

This new type replaces both `creator_render_frame_host_id_` and
`creator_worker_token_` in DedicatedWorkerHost.

Bug: 993029
Change-Id: Ia45317e82a1794f51085cab5ad841275779c8633
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2355050
Reviewed-by: Kirubel Aklilu <kaklilu@chromium.org>
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Anton Maliev <amaliev@chromium.org>
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1230736}
2023-11-29 17:44:56 +00:00
Hiroshige Hayashizaki
18c940ecf6 Remove WorkerScriptLoader::MaybeCreateLoaderForResponse
After
https://chromium-review.googlesource.com/c/chromium/src/+/5048055
it's clearer that `MaybeCreateLoaderForResponse()` is no-op
for `WorkerScriptLoader` as it's no-op for
`ServiceWorkerMainResourceLoaderInterceptor`.

Bug: 1403746
Change-Id: I8f433ca180dc3f84fb1c5f3a46539a589505d998
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5064534
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1230317}
2023-11-28 23:58:53 +00:00
Yoshisato Yanagisawa
e83233a7c6 PlzDedicatedWorker: make the script load follows non-PlzDedicatedWorker.
This is a follow up of:
https://chromium-review.googlesource.com/c/chromium/src/+/4983030

During the review, I was asked to make the dedicated worker script load
from the first party should also be treated as the first party.
This CL makes the PlzDedicatedWorker script load to follow what
non-PlzDedicatedWorker does to make it recognize the first party
context.

Bug: 906991, 1504989
Change-Id: I80cabb836bfd5c4e30aac5df25cad5b48d04c07e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5052424
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Caitlin Fischer <caitlinfischer@google.com>
Reviewed-by: Tsuyoshi Horo <horo@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1230308}
2023-11-28 23:48:37 +00:00
Hiroshige Hayashizaki
92cca3ffe6 Remove will_return_unsafe_redirect from MaybeCreateLoaderForResponse
No longer used.

Bug: 1403746
Change-Id: I452f372bb4cb35d81ddca5d6f91fb4b254ccd3d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5065730
Reviewed-by: Chris Thompson <cthomp@chromium.org>
Reviewed-by: Lingqi Chi <lingqi@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1230265}
2023-11-28 23:06:36 +00:00
Takashi Nakayama
3c658f3e7f Change the argument types of FallbackCallback in NavigationLoaderInterceptor
This CL adds a structure and changes the arguments of FallbackCallback
in `NavigationLoaderInterceptor` to the newly created structure.
The added structure currently has only one field, `load_timing_info`, but we plan to add other fields to update response headers other than
load timing.

This is the preliminary change to fix the bug on DevTools support for SW
Static Routing API.

Bug: 1502443
Change-Id: I742f9277586a29aa7cea2d1f79adcc867193390b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5051307
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org>
Commit-Queue: Takashi Nakayama <tnak@chromium.org>
Reviewed-by: Shunya Shishido <sisidovski@chromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1228776}
2023-11-24 14:26:44 +00:00
Hiroki Nakagawa
90104b5cb7 ServiceWorker: Simplify interceptor handling for worker script loading
WorkerScriptLoader was originally designed for handling multiple
NavigationLoaderInterceptors, but after AppCache was removed by
https://crrev.com/c/3214643, ServiceWorkerMainResourceLoaderInterceptor
is the only intercepter used there. For code cleanup, this CL makes the
loader explicitly handle only one interceptor.

Bug: n/a
Change-Id: Id5511d3763e11dd92c54513387edc06d6f90bbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5048055
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1227742}
2023-11-22 02:05:05 +00:00
Jason Lin
218737054b Add a new bit "fixed storage partition" to BrowsingInstance and friends
This new bit will make the storage partition config to preserved
across navigation (similar to the "is_guest" bit).

Also switch the isolated PWA to use this instead of guest SiteInstance.

Bug: b/304851565
Change-Id: I43755d6bce622749dbe6cca2ae5ac170e381bbba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5012192
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Jason Lin <lxj@google.com>
Reviewed-by: Glen Robertson <glenrob@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1227266}
2023-11-21 08:11:39 +00:00
Yoshisato Yanagisawa
a655a024eb PlzDedicatedWorker: use ancestor_render_frame_host only if it is valid.
`ancestor_render_frame_host` looks used regardless of it is valid or
not. When the RenderFrameHost has been deleted, it might be natural to
get nullptr for `ancestor_render_frame_id_`, and we should not use the
value at that time.

Bug: 1501265
Change-Id: I3f0ff19364f5ac8393a859f590b8db3003e26bb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5029253
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Commit-Queue: Yoshisato Yanagisawa <yyanagisawa@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1224614}
2023-11-14 23:43:25 +00:00
Nathan Memmott
a9fcfeb40f FSA: Make LockHandles owned by their frame.
This is a refactor in preparation to implement BFCache logic for
FileSystemAccessLockManager. There should be no behavioral change.

This plumbs the GlobalRenderFrameHostId through to the LockManager so
that the LockManager can hand out LockHandles for each Lock per the
frame.

Bug: 1382215, 1241174
Change-Id: I55301f488bd3b22423efa065bc79fe2e81ce4525
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4953324
Reviewed-by: Austin Sullivan <asully@chromium.org>
Commit-Queue: Nathan Memmott <memmott@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Chris Bookholt <bookholt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1217823}
2023-10-31 19:58:30 +00:00
Dylan Cutler
bad5a62ab6 Use correct site for cookies in SharedWorker fetch context
Bug: 723553,1147281,1488557
Change-Id: I69b6bea96dd509cd6df2abf386c693098754bb62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4915516
Commit-Queue: Dylan Cutler <dylancutler@google.com>
Reviewed-by: Ben Kelly <wanderview@chromium.org>
Reviewed-by: Mason Freed <masonf@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1207240}
2023-10-09 20:05:59 +00:00
Dylan Cutler
ee4818a9a4 Partitioned SharedWorker/cookies interaction
This CL adds a WPT which ensures that partitioned SharedWorkers
only can access partitioned cookies whose CookiePartitionKey
match the worker's StorageKey. The test covers subresource requests
and importScripts calls. It does not test the cookies available to
the request for the worker script.

It also updates how SharedWorker builds IsolationInfo in some
places to ensure the tests pass.

Bug: 1147281,1488557
Change-Id: I5a576a182b19d9d09caaa2ad042d50cb8de6d03b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4908159
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Dylan Cutler <dylancutler@google.com>
Cr-Commit-Position: refs/heads/main@{#1205932}
2023-10-05 18:09:07 +00:00
Chris Fredrickson
e7ba521f1e [RWS] Remove unused is_internal field
This field is no longer used as of https://crrev.com/c/4716279, so it
can be removed. This allows removal of the remaining party_context
bits in isolation_info.proto.

The is_internal field was added in https://crrev.com/c/4846992 to
replace the outgoing
`absl::optional<std::set<SchemefulSite>> party_context_` field. But it
was just a placeholder until the field could be fully removed (in this
CL).

Bug: 1348588, 1151947
Change-Id: If3967d3b087d3ce972a5fb64c29fb9e1efceff11
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4880566
Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1201574}
2023-09-26 14:54:42 +00:00
Chris Fredrickson
0a466bef8a Remove unused party_context computation
The party_context is never actually read anymore, now that the
implementation of the SameParty attribute has been (mostly) removed.
The only remaining reader of the field just cares about whether the
absl::optional is populated for not, so we can replace the field with
a boolean. (Note: I'm open to better names for the boolean, since the
one I picked seems in conflict with
IsolationInfo::CreateForInternalRequest. But I don't have a better
idea.)

Note that this does not touch the IsolationInfo proto's field, since
I can't tell how that's used (and it may be stored on disk).

Bug: 1348588
Change-Id: I3b9ef1c86880fa733175054bb97aeea3c920bd19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4846992
Reviewed-by: Steven Bingler <bingler@chromium.org>
Reviewed-by: Brendon Tiszka <tiszka@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: Dominic Farolino <dom@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Dominic Farolino <dom@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1193664}
2023-09-07 17:34:35 +00:00
Patrick Monette
102b122f26 Use InProcessRendererExiting in DedicatedWorkerHost
With the newly introduced InProcessRenderExiting notification, it can
be used to handle the --single-process flag the same way that we
handle regular renderer that exited.

Change-Id: Id12e661267907594881fc88c70565445f7d5f780
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4778750
Commit-Queue: Patrick Monette <pmonette@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1184698}
2023-08-17 14:12:17 +00:00
Jonathan Hao
9ebd2468a2 Revert "[Local Network Access] Rename c/b/r/private_network_access_util.*."
This reverts commit e619b485a0.

Reason for revert: The spec has been renamed back to Private Network Access https://github.com/WICG/private-network-access/pull/106

Original change's description:
> [Local Network Access] Rename c/b/r/private_network_access_util.*.
>
> The contents of the file will be renamed later, to keep reviews simpler.
>
> Bug: chromium:1418287
> Change-Id: I3d95f81bbfde7ca3fadf02da2657cddeb3bf2218
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4324677
> Auto-Submit: Titouan Rigoudy <titouan@chromium.org>
> Commit-Queue: Camille Lamy <clamy@chromium.org>
> Reviewed-by: Camille Lamy <clamy@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1115686}

Bug: chromium:1418287
Change-Id: Ib1aed1e748ee3da21db6940bf9c9bdd4eea47dd1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4694977
Auto-Submit: Jonathan Hao <phao@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Titouan Rigoudy <titouan@chromium.org>
Commit-Queue: Jonathan Hao <phao@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1176099}
2023-07-27 16:06:07 +00:00
Mariam Ali
8338d9fa2d Refactor: Rename storage_key() to GetStorageKey() in RenderFrameHost
Change-Id: I3bf063cd28d80f1208771e2562f7f2a9667b4bfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4660670
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: Mariam Ali <alimariam@google.com>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1174259}
2023-07-24 16:57:31 +00:00
Zijie He
bf5a2432c8 Enable the consistently passing tests in SharedWorkerServiceImplTest
This change is part of the effort to re-enable consistently passing
tests across the entire chromium.
If the tests are reasonable, please LGTM and I will proceed to submit
the change.
If the tests are unreasonable, please let me know and I will remove
them.


------ How the change is created ------

I do not inspect each individual test case, the idea is to run the
disabled tests on reviver builders
https://ci.chromium.org/ui/p/chromium/g/reviver/builders and use the
aggregated results to decide if a previously disabled test is now
consistently passing.

Usually I create changes by directly enabling the tests. If the tests
are failing on platforms not covered by the reviver builders or
explicitly mentioned in the associated bugs, I may conditionally
enable them on certain platforms.
But other than that, I won't include extra changes except for the
ones suggested by `git cl format`.


------ How to inspect the reviver builder results ------

You may choose a platform you are interested,
e.g. chromium/reviver/lacros-coordinator.
[link: https://ci.chromium.org/p/chromium/builders/reviver/lacros-coordinator]
In the baseline builder / buildbucket.schedule step, e.g.
chromium/ci/linux-lacros-builder-rel - buildbucket.schedule,
there will be a luci run link.
[ex: https://ci.chromium.org/ui/p/chromium/builders/reviver/runner/b8776966777608450081/overview]


------ Aggregated results of the tests involved ------

The following list shows how many times the changed tests were
*consistently* passing on the relevant builders.

content/test:content_unittests/SharedWorkerServiceImplTest.WebContentsDestroyed
        127     fuchsia-fyi-arm64-dbg
        150     fuchsia-fyi-x64-dbg
        192     fuchsia-x64-rel
        110     linux-lacros-tester-rel

data version: 2023-06-28 16:45:51

Bug: 1380293
Change-Id: I50ffc741565a46e8b292a89ec4fed63f280bd90e
Fixed: 1029434
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4701307
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Zijie He <zijiehe@google.com>
Cr-Commit-Position: refs/heads/main@{#1172662}
2023-07-19 23:43:20 +00:00
Jonathan Hao
63455ff629 Revert "[Local Network Access] Rename local IP address space to loopback"
This reverts commit 96f0490c44.

Reason for revert: The spec has been renamed back to Private Network Access https://github.com/WICG/private-network-access/pull/106

Original change's description:
> [Local Network Access] Rename local IP address space to loopback
>
> In https://github.com/WICG/local-network-access/issues/91, we decided to
> rename (public, private, local) IP address spaces to (public, local,
> loopback). The spec has already been renamed in
> https://github.com/WICG/local-network-access/pull/97.
> New spec: https://wicg.github.io/local-network-access/#ip-address-space-heading
>
> Since "local" appears in both the new and old definitions, we're going
> to do this in two steps. Renaming "local" to "loopback" first so the
> compiler can verify that we've renamed everything.
>
> There are so many places to rename, so during the process, there will
> inevitably be inconsistencies. Hopefully, we shall resolve all of them
> soon.
>
> Bug: 1418287
> Change-Id: I55120b292b33f218ee1f37fbb9600606a509ea92
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4306714
> Reviewed-by: Colin Blundell <blundell@chromium.org>
> Commit-Queue: Jonathan Hao <phao@chromium.org>
> Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1114462}

Bug: 1418287
Change-Id: I414df47ad785f34447e32fce302f6f871f031eb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4671592
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Jonathan Hao <phao@chromium.org>
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1169989}
2023-07-13 16:51:40 +00:00
Jonathan Hao
90ddbd47e0 Revert "[Local Network Access] Rename private to local in client_security_state"
This reverts commit c95bd09ee3.

Reason for revert: The spec has been renamed back to Private Network Access https://github.com/WICG/private-network-access/pull/106

Original change's description:
> [Local Network Access] Rename private to local in client_security_state
>
> In https://github.com/WICG/local-network-access/issues/91, we decided to
> rename Private Network Access to Local Network Access. The spec has
> already been renamed in
> https://github.com/WICG/local-network-access/pull/97. The latest spec:
> https://wicg.github.io/local-network-access/
>
> This CL renames PrivateNetwork to LocalNetwork in
> client_security_state.mojom and a few other places that stores private
> network request policy.
>
> There are so many places to rename, so during the process, there will
> inevitably be inconsistencies. Hopefully, we shall resolve all of them
> soon.
>
> Bug: 1418287
> Change-Id: I4fc26e7c044ecb808d090910aff74d4a163782b2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4319985
> Reviewed-by: Mike West <mkwst@chromium.org>
> Commit-Queue: Jonathan Hao <phao@chromium.org>
> Reviewed-by: John Abd-El-Malek <jam@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1116302}

Bug: 1418287
Change-Id: I4d17d8689e4d465a74861a8642c8993ab4f61716
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4670563
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Jonathan Hao <phao@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1169313}
2023-07-12 14:23:48 +00:00
Andrew Rayskiy
0b29f12863 [DirectSockets] Support Direct Sockets in Dedicated Workers
The feature itself is only available to Isolated Web Apps and Chrome
Apps behind a flag.

Also replace Worker with DedicatedWorker in .idl files as we don't
have any plans of supporting other worker types at the moment.

Bug: 1456269

Change-Id: Ic9a55266b7f142d486845d200a72aa3de84ddd98
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4622315
Reviewed-by: Mike West <mkwst@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Andrew Rayskiy <greengrape@google.com>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1160621}
2023-06-21 14:30:43 +00:00
Victor Tan
4455f3d5ec Remove support UA reduction OT on Service Workers
This CL clean up one-off code to support User-Agent reduction and
User-agent deprecation origin trial. Make sure WorkerGlobalScope and WorkletGlobalScope execution return the correct user-agent for the Navigator JavaScript APIs. Instead of checking origin trial, user-agent response should depend on the default user-agent function as we completed user-agent reduction for all phases.

This CL also refactor the existing browser tests to make sure the
user-agent is already reduced when feature turns on.

Reference CL added support the two origin trials in Service Workers:
* https://crrev.com/c/3137615
* https://crrev.com/c/3427831

The following up cl will:
 * Remove UA reduction origin trial for all requests

Change-Id: I1e59edf7c22ae6b39ece5652f2eb610cae53e461
Bug: 1258063
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4538251
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Victor Tan <victortan@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Reviewed-by: Ben Kelly <wanderview@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1155035}
2023-06-08 19:15:55 +00:00
Ryan Sturm
7c0169035b Adding extensions to network response experiment
This CL expands the NavigationNetworkResponse experiment to include (a) the extensions web request UI thread shim for both navigation and service worker preload (i.e., service worker navigations where the main request is still loaded).

Bug: b/281094330
Change-Id: Iaf875d6858c68858a3b5bbc1db182b1659af35f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4510075
Owners-Override: Alexander Timin <altimin@chromium.org>
Commit-Queue: Ryan Sturm <ryansturm@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1150788}
2023-05-30 19:55:43 +00:00
Yoichi Osato
e0400143c9 Move content/public/common/network_service_util.h to c/p/browser/
That's because all functions are called from browser process.

For content/renderer/workers, IsOutOfProcessNetworkService() is
used ([1]) to terminate workers if the network service crashes.
However, if the crashed network service is in the browser process,
then the workers are going to get terminated anyway, so introducing
this condition doesn't actually help. Thus we can remove them.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1264139

Bug: 1329834
Change-Id: Iaf3c9847b2231aef9e413481d6bdf53f7e9065ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4547630
Auto-Submit: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Owners-Override: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1150766}
2023-05-30 19:35:40 +00:00
Andrew Williams
7dfb4e9c43 Update Shared Workers to create NIKs from StorageKey
This updates the last remaining callers of
NetworkIsolationKey::ToDoUseTopFrameOriginAsWell and
NetworkAnonymizationKey::ToDoUseTopFrameOriginAsWell to use
the new StorageKey::ToPartialNetIsolationInfo method instead.

Corresponding changes were made for Service Workers in
https://chromium-review.googlesource.com/c/chromium/src/+/4494754/15/content/browser/service_worker/service_worker_host.cc

This also removes NetworkIsolationKey::ToDoUseTopFrameOriginAsWell
and NetworkAnonymizationKey::ToDoUseTopFrameOriginAsWell,
since they are no longer used, as well as
IsolationInfo::ToDoUseTopFrameOriginAsWell since it isn't used
anymore either.

Bug: 1147281
Change-Id: Ic0332026009f80e97e9316a95a5a5339ccdc63bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4347543
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Andrew Williams <awillia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1144846}
2023-05-16 18:57:44 +00:00
Noam Rosenthal
efc9a2fb39 Expose workerStart in navgational service-worker fallback
Patch through the load timing info to the navigation URL loader
and use the intercepting worker's start time in the navigation
response.

Bug: 1056275
Change-Id: I53495f992d7a01bd85b2999fa3efe64b3b3e381c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4495245
Reviewed-by: Ben Kelly <wanderview@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Noam Rosenthal <nrosenthal@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1140163}
2023-05-05 16:25:24 +00:00
Aykut Bulut
871d3d228f Add PST issuance permissions policy
Add permissions policy for Private State Tokens issuance operation.
Update existing unit/browser tests. Add new unit/browser tests. Add
external WPT tests.

Permission Policy behavior:

1. If there are no permission policy response from server. PST
   issuance can be enabled in iframes for same and cross origins
   using allow attribute. See
   private-state-token-issue-allowed-by-permissions-policy-attribute.tentative.https.sub.html

2. Issuance can be disabled via the new permission policy, see
private-state-token-issue-disabled-by-permissions-policy.tentative.https.sub.html and relevant header file.

3. Permissions-Policy: private-state-token-issuance=* enables
   issuance. Cross origin iframes need allow attribute. See
permissions-policy/private-state-token-issue-enabled-by-permissions-policy.tentative.https.sub.html and relevant header file.


Fixed: 1434086
Change-Id: I02c41b45fab9415c135e74eb51d9033c308e7622
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4436709
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Aykut Bulut <aykutb@google.com>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1135556}
2023-04-25 21:33:12 +00:00
Dustin J. Mitchell
ec0848f20a Use a real storage key for cache API CodeCache storage
This uses the storage key known to the browser process, either from the
frame or worker, instead of creating a first-party storage key from the
origin received from the renderer.

This has the effect of better-partitioning this cache storage, as well
as not relying on an origin from the renderer process. The
`code_cache_origin` parameter is no longer passed from the renderer at
all.

Bug: 1402861, 1199077
Change-Id: I24de48f3b9bc046a4eab2fb2ba4d102b63f2dc5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4427498
Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
Reviewed-by: Martin Šrámek <msramek@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1135299}
2023-04-25 17:03:55 +00:00
Dustin Mitchell
4d81b209d5 Revert "Pass a StorageKey to CodeCacheHostImpl"
This reverts commit e02ff96748.

Reason for revert: crashes - https://crbug.com/1431027, https://crbug.com/1431200

Original change's description:
> Pass a StorageKey to CodeCacheHostImpl
>
> Supply CodeCacheHostImpl with a storage key at every point where one is
> created, and use that to key the cache storage.
>
> The effect is that CodeCache is now covered by third-party storage partitioning.
>
> Bug: 1402861, 779444
> Change-Id: Iac89bec207f7b0bba0e8df4d58c4ff91753c8168
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4362561
> Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
> Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
> Reviewed-by: Christian Dullweber <dullweber@chromium.org>
> Reviewed-by: Antonio Sartori <antoniosartori@chromium.org>
> Reviewed-by: Steven Bingler <bingler@chromium.org>
> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1126554}

Bug: 1402861, 779444
Change-Id: I62c39ac57521390be0c633a90f2dbf6f6be99534
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4404107
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
Owners-Override: Peter Williamson <petewil@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1127387}
2023-04-06 21:00:36 +00:00
Dustin J. Mitchell
e02ff96748 Pass a StorageKey to CodeCacheHostImpl
Supply CodeCacheHostImpl with a storage key at every point where one is
created, and use that to key the cache storage.

The effect is that CodeCache is now covered by third-party storage partitioning.

Bug: 1402861, 779444
Change-Id: Iac89bec207f7b0bba0e8df4d58c4ff91753c8168
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4362561
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Dustin Mitchell <djmitche@chromium.org>
Reviewed-by: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: Antonio Sartori <antoniosartori@chromium.org>
Reviewed-by: Steven Bingler <bingler@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1126554}
2023-04-05 14:28:53 +00:00
Yuzu Saijo
092ab4b6f7 [bfcache] Save Blocking Details on the browser side
This CL starts saving BackForwardCacheBlockingDetails (vector of mojom that has JS locations) in RenderFrameHostImpl and DedicatedWorkerHost, and use this mojom to determine which features are used.

We are not using the JavaScript blocking details yet in this CL.

Bug: 1366675

Change-Id: Ie81227b823040b6d8c415df908f6a946c29eb7de
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4322987
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Fergal Daly <fergal@chromium.org>
Commit-Queue: Yuzu Saijo <yuzus@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122878}
2023-03-28 07:42:40 +00:00
Matt Menke
d5244cf1f9 Make IsolationInfo and NetworkIsolationKey take nonces as optionals.
They were being taken as const pointers. This was due to overly strict
adherence to a line from the Google C++ style guide:

    Generally, use std::optional to represent optional by-value inputs,
    and use a const pointer when the non-optional form would have used
    a reference.

While this may make sense in the general case of a function that takes
a value and uses it directly, without more context, it doesn't make
sense in the case of a constructor that stores the input as an
absl::optional, particularly when every since production caller of that
constructor already has the value in an optional. Having all of those
callers have to convert an optional to a pointer, only to have the
constructor covert it back into an optional adds a lot of unnecessary
complexity, and doesn't accomplish anything useful.

BUG: None
Change-Id: I1a51cfab8df385df6fff8ae7dc064e2438740315
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4326990
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Reviewed-by: Brianna Goldstein <brgoldstein@google.com>
Cr-Commit-Position: refs/heads/main@{#1118897}
2023-03-17 21:53:28 +00:00
Jonathan Hao
c95bd09ee3 [Local Network Access] Rename private to local in client_security_state
In https://github.com/WICG/local-network-access/issues/91, we decided to
rename Private Network Access to Local Network Access. The spec has
already been renamed in
https://github.com/WICG/local-network-access/pull/97. The latest spec:
https://wicg.github.io/local-network-access/

This CL renames PrivateNetwork to LocalNetwork in
client_security_state.mojom and a few other places that stores private
network request policy.

There are so many places to rename, so during the process, there will
inevitably be inconsistencies. Hopefully, we shall resolve all of them
soon.

Bug: 1418287
Change-Id: I4fc26e7c044ecb808d090910aff74d4a163782b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4319985
Reviewed-by: Mike West <mkwst@chromium.org>
Commit-Queue: Jonathan Hao <phao@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1116302}
2023-03-13 10:58:11 +00:00
Titouan Rigoudy
e619b485a0 [Local Network Access] Rename c/b/r/private_network_access_util.*.
The contents of the file will be renamed later, to keep reviews simpler.

Bug: chromium:1418287
Change-Id: I3d95f81bbfde7ca3fadf02da2657cddeb3bf2218
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4324677
Auto-Submit: Titouan Rigoudy <titouan@chromium.org>
Commit-Queue: Camille Lamy <clamy@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1115686}
2023-03-10 14:22:31 +00:00
Yuzu Saijo
e4ac261f0e [bfcache] Send JavaScript location and function names
This CL changes the mojom function signature of DidChangeBackForwardCacheDisablingFeatures from using bitmask of features to using vectors of features + their JS locations.

Currently we are not using the JS information, but in a follow-up, we are going to save the information and start showing them on DevTools.

Features mask is no longer used, so will be removed in a separate follow-up.

Bug:1366675

Change-Id: I91b70719463e5080ac9498008aa784130d6103f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4240523
Commit-Queue: Yuzu Saijo <yuzus@chromium.org>
Reviewed-by: Fergal Daly <fergal@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1114977}
2023-03-09 06:28:53 +00:00
Jonathan Hao
96f0490c44 [Local Network Access] Rename local IP address space to loopback
In https://github.com/WICG/local-network-access/issues/91, we decided to
rename (public, private, local) IP address spaces to (public, local,
loopback). The spec has already been renamed in
https://github.com/WICG/local-network-access/pull/97.
New spec: https://wicg.github.io/local-network-access/#ip-address-space-heading

Since "local" appears in both the new and old definitions, we're going
to do this in two steps. Renaming "local" to "loopback" first so the
compiler can verify that we've renamed everything.

There are so many places to rename, so during the process, there will
inevitably be inconsistencies. Hopefully, we shall resolve all of them
soon.

Bug: 1418287
Change-Id: I55120b292b33f218ee1f37fbb9600606a509ea92
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4306714
Reviewed-by: Colin Blundell <blundell@chromium.org>
Commit-Queue: Jonathan Hao <phao@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1114462}
2023-03-08 10:48:31 +00:00
Chase Phillips
c1a9f644f4 content: Move WebExposedIsolationLevel to its own public header
This allows other classes, specifically RenderProcessHost, to implement
functions that return a WebExposedIsolationLevel.

Bug: 1233993, b/270457429
Change-Id: I8d502c0c1ab2f4f9f3dd4c90819c8433a994fbb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4285322
Commit-Queue: Chase Phillips <cmp@chromium.org>
Owners-Override: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Ovidio Ruiz-Henríquez <odejesush@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1109895}
2023-02-25 00:04:55 +00:00
Titouan Rigoudy
15de6a4b00 [Policy Container] Fix secure context bit in SharedWorkerHost.
This fix is a no-op, because the only use of the policy container host
created in SharedWorkerHost::Start() is to populate a policy container
for Blink. The Blink policy container mojom struct [1] does not contain
a corresponding field for `is_web_secure_context`, thus the field is
unread.

[1] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/public/mojom/frame/policy_container.mojom;l=17;drc=aa7a055dbf5242e60463b96fb6069e998088d57b

Fixed: chromium:1410095
Change-Id: Ia61e2623cfca25cd6beda5240728587b5ae44d4b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4281497
Auto-Submit: Titouan Rigoudy <titouan@chromium.org>
Commit-Queue: Titouan Rigoudy <titouan@chromium.org>
Reviewed-by: Jonathan Hao <phao@chromium.org>
Reviewed-by: Ben Kelly <wanderview@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1109067}
2023-02-23 18:28:16 +00:00
Ari Chivukula
d9e9c3883a [StorageKey Cleanup] (3) Rename CreateWithNonce constructors
There's a need to keep StorageKey and BlinkStorageKey partial sync, but
as each organically grew this has gotten lost. As we wrap up and launch
storage partitioning, we should leave this code in a good state.

This CL migrates production StorageKey creation to use the re-named
CreateWithNonce function. There's no reason for this to be test only as
it allows simplification of the construction path.

This CL is part of a series:
(1) Organize public functions and map work
(2) Rename CreateFirstParty constructors
(3) Rename CreateWithNonce constructors
(4) Rename Create constructors
(5) Remove old test constructors
(6) Define opaque origin behavior

Bug: 1410254
Change-Id: Ibf7a1d5c6c3477dd18b1221e767cb9d1971f8c0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4252060
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Steven Bingler <bingler@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1105940}
2023-02-15 23:30:09 +00:00
Ari Chivukula
c81e13e937 [StorageKey Cleanup] (2) Rename CreateFirstParty constructors
FOR REVIEWERS - This is a large CL, sorry about that. Please review just
the files you're an owner for. In almost all cases, the changes should
be minimal and straightforward.

There's a need to keep StorageKey and BlinkStorageKey partial sync, but
as each organically grew this has gotten lost. As we wrap up and launch
storage partitioning, we should leave this code in a good state.

This CL swaps out the origin constructor for a new static function
called CreateFirstParty. The reason for this is to ensure callsites know
that they are explicitly creating a first-party only StorageKey and
might be missing context important to partition storage. Further, if in
the future we were to want to deprecate this construction method in
prod, we would need a static function we could re-name like this
and so migrating to this style of syntax will make that easier.

This CL is part of a series:
(1) Organize public functions and map work
(2) Rename CreateFirstParty constructors
(3) Rename CreateWithNonce constructors
(4) Rename Create constructors
(5) Remove old test constructors
(6) Define opaque origin behavior

Bug: 1410254
Change-Id: I0be1305f91a454484c68d0faf4015bad3afe05ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4251237
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Steven Bingler <bingler@chromium.org>
Auto-Submit: Ari Chivukula <arichiv@chromium.org>
Commit-Queue: Ari Chivukula <arichiv@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1105850}
2023-02-15 20:44:57 +00:00
Chris Thompson
824cb37a0d Revamp HTTPS-First Mode fallback mechanism
This CL changes how HTTPS-First Mode and HTTPS Upgrades trigger a
fallback navigation to HTTP. Before this change, the NavigationThrottle
would cancel the failed navigation and post an async task to start a
new navigation to the fallback URL. This generally worked, but had
(at least) three issues: (1) this could cause "double counting" of
navigations, (2) it's hard to create a new navigation out of an old one
without missing important parameters (and maintain that over time), and
(3) it's possible for race conditions to occur on the frame being
navigated.

To avoid these issues, this CL changes the fallback mechanism to
instead intercept the failing navigation via
NavigationLoaderInterceptor::MaybeCreateLoaderForResponse() to serve an
artificial redirect back to the fallback URL directly, as part of the
same overall navigation. This means no new navigation is created
(avoiding double counting), no state is lost on the navigation (it's
just like the site itself served a downgrade redirect), and there is
no period where one navigation is canceled and another is not yet
created in which races could occur.

As the HTTPS-First Mode/HTTPS Upgrades logic is currently implemented
in chrome/, this exposes the MaybeCreateLoaderForResponse() API on
URLLoaderRequestInterceptor and adds an implementation to
HttpsUpgradesInterceptor. As a result, a lot of the logic from
HttpsUpgradesNavigationThrottle moves into HttpsUpgradesInterceptor.

The SetNavigationTimeout() implementation also needs to be modified to
trigger NavigationURLLoaderImpl::OnComplete() rather than
NotifyRequestFailed(), as the latter skips directly to the failure
state and does not trigger the interceptor's
MaybeCreateLoaderForResponse().

There are still known issues with how the new fallback implementation
interacts with (1) redirect loops and (2) tracking fallback state
across navigations. The first can result in briefly seeing a network
error for TOO_MANY_REDIRECTS before the HTTPS-First Mode interstitial
is triggered. The second can result in an incorrect security state
being computed for a tab where a fallback to HTTP had previously
occurred. Fixes for these issues will be handled in followup CLs.

Bug: 1394910
Change-Id: Ib53c8f873a30e6b2ebb933ae527a5c7f5fcd9bcd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4199590
Commit-Queue: Chris Thompson <cthomp@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1105469}
2023-02-15 03:10:14 +00:00
Brian Begnoche
9a24ae5b6e Define ThirdPartyCookiesUserBypass runtime feature and plumb it through to URLRequest.cookie_setting_overrides.
This is an intermediate step as part of the changes planned in go/user-bypass-3pcd.

Bug: 1386190
Change-Id: I930fd1ff5cbf124b0629735e7abcbbde45e728b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4067682
Commit-Queue: Brian Begnoche <bcb@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1100547}
2023-02-02 19:04:15 +00:00
Titouan Rigoudy
4fedcac71e [Private Network Access] Refactor policy derivation.
This change attempts to clarify the computation inside
`DerivePrivateNetworkRequestPolicy()` by introducing a new
`FeatureState` enum representing the state of feature flags for each
request context.

At the same time, this lays the foundation to more easily add new
request contexts: firstly iframes in crrev.com/c/3945088.

In doing so, it moves checks the `kPrivateNetworkAccessForWorkers`
feature flag into `DerivePrivateNetworkRequestPolicy()`.

Then, instead of passing `nullptr` `ClientSecurityState` parameters to
worker-related URL loader factories when the feature is disabled, it
passes a valid `ClientSecurityState` with its private network request
policy set to `kAllow`. This should not be web-observable.

This change does have a web-observable effect when PNA for workers is
disabled (which might happen again if we roll back warnings): we now
set the correct private network request policy for service worker
contexts. This correctly disables PNA preflights for fetches from
within service workers when PNA for workers is disabled.

Bug: chromium:1170335
Fixed: chromium:1410740, chromium:1374286
Change-Id: Ic81622a3891daa5bbba6f965be20e90c10cdb084
Fixed: chromium:1374286
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4173994
Reviewed-by: Jonathan Hao <phao@chromium.org>
Commit-Queue: Titouan Rigoudy <titouan@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1100544}
2023-02-02 19:02:18 +00:00