mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision bda2059150dca8ab47f088b4cc619fcdc1f262fa
This commit is contained in:
parent
3535f3f6c2
commit
7c4281f3da
182 changed files with 7692 additions and 1042 deletions
|
@ -0,0 +1,89 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Check how allowfullscreen affects fullscreen enabled flag</title>
|
||||
<link rel="author" title="Xidorn Quan" href="https://www.upsuper.org">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/browsers.html#initialise-the-document-object">
|
||||
<link rel="help" href="https://fullscreen.spec.whatwg.org/#fullscreen-enabled-flag">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
function test_allowfullscreen(t, setup_iframe) {
|
||||
var iframe = document.createElement("iframe");
|
||||
setup_iframe(iframe);
|
||||
iframe.src = "support/blank.htm";
|
||||
var eventWatcher = new EventWatcher(t, iframe, "load");
|
||||
document.body.appendChild(iframe);
|
||||
t.add_cleanup(function() {
|
||||
document.body.removeChild(iframe);
|
||||
});
|
||||
|
||||
assert_true(document.fullscreenEnabled, "Top level document has fullscreen enabled flag set");
|
||||
eventWatcher.wait_for("load").then(t.step_func(function() {
|
||||
assert_false(iframe.contentDocument.fullscreenEnabled, "Document inside iframe without allowfullscreen attribute should not have fullscreen enabled flag set");
|
||||
iframe.setAttribute("allowfullscreen", true);
|
||||
assert_false(iframe.contentDocument.fullscreenEnabled, "Setting allowfullscreen attribute after document load should not affect fullscreen enabled flag");
|
||||
iframe.contentWindow.location.reload();
|
||||
return eventWatcher.wait_for("load");
|
||||
})).then(t.step_func(function() {
|
||||
assert_true(iframe.contentDocument.fullscreenEnabled, "Fullscreen enabled flag should be set when a new document is loaded with allowfullscreen attribute present");
|
||||
iframe.removeAttribute("allowfullscreen");
|
||||
assert_true(iframe.contentDocument.fullscreenEnabled, "Removing allowfullscreen attribute should not affect fullscreen enabled flag");
|
||||
iframe.contentWindow.location.reload();
|
||||
return eventWatcher.wait_for("load");
|
||||
})).then(t.step_func_done(function() {
|
||||
assert_false(iframe.contentDocument.fullscreenEnabled, "Fullscreen enabled flag should be reset when a new document is loaded with allowfullscreen attribute absent");
|
||||
}));
|
||||
}
|
||||
|
||||
async_test(function(t) {
|
||||
test_allowfullscreen(t, function(iframe) {});
|
||||
}, "iframe-allowfullscreen");
|
||||
|
||||
async_test(function(t) {
|
||||
test_allowfullscreen(t, function(iframe) {
|
||||
iframe.setAttribute("sandbox", "allow-same-origin");
|
||||
});
|
||||
}, "iframe-sandbox-allowfullscreen");
|
||||
|
||||
function test_allowfullscreen_dialog(t, setup_iframe, check) {
|
||||
var iframe = document.createElement("iframe");
|
||||
setup_iframe(iframe);
|
||||
iframe.src = "support/blank.htm";
|
||||
var eventWatcher = new EventWatcher(t, iframe, "load");
|
||||
document.body.appendChild(iframe);
|
||||
t.add_cleanup(function() {
|
||||
document.body.removeChild(iframe);
|
||||
});
|
||||
|
||||
var newWin;
|
||||
assert_true(document.fullscreenEnabled, "Top level document has fullscreen enabled flag set");
|
||||
eventWatcher.wait_for("load").then(t.step_func(function() {
|
||||
assert_false(iframe.contentDocument.fullscreenEnabled, "Document inside iframe without allowfullscreen attribute should not have fullscreen enabled flag set");
|
||||
newWin = iframe.contentWindow.open("support/blank.htm");
|
||||
t.add_cleanup(function() {
|
||||
newWin.close();
|
||||
});
|
||||
var newWinEventWatcher = new EventWatcher(t, newWin, "load");
|
||||
return newWinEventWatcher.wait_for("load");
|
||||
})).then(t.step_func_done(function() {
|
||||
check(newWin);
|
||||
}));
|
||||
}
|
||||
|
||||
async_test(function(t) {
|
||||
test_allowfullscreen_dialog(t, function() {}, function(newWin) {
|
||||
assert_true(newWin.document.fullscreenEnabled, "Document in the new window is a top level document, thus should has fullscreen enabled flag set");
|
||||
});
|
||||
}, "iframe-allowfullscreen-dialog");
|
||||
|
||||
async_test(function(t) {
|
||||
test_allowfullscreen_dialog(t, function(iframe) {
|
||||
iframe.setAttribute("sandbox", "allow-same-origin allow-popups");
|
||||
}, function(newWin) {
|
||||
assert_false(newWin.document.fullscreenEnabled, "Document in the new window should inherit the sandboxed fullscreen flag and should not have fullscreen enabled flag set");
|
||||
});
|
||||
}, "iframe-sandbox-allowfullscreen-dialog");
|
||||
</script>
|
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Check that popups from a sandboxed iframe escape the sandbox if
|
||||
allow-popups-to-escape-sandbox is used</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<iframe sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox">
|
||||
</iframe>
|
||||
<script>
|
||||
var t = async_test();
|
||||
var ourOrigin;
|
||||
onmessage = t.step_func(function(e) {
|
||||
assert_equals(e.data, "hello", "This is our origin getter message");
|
||||
ourOrigin = e.origin;
|
||||
|
||||
onmessage = t.step_func_done(function(e) {
|
||||
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
|
||||
assert_equals(e.data.data, undefined, "Should have the right message");
|
||||
assert_equals(e.data.origin, ourOrigin, "Should have escaped the sandbox");
|
||||
});
|
||||
|
||||
document.querySelector("iframe").src = "iframe_sandbox_popups_helper.html";
|
||||
});
|
||||
postMessage("hello", "*");
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
var popupWin;
|
||||
if (opener) {
|
||||
// We're the popup. Send back our state. What we really want to send is
|
||||
// our origin, but that will come automatically.
|
||||
opener.postMessage(undefined, "*");
|
||||
self.close();
|
||||
} else {
|
||||
// We're the child. Start listening for messages and open ourselves as the
|
||||
// popup.
|
||||
onmessage = function (e) {
|
||||
parent.postMessage({ data: e.data, origin: e.origin }, "*");
|
||||
};
|
||||
popupWin = window.open(location.href);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,15 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Check that popups from a sandboxed iframe do not escape the sandbox</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
var t = async_test();
|
||||
onmessage = t.step_func_done(function(e) {
|
||||
assert_equals(e.origin, "null", "It came from a sandboxed iframe");
|
||||
assert_equals(e.data.data, undefined, "Should have the right message");
|
||||
assert_equals(e.data.origin, "null", "Should not have escaped the sandbox");
|
||||
});
|
||||
</script>
|
||||
<iframe sandbox="allow-scripts allow-popups"
|
||||
src="iframe_sandbox_popups_helper.html"></iframe>
|
|
@ -125,6 +125,8 @@
|
|||
<img srcset='/images/green-1x1.png?e107 50w, /images/green-16x16.png?e107 51w' sizes='not ((min-width:0) or (unknown "general-enclosed")) 100vw, 1px'>
|
||||
<img srcset='/images/green-1x1.png?e108 50w, /images/green-16x16.png?e108 51w' sizes='(max-width:0) or (unknown-general-enclosed !) 100vw, 1px'>
|
||||
<img srcset='/images/green-1x1.png?e109 50w, /images/green-16x16.png?e109 51w' sizes='not ((max-width:0) or (unknown "general-enclosed")) 100vw, 1px'>
|
||||
<img srcset='/images/green-1x1.png?f48 50w, /images/green-16x16.png?f48 51w' sizes='calc(1px'>
|
||||
<img srcset='/images/green-1x1.png?f49 50w, /images/green-16x16.png?f49 51w' sizes='(min-width:0) calc(1px'>
|
||||
|
||||
<p>
|
||||
<img srcset='/images/green-1x1.png?f1 50w, /images/green-16x16.png?f1 51w' sizes='100vw'>
|
||||
|
@ -174,5 +176,3 @@
|
|||
<img srcset='/images/green-1x1.png?f45 50w, /images/green-16x16.png?f45 51w' sizes='-1e0px'>
|
||||
<img srcset='/images/green-1x1.png?f46 50w, /images/green-16x16.png?f46 51w' sizes='1e1.5px'>
|
||||
<img srcset='/images/green-1x1.png?f47 50w, /images/green-16x16.png?f47 51w' style='--foo: 1px' sizes='var(--foo)'>
|
||||
<img srcset='/images/green-1x1.png?f48 50w, /images/green-16x16.png?f48 51w' sizes='calc(1px'>
|
||||
<img srcset='/images/green-1x1.png?f49 50w, /images/green-16x16.png?f49 51w' sizes='(min-width:0) calc(1px'>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue