mirror of
https://github.com/servo/servo.git
synced 2025-07-12 09:53:40 +01:00
34 lines
1.3 KiB
HTML
34 lines
1.3 KiB
HTML
<!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(() => {
|
|
Promise.resolve(document.exitFullscreen()).catch(() => {});
|
|
});
|
|
|
|
// 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"}, "*");
|
|
}, elem.contentDocument.body);
|
|
// TODO(mustaq): The click above should activate the subframe. But
|
|
// elem.contentDocument is inaccessible (null) from a cross origin parent!
|
|
});
|
|
});
|
|
</script>
|