mirror of
https://github.com/servo/servo.git
synced 2025-08-24 14:48:21 +01:00
Update web-platform-tests to revision 8a2ceb5f18911302b7a5c1cd2791f4ab50ad4326
This commit is contained in:
parent
462c272380
commit
1f531f66ea
5377 changed files with 174916 additions and 84369 deletions
|
@ -15,12 +15,20 @@ async_test(t => {
|
|||
assert_equals(document.fullscreenElement, outer);
|
||||
|
||||
// Then request fullscreen for the inner element.
|
||||
trusted_request(t, inner);
|
||||
trusted_click(t, t.step_func(() => {
|
||||
inner.requestFullscreen();
|
||||
// Even though we are already in fullscreen, the change in
|
||||
// document.fullscreenElement should not happen synchronously.
|
||||
assert_equals(document.fullscreenElement, outer);
|
||||
}), outer);
|
||||
document.onfullscreenchange = t.step_func(() => {
|
||||
assert_equals(document.fullscreenElement, inner);
|
||||
|
||||
// Now exit fullscreen.
|
||||
document.exitFullscreen();
|
||||
// Even though we don't need to exit fullscreen, the change in
|
||||
// document.fullscreenElement should not happen synchronously.
|
||||
assert_equals(document.fullscreenElement, inner);
|
||||
document.onfullscreenchange = t.step_func_done(() => {
|
||||
assert_equals(document.fullscreenElement, outer);
|
||||
});
|
||||
|
|
|
@ -19,6 +19,8 @@ async_test(t => {
|
|||
// The resize event should fire before the fullscreenchange event.
|
||||
const events = [];
|
||||
const callback = t.step_func(event => {
|
||||
// fullscreenElement should have changed before either event is fired.
|
||||
assert_equals(document.fullscreenElement, null, `fullscreenElement in {event.type} event`);
|
||||
events.push(event.type);
|
||||
if (event.type == 'fullscreenchange') {
|
||||
step_timeout(t.unreached_func('timer callback'));
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Document#fullscreenEnabled</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<iframe src="resources/report-fullscreen-enabled.html" name="same-origin-default"></iframe>
|
||||
<iframe src="resources/report-fullscreen-enabled.html" allowfullscreen name="same-origin-allow"></iframe>
|
||||
<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resources/report-fullscreen-enabled.html" name="cross-origin-default"></iframe>
|
||||
<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resources/report-fullscreen-enabled.html" allowfullscreen name="cross-origin-allow"></iframe>
|
||||
<script>
|
||||
var expectations = {
|
||||
"same-origin-default": false,
|
||||
"same-origin-allow": true,
|
||||
"cross-origin-default": false,
|
||||
"cross-origin-allow": true
|
||||
};
|
||||
|
||||
var tests = {};
|
||||
for (var name in expectations) {
|
||||
tests[name] = async_test( 'Fullscreen enabled test: ' + name);
|
||||
}
|
||||
|
||||
// When a message is received from a child frame, ensure that the report
|
||||
// matches the expectations.
|
||||
window.addEventListener('message', e => {
|
||||
if (e.data.report && e.data.report.api == "fullscreen") {
|
||||
if (e.data.report.frame in expectations) {
|
||||
tests[e.data.report.frame].step(() => {
|
||||
assert_equals(e.data.report.enabled, expectations[e.data.report.frame],
|
||||
e.data.report.frame + " frame fullscreenEnabled");
|
||||
});
|
||||
delete expectations[e.data.report.frame];
|
||||
tests[e.data.report.frame].done();
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Element ready check with allowfullscreen attribute</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../trusted-click.js"></script>
|
||||
<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resources/attempt-fullscreen.html" name="cross-origin-allowed" allowfullscreen></iframe>
|
||||
<script>
|
||||
|
||||
async_test((t) => {
|
||||
t.add_cleanup(() => document.exitFullscreen());
|
||||
|
||||
// When a message is received from a child frame, ensure that the report
|
||||
// matches the expectations.
|
||||
window.addEventListener('message', t.step_func(e => {
|
||||
if (e.data.report && e.data.report.api == "fullscreen") {
|
||||
assert_equals(e.data.report.result, true,
|
||||
e.data.report.frame + " frame did enter fullscreen");
|
||||
t.done();
|
||||
}
|
||||
}));
|
||||
|
||||
// Trigger the child frame to report as soon as its content is loaded.
|
||||
var elem = document.querySelector('iframe');
|
||||
elem.addEventListener('load', () => {
|
||||
trusted_click(t, () => {
|
||||
elem.contentWindow.postMessage({"action": "report"}, "*");
|
||||
}, document.body);
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,31 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Element ready check with no allowfullscreen attribute</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../trusted-click.js"></script>
|
||||
<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resources/attempt-fullscreen.html" name="cross-origin-default"></iframe>
|
||||
<script>
|
||||
|
||||
async_test((t) => {
|
||||
document.onfullscreenchange = t.unreached_func("document fullscreenchange event");
|
||||
document.onfullscreenerror = t.unreached_func("document fullscreenerror event");
|
||||
|
||||
// When a message is received from a child frame, ensure that the report
|
||||
// matches the expectations.
|
||||
window.addEventListener('message', t.step_func(e => {
|
||||
if (e.data.report && e.data.report.api == "fullscreen") {
|
||||
assert_equals(e.data.report.result, false,
|
||||
e.data.report.frame + " frame did enter fullscreen");
|
||||
t.done();
|
||||
}
|
||||
}));
|
||||
|
||||
// Trigger the child frame to report as soon as its content is loaded.
|
||||
var elem = document.querySelector('iframe');
|
||||
elem.addEventListener('load', () => {
|
||||
trusted_click(t, () => {
|
||||
elem.contentWindow.postMessage({"action": "report"}, "*");
|
||||
}, document.body);
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -15,8 +15,12 @@ async_test(t => {
|
|||
document.onfullscreenchange = iframeDoc.onfullscreenchange = t.step_func(event => {
|
||||
count++;
|
||||
assert_between_inclusive(count, 1, 4, 'number of fullscreenchange events');
|
||||
// Both when entering and exiting, the fullscreenchange event is fired first
|
||||
// on the outer document and then on the iframe's document. This is because
|
||||
// the events are fired in animation frame tasks, which run in "frame tree"
|
||||
// order.
|
||||
const expected = {
|
||||
target: count == 1 || count == 4 ? iframe : iframeBody,
|
||||
target: count == 1 || count == 3 ? iframe : iframeBody,
|
||||
outerFullscreenElement: count <= 2 ? iframe : null,
|
||||
innerFullscreenElement: count <= 2 ? iframeBody : null,
|
||||
};
|
||||
|
|
|
@ -15,7 +15,7 @@ async_test(t => {
|
|||
assert_equals(document.fullscreenElement, target);
|
||||
assert_equals(target.parentNode, moveTo);
|
||||
});
|
||||
document.onfullscreenerror = t.unreached_func("fullscreenchange event");
|
||||
document.onfullscreenerror = t.unreached_func("fullscreenerror event");
|
||||
|
||||
trusted_click(t, () => {
|
||||
target.requestFullscreen();
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Element#requestFullscreen() for dialog element</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../trusted-click.js"></script>
|
||||
<div id="log"></div>
|
||||
<dialog></dialog>
|
||||
<script>
|
||||
async_test(t => {
|
||||
var dialog = document.querySelector("dialog");
|
||||
assert_true(dialog instanceof HTMLDialogElement);
|
||||
trusted_request(t, dialog);
|
||||
document.onfullscreenchange = t.unreached_func("fullscreenchange event");
|
||||
document.onfullscreenerror = t.step_func_done();
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Element#requestFullscreen() for an element in null namespace</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../trusted-click.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
const element = document.createElementNS(null, 'a');
|
||||
assert_equals(Object.getPrototypeOf(element), Element.prototype);
|
||||
document.body.appendChild(element);
|
||||
trusted_request(t, element);
|
||||
document.onfullscreenchange = t.unreached_func("fullscreenchange event");
|
||||
document.onfullscreenerror = t.step_func_done();
|
||||
});
|
||||
</script>
|
|
@ -11,7 +11,7 @@ async_test(function(t)
|
|||
var rect = document.querySelector("rect");
|
||||
assert_true(rect instanceof SVGRectElement);
|
||||
trusted_request(t, rect, document.body);
|
||||
document.onfullscreenchange = t.unreached_func("fullscreenerror event");
|
||||
document.onfullscreenchange = t.unreached_func("fullscreenchange event");
|
||||
document.onfullscreenerror = t.step_func_done();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -6,13 +6,16 @@
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
trusted_request(t, document.querySelector('div'));
|
||||
const div = document.querySelector('div');
|
||||
trusted_request(t, div);
|
||||
|
||||
// If fullscreenchange is an animation frame event, then animation frame
|
||||
// callbacks should be run after it is fired, before the timer callback.
|
||||
// The resize event should fire before the fullscreenchange event.
|
||||
const events = [];
|
||||
const callback = t.step_func(event => {
|
||||
// fullscreenElement should have changed before either event is fired.
|
||||
assert_equals(document.fullscreenElement, div, `fullscreenElement in {event.type} event`);
|
||||
events.push(event.type);
|
||||
if (event.type == 'fullscreenchange') {
|
||||
step_timeout(t.unreached_func('timer callback'));
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>IFrame Fullscreen API success reporter</title>
|
||||
<body>
|
||||
<script>
|
||||
reportFullscreenSuccessful = (success) => {
|
||||
return () => {
|
||||
parent.postMessage({"report": {
|
||||
"api": "fullscreen",
|
||||
"result": success,
|
||||
"frame": window.name
|
||||
}}, "*");
|
||||
};
|
||||
};
|
||||
|
||||
window.addEventListener('message', e => {
|
||||
if (e.data.action == "report") {
|
||||
document.onfullscreenchange = reportFullscreenSuccessful(true);
|
||||
document.onfullscreenerror = reportFullscreenSuccessful(false);
|
||||
document.body.requestFullscreen();
|
||||
}
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>IFrame fullscreenEnabled attribute reporter</title>
|
||||
<body>
|
||||
<script>
|
||||
parent.postMessage({"report": {
|
||||
"api": "fullscreen",
|
||||
"enabled": document.fullscreenEnabled,
|
||||
"frame": window.name
|
||||
}}, "*");
|
||||
</script>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<title>Move the fullscreen element to an inactive document</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../trusted-click.js"></script>
|
||||
<div></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
const div = document.querySelector("div");
|
||||
document.onfullscreenchange = t.step_func(event => {
|
||||
const inactiveDocument = document.implementation.createDocument(null, "");
|
||||
inactiveDocument.appendChild(div);
|
||||
|
||||
div.onfullscreenchange = t.unreached_func("fullscreenchange fired on element");
|
||||
inactiveDocument.onfullscreenchange = t.unreached_func("fullscreenchange fired on other document");
|
||||
document.onfullscreenchange = t.step_func_done();
|
||||
});
|
||||
trusted_request(t, div);
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html>
|
||||
<title>:fullscreen pseudo-class</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../trusted-click.js"></script>
|
||||
<div><div></div></div>
|
||||
<script>
|
||||
async_test(t => {
|
||||
const outer = document.querySelector("div");
|
||||
const inner = outer.firstChild;
|
||||
|
||||
// First request fullscreen for the outer element.
|
||||
trusted_request(t, outer);
|
||||
document.onfullscreenchange = t.step_func(() => {
|
||||
assert_equals(document.fullscreenElement, outer);
|
||||
assert_true(outer.matches(':fullscreen'),
|
||||
'outer:fullscreen in simple fullscreen');
|
||||
assert_false(inner.matches(':fullscreen'),
|
||||
'inner:fullscreen in simple fullscreen');
|
||||
|
||||
// Then request fullscreen for the inner element.
|
||||
trusted_request(t, inner);
|
||||
document.onfullscreenchange = t.step_func_done(() => {
|
||||
// Although inner is the fullscreen element, both elements match the
|
||||
// selector, as both have their fullscreen flag set.
|
||||
assert_equals(document.fullscreenElement, inner);
|
||||
assert_true(inner.matches(':fullscreen'),
|
||||
'inner:fullscreen in nested fullscreen');
|
||||
assert_true(outer.matches(':fullscreen'),
|
||||
'outer:fullscreen in nested fullscreen');
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE html>
|
||||
<title>:fullscreen pseudo-class support</title>
|
||||
<link rel="help" href="https://fullscreen.spec.whatwg.org/#:fullscreen-pseudo-class">
|
||||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-element-matches">
|
||||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-parentnode-queryselector">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
// This is a separate test so that support for :fullscreen can be detected
|
||||
// without actually going fullscreen. If it were not supported, then this test
|
||||
// would fail.
|
||||
test(t => {
|
||||
// precondition is to throw for unknown pseudo-classes:
|
||||
assert_throws(new SyntaxError(), () => document.body.matches(':halfscreen'));
|
||||
assert_throws(new SyntaxError(), () => document.querySelector(':halfscreen'));
|
||||
// the actual test:
|
||||
assert_false(document.body.matches(':fullscreen'));
|
||||
assert_equals(document.querySelector(':fullscreen'), null);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue