blob: 251bb73e33e2acbf2f9bef60883ea902718013ee (
plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
<!DOCTYPE HTML>
<html>
<body>
<div id="content"></div>
<script>
// get the case from the query string
var type = location.search.substring(1);
function clickLink() {
// If we don't reflow before clicking the link, the test will fail intermittently. The reason is still unknown. We'll track this issue in bug 1259715.
requestAnimationFrame(function() {
setTimeout(function() {
document.getElementById("link").click();
}, 0);
});
}
switch (type) {
case "insecurePage_navigate_child":
document.getElementById("content").innerHTML =
'<a href="http://example.com/tests/dom/security/test/mixedcontentblocker/file_frameNavigation_innermost.html?insecurePage_navigate_child_response" id="link">Testing\<\/a>';
clickLink();
break;
case "insecurePage_navigate_child_response":
parent.parent.postMessage({"test": "insecurePage_navigate_child", "msg": "navigated to insecure iframe on insecure page"}, "http://mochi.test:8888");
document.getElementById("content").innerHTML = "Navigated from secure to insecure frame on an insecure page";
break;
case "insecurePage_navigate_grandchild":
document.getElementById("content").innerHTML =
'<a href="http://example.com/tests/dom/security/test/mixedcontentblocker/file_frameNavigation_innermost.html?insecurePage_navigate_grandchild_response" id="link">Testing\<\/a>';
clickLink();
break;
case "insecurePage_navigate_grandchild_response":
parent.parent.parent.postMessage({"test": "insecurePage_navigate_grandchild", "msg": "navigated to insecure grandchild iframe on insecure page"}, "http://mochi.test:8888");
document.getElementById("content").innerHTML = "Navigated from secure to insecure grandchild frame on an insecure page";
break;
case "securePage_navigate_child":
document.getElementById("content").innerHTML =
'<a href="http://example.com/tests/dom/security/test/mixedcontentblocker/file_frameNavigation_innermost.html?securePage_navigate_child_response" id="link">Testing\<\/a>';
clickLink();
break;
case "securePage_navigate_child_response":
document.getElementById("content").innerHTML = "<p>Navigated from secure to insecure frame on a secure page</p>";
parent.parent.postMessage({"test": "securePage_navigate_child", "msg": "navigated to insecure iframe on secure page"}, "http://mochi.test:8888");
break;
case "securePage_navigate_grandchild":
document.getElementById("content").innerHTML=
'<a href="http://example.com/tests/dom/security/test/mixedcontentblocker/file_frameNavigation_innermost.html?securePage_navigate_grandchild_response" id="link">Testing\<\/a>';
clickLink();
break;
case "securePage_navigate_grandchild_response":
parent.parent.parent.postMessage({"test": "securePage_navigate_grandchild", "msg": "navigated to insecure grandchild iframe on secure page"}, "http://mochi.test:8888");
document.getElementById("content").innerHTML = "<p>Navigated from secure to insecure grandchild frame on a secure page</p>";
break;
case "blankTarget":
window.close();
break;
default:
document.getElementById("content").innerHTML = "Hello";
break;
}
</script>
</body>
</html>
|