-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
53 lines (46 loc) · 1.88 KB
/
sandboxed-nesting-iframe-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
<script src="resources/util.js"></script>
<script>
description("Tests that redirects for a non-sandboxed iframe nested in a sandboxed iframe get counted properly.");
jsTestIsAsync = true;
window.addEventListener("message", receiveMessage, false);
function finishTest() {
setEnableFeature(false, finishJSTest);
}
if (testRunner) {
setEnableFeature(true, function() { });
}
var lastPageInRedirectChainLoaded = false;
var statsChecked = false;
async function receiveMessage(event) {
if (event.origin === "null") {
if (event.data.indexOf("PASS") === -1)
testFailed(event.data.replace("FAIL ", ""));
} else
testFailed("Received a message from an unexpected origin: " + event.origin);
lastPageInRedirectChainLoaded = true;
if (statsChecked)
finishTest();
else {
await testRunner.statisticsNotifyObserver();
checkStats();
}
}
function checkStats() {
shouldBeTrue('testRunner.isStatisticsRegisteredAsSubFrameUnder("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://localhost", "http://127.0.0.1")');
shouldBeTrue('testRunner.isStatisticsRegisteredAsRedirectingTo("http://127.0.0.1", "http://localhost")');
statsChecked = true;
if (lastPageInRedirectChainLoaded)
finishTest();
}
</script>
</head>
<body>
<iframe sandbox="allow-scripts" src="http://127.0.0.1:8000/resourceLoadStatistics/resources/page-with-non-sandboxed-iframe-redirect-ip-to-localhost-to-ip.html">
</iframe>
</body>
</html>