Skip to content

Commit 77a48cf

Browse files
kojiishichromium-wpt-export-bot
authored andcommitted
[iframe] Support allowed-origins attribute
This patch support the `allowed-origins` attribute of the `<meta>` element for responsively-sized iframes. The addition of this attribute is discussed with the security team, and is currently being discussed at WHATWG[1]. This attribute has the same syntax as CSP `frame-ancestors`, and that it reuses the underlying logic. It restricts the effect of `responsive-embedded-sizing` meta tag by the origin of the container. All the changes are under an experimental runtime flag. [1]: whatwg/html#12444 (comment) Bug: 418397278 Change-Id: I2af4c4d4e80e1a3efb8b52ad512f1493157d01b8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8084061 Reviewed-by: Kent Tamura <tkent@chromium.org> Commit-Queue: Koji Ishii <kojii@chromium.org> Auto-Submit: Koji Ishii <kojii@chromium.org> Cr-Commit-Position: refs/heads/main@{#1663715}
1 parent f0b30d6 commit 77a48cf

19 files changed

Lines changed: 147 additions & 14 deletions

css/css-sizing/responsive-iframe/resources/iframe-contents-400x200root.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
box-sizing: border-box;
1111
}
1212
</style>
13-
<meta name="responsive-embedded-sizing">
13+
<meta name="responsive-embedded-sizing" allowed-origins="*">
1414
</head>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!doctype HTML>
2+
<head>
3+
<style>
4+
* { margin: 0 }
5+
</style>
6+
<meta name="responsive-embedded-sizing">
7+
</head>
8+
<div style="width: 100px; height: 400px"></div>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<!doctype HTML>
2+
<head>
3+
<style>
4+
* { margin: 0 }
5+
</style>
6+
<meta name="responsive-embedded-sizing" allowed-origins="{{GET[allowed]}}">
7+
</head>
8+
<div style="width: 100px; height: 400px"></div>

css/css-sizing/responsive-iframe/resources/iframe-contents-dom-content-loaded.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
box-sizing: border-box;
99
}
1010
</style>
11-
<meta name="responsive-embedded-sizing">
11+
<meta name="responsive-embedded-sizing" allowed-origins="*">
1212
</head>
1313
<div id="target" style="width: 100px">
1414
<img src="slow-image.py?name=1x1-navy.png" width="1" height="1">

css/css-sizing/responsive-iframe/resources/iframe-contents-icb.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
box-sizing: border-box;
1313
}
1414
</style>
15-
<meta name="responsive-embedded-sizing">
15+
<meta name="responsive-embedded-sizing" allowed-origins="*">
1616
<div id="target"></div>
1717
<script>
1818
window.addEventListener('message', e => {

css/css-sizing/responsive-iframe/resources/iframe-contents-meta-after-head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
before `body`, should be inserted to the `head` element.
1010
https://html.spec.whatwg.org/multipage/parsing.html#the-after-head-insertion-mode
1111
-->
12-
<meta name="responsive-embedded-sizing">
12+
<meta name="responsive-embedded-sizing" allowed-origins="*">
1313
<body>
1414
<div style="width: 100px; height: 400px"></div>
1515
</body>

css/css-sizing/responsive-iframe/resources/iframe-contents-meta-dynamic-append-after-body.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<script>
99
const meta = document.createElement('meta');
1010
meta.name = "responsive-embedded-sizing";
11+
meta.setAttribute('allowed-origins', '*');
1112
document.head.appendChild(meta);
1213
</script>
1314
<div style="width: 100px; height: 400px"></div>

css/css-sizing/responsive-iframe/resources/iframe-contents-meta-dynamic-append-to-doc.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<script>
77
const meta = document.createElement('meta');
88
meta.name = "responsive-embedded-sizing";
9+
meta.setAttribute('allowed-origins', '*');
910
document.documentElement.appendChild(meta);
1011
</script>
1112
</head>

css/css-sizing/responsive-iframe/resources/iframe-contents-meta-dynamic-append.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<script>
77
const meta = document.createElement('meta');
88
meta.name = "responsive-embedded-sizing";
9+
meta.setAttribute('allowed-origins', '*');
910
document.head.appendChild(meta);
1011
</script>
1112
</head>

css/css-sizing/responsive-iframe/resources/iframe-contents-meta-dynamic-name-change-after-body.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<style>
44
* { margin: 0 }
55
</style>
6-
<meta name="name">
6+
<meta name="name" allowed-origins="*">
77
</head>
88
<body>
99
<script>

0 commit comments

Comments
 (0)