blob: 60670d5bf61ded835f64527ef4ff5edec85dc0c9 [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ enableInAppBrowserPrivacy=true applicationBundleIdentifier=inAppBrowserPrivacyTestIdentifier isAppBoundWebView=true ] -->
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="/js-test-resources/js-test.js"></script>
<script src="/resourceLoadStatistics/resources/util.js"></script>
</head>
<body onload="runTest()">
<script>
description("Tests that an app-bound domain's iframe also uses an app-bound session.");
jsTestIsAsync = true;
function receiveMessage(event) {
if (event.origin === "http://localhost:8000") {
if (event.data.indexOf("PASS") === -1)
testFailed(event.data.replace("FAIL ", ""));
else
testPassed(event.data.replace("PASS ", ""));
} else
testFailed("Received a message from an unexpected origin: " + event.origin);
finishJSTest();
}
window.addEventListener("message", receiveMessage, false);
function loadFrame() {
let iframeElement = document.createElement("iframe");
iframeElement.src = "http://localhost:8000/in-app-browser-privacy/resources/non-app-bound-iframe.html?dummyParam" + Math.random();
document.body.appendChild(iframeElement);
}
function runTest() {
if (document.location.hash == "") {
// Load this test again with a random dummy value to avoid caching.
document.location.href = "http://127.0.0.1:8000/in-app-browser-privacy/non-app-bound-iframe-under-app-bound-domain-is-app-bound.html?dummyParam=" + Math.random() + "#step1";
} else {
if (!testRunner.hasAppBoundSession()) {
testFailed("Origin did not start with app-bound session.");
finishJSTest();
} else {
testPassed("Origin has app-bound session.");
// Clear the app-bound session to make sure the iframe load creates
// a new one.
testRunner.clearAppBoundSession();
loadFrame();
}
}
}
</script>
</body>
</html>