Bug 1526603 [wpt PR 15234] - Add support for freezing iframes, a=testonly

Automatic update from web-platform-tests
Add support for freezing iframes

Frames that aren't loading are not visible in the viewport will be frozen
if  --enable-features=FreezeFrames is provided. This will eventually be
converted to testing feature policies for frames.

BUG=907125

Change-Id: Ib0badb3f92df4ce4921dd4a4cb29c45749f64f47
Reviewed-on: https://chromium-review.googlesource.com/c/1450406
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629822}

--

wpt-commits: d31a2f38a2c7159a88ca190cde7826b91299c64f
wpt-pr: 15234
This commit is contained in:
Dave Tapuska 2019-02-18 19:25:29 +00:00 коммит произвёл James Graham
Родитель fe78d18d08
Коммит 5a49cd06da
2 изменённых файлов: 51 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,35 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Child frame marked as frozen</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
async_test((t) => {
var child = document.createElement('iframe');
var loaded = false;
var frozen = false;
window.addEventListener('message', t.step_func((e) => {
if (e.data == "load") {
loaded = true;
} else if (e.data == "freeze") {
assert_true(loaded);
frozen = true;
child.style = "display: block";
} else if (e.data == "resume") {
assert_true(loaded);
assert_true(frozen);
t.done();
}
}));
child.src = "resources/subframe.html";
document.body.appendChild(child);
child.style = "display: none";
}, "Child frame frozen");
</script>
</body>

Просмотреть файл

@ -0,0 +1,16 @@
<!DOCTYPE html>
<meta charset="utf-8">
<script>
window.addEventListener('load', () => {
window.parent.postMessage('load');
});
document.addEventListener('freeze', () => {
window.parent.postMessage('freeze');
});
document.addEventListener('resume', () => {
window.parent.postMessage('resume');
});
</script>