| <script src="../resources/js-test-pre.js"></script> |
| <script src="../resources/pointer-lock/pointer-lock-test-harness.js"></script> |
| <iframe src="../resources/pointer-lock/inner-iframe.html" onload="doNextStepWithUserGesture()"></iframe> |
| description("Test iframe from same origin can not access pointerLockElement.") |
| window.jsTestIsAsync = true; |
| targetDiv1 = document.getElementById("target1"); |
| iframe = document.getElementsByTagName("iframe")[0]; |
| expectOnlyChangeEvent("Lock targetDiv1."); |
| targetDiv1.requestPointerLock(); |
| // doNextStep called by event handler. |
| shouldBe("document.pointerLockElement", "targetDiv1"); |
| iframe.contentWindow.postMessage(["eval", 'parent.postMessage(thisFileName() + " document.pointerLockElement = " + document.pointerLockElement, "*")'], "*"); |
| window.onmessage = function (messageEvent) { |
| message = messageEvent.data; |
| shouldBeEqualToString("message", "inner-iframe.html document.pointerLockElement = null"); |
| // doNextStep() called by iframe onload handler. |
| <script src="../resources/js-test-post.js"></script> |