This changes instances of `b ? "true" : "false"` to use `base::ToString(b)`
instead. It's a followup to previous changes to address things that were missed
or regressed in the meantime.
This change applies to the following directories: content
This CL was uploaded by an experimental version of git cl split
(https://crbug.com/389069356).
R=creis@chromium.org
Bug: 335797528
Change-Id: I4d4ec7cd9e8c13d09c91637bca88de27bb637842
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6318187
Auto-Submit: Devon Loehr <dloehr@google.com>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1427485}
The network service needs access to the permissions policy. Previous CLs
moved all the dependencies so it is now safe to move this class.
The following files need to include permissions_policy.h because
otherwise they want to have access into incomplete `PermissionsPolicy`:
* components/permissions/permission_uma_util.cc
* third_party/blink/common/manifest/manifest_util.cc
* third_party/blink/renderer/core/html/client_hints_util.cc
* third_party/blink/renderer/modules/payments/payment_app_service_worker_registration.cc
* third_party/blink/renderer/modules/payments/payment_instruments.cc
Bug: 382291442
Low-Coverage-Reason: LARGE_SCALE_REFACTOR
Change-Id: Ifcf52df3bc5c035e8f6a45df02cf93f304b748c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6310821
Auto-Submit: Sandor «Alex» Major <sandormajor@chromium.org>
Owners-Override: Rick Byers <rbyers@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Reviewed-by: Ari Chivukula <arichiv@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1426391}
Why: This helps to see if there are long-running worklets, which can
impact performance or be exploited for side-channel attacks. If the
result reveals such instances, we will further add UKM to investigate
the specific use cases.
Given that the existing 'UsefulResourceDuration' represents a
percentage, we add 'AbsoluteUsefulResourceDuration' for a distinction.
Bug: 398173023
Change-Id: I8b69362158a35b0861033f8f58a0aa335edb4241
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6287655
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1423455}
This CL changes the histogram creation APIs to take a durable
string view (i.e., a pointer+size pair referring to memory that
the programmer has annotated that it will not be freed) instead
of just an implicit pointer. The HistogramBase class internally
represents the name's length and the histogram's flags using
16 bits in order to not grow the in-memory size of Histogram
objects. The name of the histogram is subsequently exposed by
HistogramBase as a string_view.
This CL updates consumers of the histogram name's to use a
string_view of the name. This removes many string length
calculations and string copy operations. For histograms
allocated in shared memory, it also avoids potential out-of-
bounds reads if the underlying string data is modified or
corrupted such that it no longer has a trailing NUL char
at the end of the string.
Lastly, this CL updates a number of call-sites where the
histogram names were being copied into short-lived string
objects for use as search keys into various containers to
perform the functionality without making any unnecessary
copies.
Low-Coverage-Reason: TRIVIAL_CHANGE Use of string_view instead of string/char* in some error/logging paths have low coverage.
AX-Relnotes: n/a
Bug: 393394360, 40818143
Change-Id: Iee9ee5ae62335b9e7815f4ae11bde4ff80cfd4a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6231451
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Antonio Rivera <antoniori@google.com>
Commit-Queue: Roger McFarlane <rogerm@chromium.org>
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1422750}
Why: this helps to understand web locks adoptions.
What:
- When a worklet is destroyed, record whether navigator.locks was
requested.
- When an update method is triggered (for individual method and for
batchUpdate() separately), record whether the 'withLock' option is
specified.
Bug: 373899210
Change-Id: I3ce97533345393c833b2861794bc52aad83573f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6277481
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1421614}
We plan to use the new class to support the new
`kPrivateAggregationApiErrorReporting` feature, which is currently
disabled by default (and not yet implemented). In this cl, the main
class is empty, with a TODO to implement the logic.
However, the nested Wrapper class is a fairly basic union type that
conditionally contains either the main class (if the error reporting
feature is enabled) or a vector of contributions (if the feature is
disabled). This cl also switches some plumbing to use this new Wrapper
class, which will simplify future implementation work. It also moves the
definition of ContributionMergeKey to the new class to reflect the new
class's intended (eventual) role.
This cl should be a no-op, given the disabled feature.
Bug: 381788013
Change-Id: I92e4dcebfa786e0327cd12c9104b4dbc9760dc1f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6079892
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Reviewed-by: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414416}
This is a behavior-preserving refactor.
This CL moves SharedStorageBrowserTestBase and
TestSharedStorageRuntimeManager out of the monolithic
shared_storage_browsertest.cc and into their own source files.
Bug: 392049826
Change-Id: Ibd9fb26c51f250284ed63d63ee210c39f061a656
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6216404
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414093}
This is a behavior-preserving refactor.
This CL starts the process of chipping away at our currently-monolithic
shared_storage_browsertest.cc by pulling out classes into their own
source files. It also fixes a number of missing includes.
Next, we can move TestSharedStorageRuntimeManager, after which we should
be able to move SharedStorageBrowserTestBase. Once the base class is
moved, we'll be ready to move thousands of lines of tests into
shared_storage_private_aggregation_browser_test.cc, which I expect will
have a noticeable impact on build times for anyone working on these
browser tests.
Bug: 392049826
Change-Id: Ibdef9d18d26778304a307d4c8b22f611cdcd1f90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6214056
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1414091}
This CL implements the Shared Storage side of Private Aggregation's
per-context limits feature, gated behind the blink feature flag
`kPrivateAggregationApiMaxContributions`, which is disabled by default.
Specifically, this CL makes the following changes:
* Adds a runtime-enabled `maxContributions` field to the
`SharedStoragePrivateAggregationConfig` IDL dictionary.
* Handles `maxContributions` in `CheckPrivateAggregationConfig()`.
Paired with the IDL change, this enables JS to set `maxContributions`.
* Adds browser test coverage. Primarily, we're testing that the field is
ignored when the feature is disabled, and that it actually affects the
number of contributions per report when the feature is enabled.
This CL contains no web-visible behavior changes.
Bug: 376707230
Change-Id: Icf883015af3cb00c8d72e1dc63114f2656b51b3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6175278
Reviewed-by: Dominic Farolino <dom@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1413558}
There is a console error posted when a selectURL call does not have
enough budget. Since this is an expected behavior and not indicative
of a problem with the page itself, this should be downgraded to kInfo.
Bug: 392828497
Change-Id: Id62715bf5de0c768a7f7a24fdcdf423943b476ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6206929
Reviewed-by: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Josh Karlin <jkarlin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412928}
This CL implements an optimization for per-context limits, which are
still gated by a feature and disabled by default.
We're making `ShouldSendReportDeterministically()` a little more clever,
with the goal of enabling Private Aggregation to send fewer null reports
without loss of privacy. Rather than requiring determinism whenever the
`std::optional<size_t> max_contributions` parameter has a value, we will
now additionally require that it would make the aggregatable report
stick out. This resembles the semantics of the `filtering_id_max_bytes`
parameter.
This CL should not contain any web-visible behavior changes, primarily
because none of the calling APIs have defined the `maxContributions`
field yet.
Bug: 376707230
Change-Id: Iee0d849170e728fd9cdc540daa83881ce96a21dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6183147
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1412280}
This CL takes the following steps towards implementing per-context
contribution limits:
* Adds `blink::features::kPrivateAggregationApiMaxContributions`,
disabled by default.
* Implements the Private Aggregation logic for the `maxContributions`
config field and adds unit tests.
* Hardcodes `maxContributions` as `std::nullopt` in Shared Storage and
Protected Audience.
This should not contain any web-visible behavior changes, primarily
because none of the calling APIs have defined the `maxContributions`
field yet.
Bug: 376707230
Change-Id: I0b065ab8fb2383ec502cd018e6e66862ebba1ba1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6172853
Reviewed-by: Mike Taylor <miketaylr@chromium.org>
Commit-Queue: Dan McArdle <dmcardle@chromium.org>
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1410414}
RFHI's permissions_policy() and GetPermissionsPolicy() are doing the
same thing, keeping the latter as that's exposed on the RFH as well.
Bug: 382291442
Change-Id: I846764815f6adb72c6906c59d6d6810e02a5d611
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6164805
Reviewed-by: Bo Liu <boliu@chromium.org>
Commit-Queue: Sandor «Alex» Major <sandormajor@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1404447}
In SharedStorageHeaderObserver::HeaderReceived(), switch to call
BatchUpdate() without a lock. The external behavior is the same with
calling individual Update() sequentially. Some testing components and
the callback parameters are updated accordingly (e.g., now, an
'operation' corresponds to the whole batch, rather than an individual
method).
This prepares for the upcoming change to introduce the batch options'
`with_lock` parameter.
Bug: 373899210
Change-Id: I4f82bf318ead5719382857a61c0c5af79352dbf9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6073263
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1392633}
This allows developers to perform multiple Shared Storage operations
atomically within a single lock, as part of the Web Lock integration
proposal:
- https://github.com/WICG/shared-storage/pull/199
- https://github.com/WICG/shared-storage/pull/205
How:
- Add `batchUpdate(methods, options)` to the `SharedStorage` interface.
- Hooks up the `batchUpdate()` method to the
`SharedStorageLockManager::SharedStorageBatchUpdate()` API in the
browser process.
Bug: 373899210
Fuchsia-Binary-Size: Size increase is unavoidable.
Change-Id: I0e1b355e3b3d28518396ae4333afe21e6d02e858
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6069087
Reviewed-by: Ayu Ishii <ayui@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1391933}
Implement the constructor for `SharedStorageSetMethod`, etc. The
error handling logic mirrors the existing sharedStorage.set(), etc.
To allow code reuse, the sharedStorage.set(), etc. methods
now creates the object and early return on exceptions.
Note that even though we no longer explicitly call resolver->Reject()
for sharedStorage.set(), etc., Chrome still converts thrown
exceptions to rejected promises (to adhere to the specification [1]),
so the end result is the same.
This prepares for the implementation of the
`sharedStorage.batchUpdate(methods)` method, as part of the Web Lock
integration proposal:
- https://github.com/WICG/shared-storage/pull/199
- https://github.com/WICG/shared-storage/pull/205
[1] https://w3ctag.github.io/promises-guide/#always-return-promises
Bug: 373899210
Change-Id: Ie4edfedbe755afeb3db5ca557fd74482bac96138
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6054694
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1390779}
Currently, addModule and createWorklet use the same code path in the
browser and are (mostly) indistinguishable there. In this CL, we send
an extra bit via mojom from the renderer to the browser so that
SharedStorageWorkletHost can definitively distinguish between worklets
that have been created using addModule and those created via
createWorklet. This is in preparation for updating our reports to
DevTools to distinguish between calls to addModule and calls to
createWorklet.
Bug: 381899615
Change-Id: Ice20558f1456fe860d698287c7445a07096de2f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6064024
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Reviewed-by: Yao Xiao <yaoxia@chromium.org>
Auto-Submit: Cammie Smith Barnes <cammie@chromium.org>
Commit-Queue: Cammie Smith Barnes <cammie@chromium.org>
Reviewed-by: Giovanni Ortuno Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1390665}
This prepares for the batchUpdate() Web API change.
Explainer PR(s):
- https://github.com/WICG/shared-storage/pull/199
- https://github.com/WICG/shared-storage/pull/205
How:
- The SharedStorageBatchUpdate method first acquires the batch-level
lock if requested (`with_lock` is present). Then, under the
batch-level lock, it handles each method with any necessary
individual lock. Finally, it releases the batch-level lock and
invokes `callback`.
- Note that the batch lock is released as soon as all methods are
posted to the database, whereas the callback is invoked only after
the database responses are available. This aligns with the
established pattern for `SharedStorageUpdate` (i.e., we only
have a single database task queue, so releasing the lock "sooner"
still produces the correct behavior, and has better performance).
Bug: 373899210
Change-Id: Iaf2c1ea50ac11c3dd57624ee44004c35ccf5ecbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6055330
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1390564}
Similar to what has been done for Window, SharedStorageWorklet, and
response headers, we add the `withLock` parameter parsing logic in the
PA worklet, and send the final request to the browser process's central
SharedStorageLockManager component.
We reuse AccessType::kWorkletSet, etc. for displaying events in
DevTools. Filed crbug.com/380291909 to further distinguish PA
worklet access from shared storage worklet access.
Bug: 373899210
Change-Id: Ia16d256167be5a43adba699c2c9b55a626f7b0e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6047561
Reviewed-by: Maks Orlovich <morlovich@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388539}
Explainer PR(s):
- https://github.com/WICG/shared-storage/pull/199
- https://github.com/WICG/shared-storage/pull/205
How:
- Add the parameter parsing logic in the network service, and send the
final request to the browser process's central
SharedStorageLockManager component.
- Since SharedStorageLockManager::SharedStorageUpdate() hides the
exact database result, we update observer's OnMethodFinished()'s
parameters accordingly. In the test observer, the error message is
further transformed into a boolean 'success' result. This callback
is only used in tests and it's not important to assert the detailed
result anyway.
- A new test, `SharedStorageHeaderObserverTest.Append_NoCapacity`,
has been added to demonstrate the case where `SharedStorageUpdate`
encounters an error.
Bug: 373899210
Change-Id: I4588c83174d465e7248cc1f41c9b7a693aa326f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6042601
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Commit-Queue: Yao Xiao <yaoxia@chromium.org>
Reviewed-by: Cammie Smith Barnes <cammie@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Joe Mason <joenotcharles@google.com>
Reviewed-by: Rakina Zata Amni <rakina@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1388298}