<!DOCTYPE HTML>
<html>
<head>
<script src="../resources/pointer-lock/pointer-lock-test-harness.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
promise_test(() => {
return new Promise((resolve, reject) => {
window.addEventListener('message', (event) => {
if (event.data == "inner-iframe.html onpointerlockchange, document.pointerLockElement = [object HTMLBodyElement]") {
resolve();
} else {
reject(event.data);
}
});
function onIframeLoaded() {
iframe.contentWindow.postMessage([ "clickBody" ], "*");
}
var iframe = document.createElement('iframe');
iframe.sandbox = 'allow-pointer-lock allow-scripts';
iframe.onload = onIframeLoaded;
iframe.src = '../resources/pointer-lock/inner-iframe.html';
document.body.appendChild(iframe);
});
}, 'Test sandboxed iframe with allow-pointer-lock allows pointer lock.');
</script>
</body>
</html>