-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split the subresource-loading explainer into the core part and the ex… (
#645) * Split the subresource-loading explainer into the core part and the extension part (#623 #641) This is the almost mechanical *refactoring*, splitting the subresource-loading explainer into the core part and the extension part. The related issues are #624 and #641. In a follow-up PR, we might want to refine the core part so that we can write extension parts more easily, such as having well-defined terminologies and hook points.
- Loading branch information
Showing
2 changed files
with
122 additions
and
26 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
explainers/subresource-loading-opaque-origin-iframes.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Subresource loading with Web Bundles: Support opaque origin iframes | ||
|
||
Last updated: Apr 2021 | ||
|
||
This is an extension to [Subresource loading with Web Bundles]. This extension | ||
allows a bundle to include `urn:uuid:` URL resources, which will be used to | ||
create an opaque origin iframe. | ||
|
||
## Goals | ||
|
||
Support the use case of | ||
[WebBundles for Ad Serving](https://github.com/WICG/webpackage/issues/624). | ||
|
||
## Extension to [Subresource loading with Web Bundles] | ||
|
||
In this section, _the explainer_ means the [Subresource loading with Web | ||
Bundles] explainer. | ||
|
||
### Allow `urn:uuid:` resources | ||
|
||
In addition to the same origin subresource explained in the | ||
[`<link>`-based API](https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md#link-based-api) | ||
section in the explainer, this extension allows a bundle to include a | ||
[`urn:uuid:`](https://tools.ietf.org/html/rfc4122) URL subresource. | ||
|
||
### Opaque origin iframes | ||
|
||
If a `<iframe>`'s `src` attribute is a `urn:uuid:` URL subresource in the | ||
bundle, the iframe must be instantiated as an | ||
[opaque origin](https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque) | ||
iframe. | ||
|
||
## Example | ||
|
||
### The bundle | ||
|
||
Suppose that the bundle, `subresources.wbn`, includes the following resources: | ||
|
||
``` | ||
- urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6 | ||
- … (omitted) | ||
``` | ||
|
||
### The main document | ||
|
||
```html | ||
<link | ||
rel="webbundle" | ||
href="https://example.com/dir/subresources.wbn" | ||
resources="urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6" | ||
/> | ||
|
||
<iframe src="urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6"></iframe> | ||
``` | ||
|
||
`urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6` is loaded from the bundle, and a | ||
subframe is instantiated as an | ||
[opaque origin](https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque) | ||
iframe. | ||
|
||
Note: | ||
|
||
- `urn:uuid:` resource must be explicitly specified in `resources` attribute in | ||
`<link>` elements, similar to other subresources. `scopes` attribute can be | ||
also used for `urn:uuid:` resources. For example, `scopes=urn:` allows all | ||
`urn:` resources. | ||
|
||
### Content Security Policy (CSP) | ||
|
||
To allow `urn:uuid` resources in CSP, the `urn:` scheme must be explicitly | ||
specified. "`*`" source expression does not match `urn:uuid` resources according | ||
to the CSP's | ||
[matching rule](https://w3c.github.io/webappsec-csp/#match-url-to-source-expression). | ||
|
||
For example, given this CSP header, | ||
|
||
``` | ||
Content-Security-Policy: script-src https://example.com/script/ urn:; frame-src * | ||
``` | ||
|
||
In the following, the first and third `<script>` will be loaded, and the second | ||
`<script>` and the `<iframe>` will be blocked: | ||
|
||
``` | ||
<link rel="webbundle" | ||
href="https://example.com/subresources.wbn" | ||
resources="https://example.com/script/a.js | ||
https://example.com/b.js | ||
urn:uuid:429fcc4e-0696-4bad-b099-ee9175f023ae | ||
urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6" | ||
/> | ||
<script src=”https://example.com/script/a.js”></script> | ||
<script src=”https://example.com/b.js”></script> | ||
<script src=”urn:uuid:429fcc4e-0696-4bad-b099-ee9175f023ae”></script> | ||
<iframe src="urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6"></iframe> | ||
``` | ||
|
||
[subresource loading with web bundles]: | ||
https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md |
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