Files
firefox/testing/web-platform/tests/shared-storage/shared-storage-writable-iframe-content-attribute.tentative.https.sub.html
Camillia Smith Barnes 0ee2d9cd7b Bug 1848934 [wpt PR 41486] - Shared Storage: Add iframe attribute for response header writes, a=testonly
Automatic update from web-platform-tests
Shared Storage: Add iframe attribute for response header writes

We include the previously added mixin interface
`HTMLSharedStorageWritableElementUtils` with boolean attribute
`sharedStorageWritable` in `HTMLIFrameElement`.

The value of the IDL attribute is plumbed to the new field
`blink::mojom::IframeAttributes::shared_storage_writable`, and then
`blink::mojom::LocalFrameHost::DidChangeIframeAttributes()` notifies `FrameTreeNode` the attribute value is parsed or changes.

We add infra to `NavigationRequest` and `NavigationRequestInfo` to
check PermissionsPolicy and plumb the writable value to
`network::ResourceRequest`.

Since the `URLLoaderNetworkContext::Type` for iframe navigations is
`URLLoaderNetworkContext::Type::kServiceWorkerContext` (https://source.chromium.org/chromium/chromium/src/+/refs/heads/main:content/browser/storage_partition_impl.cc;drc=b27071598a6b291a7319d99ce7aa4af81ebc060f;l=3329), we have to use a workaround to send a
`RenderFrameHost` to `SharedStorageHeaderObserver::HeaderReceived()`.

Hence we add
`network::ResourceRequest::TrustedParams::shared_storage_writable_id`, which in the case of (eligible) iframe navigations will be the
existing `NavigationRequest::navigation_id_`, and otherwise -1. This
long integer is sent over mojom and can thus be sent back again via
`URLLoaderNetworkServiceObserver::OnSharedStorageHeaderReceived()` in
order to identify and defer a header's operations, which will then be
looked up by id and invoked on iframe commit.

This is part of a project to add support to writing to shared storage
from response headers. See
https://github.com/WICG/shared-storage/pull/70 for more information
and https://crrev.com/c/4691573 for a prototype for adding image and
iframe attributes.

Browser tests are added in https://crrev.com/c/4718688.

Bug: 1434529,1218540
Change-Id: I290a8e06cf4824845e12421bbd34906f9399b25f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4717613
Reviewed-by: Eric Orth <[email protected]>
Reviewed-by: Nasko Oskov <[email protected]>
Reviewed-by: Yao Xiao <[email protected]>
Commit-Queue: Cammie Smith Barnes <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1187498}

--

wpt-commits: d1202c3cafa1fa7b17742cdd479175e0deda3cb9
wpt-pr: 41486
2023-09-13 11:37:19 +00:00

23 lines
1.2 KiB
HTML

<!doctype html>
<body>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/common/utils.js></script>
<script src=/fenced-frame/resources/utils.js></script>
<script src=/shared-storage/resources/util.js></script>
<iframe src="/shared-storage/resources/shared-storage-write-notify-parent.py?write=set%3Bkey%3Dhello%3Bvalue%3Dworld" sharedstoragewritable></iframe>
<iframe src="/shared-storage/resources/shared-storage-write-notify-parent.py?write=set%3Bkey%3Dwont%3Bvalue%3Dset"></iframe>
<iframe src="/shared-storage/resources/shared-storage-write-notify-parent.py?write=set%3Bkey%3Dgoodnight%3Bvalue%3Dmoon" sharedstoragewritable></iframe>
<script>
const sameOrigin = new URL("", location.href).origin;
promise_test(async t => {
await verifyKeyValueForOrigin('hello', 'world', sameOrigin);
await verifyKeyNotFoundForOrigin('wont', sameOrigin);
await verifyKeyValueForOrigin('goodnight', 'moon', sameOrigin);
await deleteKeyForOrigin('hello', sameOrigin);
await deleteKeyForOrigin('goodnight', sameOrigin);
}, 'test <iframe sharedstoragewritable src=[url]> for same origin iframe');
</script>
</body>