blob: 2daedd597c5aad8126ff435b62e96d5ac9667581 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="/js-test-resources/ui-helper.js"></script>
<script>
description("Tests that same-origin iframe storage access is granted if the iframe is not sandboxed.");
jsTestIsAsync = true;
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) {
if (event.origin === "http://127.0.0.1:8000") {
if (event.data.indexOf("PASS") !== -1)
testPassed(event.data.replace("PASS ", ""));
else
testFailed(event.data.replace("FAIL ", ""));
} else
testFailed("Received a message from an unexpected origin: " + event.origin);
finishJSTest();
}
function activateElement(elementId) {
var element = document.getElementById(elementId);
var centerX = element.offsetLeft + element.offsetWidth / 2;
var centerY = element.offsetTop + element.offsetHeight / 2;
UIHelper.activateAt(centerX, centerY).then(
function () {
if (window.eventSender)
eventSender.keyDown("escape");
else {
testFailed("No eventSender.");
finishJSTest();
}
},
function () {
testFailed("Promise rejected.");
finishJSTest();
}
);
}
function runTest() {
activateElement("theIframe");
}
</script>
</head>
<body>
<iframe onload="runTest()" id="theIframe" src="http://127.0.0.1:8000/storageAccess/resources/request-storage-access-iframe.html#userShouldDenyAccess,userShouldNotBeConsulted,policyShouldGrantAccess,isSameOriginIframe"></iframe>
</body>
</html>