servo/tests/wpt/web-platform-tests/fullscreen/api/element-ready-check-not-allowed-cross-origin-manual.sub.html

31 lines
1.2 KiB
HTML

<!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>