Bug 1681454 [wpt PR 26814] - Enable subframe navigation to urn:uuid resources in Web Bundles, a=testonly

Automatic update from web-platform-tests
Enable subframe navigation to urn:uuid resources in Web Bundles

This implements subframe loading with Web Bundles. Design doc:
https://docs.google.com/document/d/1_AqUBS4Gr45MPPtXGTUl7Q0DMIEw2zUeWO0zo6Sj0z4/edit#heading=h.aay60dv2vzua

blink::FrameLoader::StartNavigation attaches a WebBundleToken to the
request. It is propagated to the (new) web_bundle_token field of
mojom::BeginNavigationParams, and used to construct a navigation request
in NavigationURLLoaderImpl.

Created subframes have opaque-origins, and are hosted by a process for
the Bundle's origin. To achieve these, this CL:

- Adds |origin| field to content::UrlInfo
- For navigation to a urn: URL,
  - SiteInstanceImpl::GetSiteForURLInternal() uses the Bundle's origin
  - NavigationRequest::GetOriginForURLLoaderFactory() returns an opaque
    origin derived from the bundle's origin

Bug: 1082020
Change-Id: I07e03cce9f7da7eb6fd9d4218cf31882585b8463
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2543726
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Reviewed-by: Aaron Colwell <acolwell@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Hayato Ito <hayato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#849014}

--

wpt-commits: 858d8eea637878df26f837fa9b0f2dfa248380ab
wpt-pr: 26814
This commit is contained in:
Kunihiko Sakamoto
2021-02-02 09:19:10 +00:00
committed by moz-wptsync-bot
parent 5247cae13b
commit a1624ef404
3 changed files with 54 additions and 0 deletions

View File

@@ -19,6 +19,25 @@
"text": "window.report_result('OK');"
}
}
},
{
"request": {
"method": "GET",
"url": "urn:uuid:429fcc4e-0696-4bad-b099-ee9175f023ae",
"headers": []
},
"response": {
"status": 200,
"headers": [
{
"name": "Content-type",
"value": "text/html"
}
],
"content": {
"text": "<script> window.parent.postMessage('subframe loaded from WBN: location = ' + location.href, '*'); </script>"
}
}
}
]
}

View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<title>Subframe loading from Web Bundles</title>
<link
rel="help"
href="https://github.com/WICG/webpackage/blob/master/explainers/subresource-loading.md"
/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
promise_test(async () => {
const frame_url = 'urn:uuid:429fcc4e-0696-4bad-b099-ee9175f023ae';
const link = document.createElement('link');
link.rel = 'webbundle';
link.href = '../resources/wbn/urn-uuid.wbn';
link.resources = frame_url;
document.body.appendChild(link);
const message_promisse = new Promise((resolve) => {
window.addEventListener('message', (e) => {
resolve(e.data);
});
});
const iframe = document.createElement('iframe');
iframe.src = frame_url;
document.body.appendChild(iframe);
assert_equals(
await message_promisse,
'subframe loaded from WBN: location = ' + frame_url);
document.body.removeChild(link);
document.body.removeChild(iframe);
}, "Subframe load from Web Bundle");
</script>
</body>