blob: a315e21208728ed38155fa0e13c5f4d58dbea496 (
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
|
<!DOCTYPE html>
<html>
<head>
<script src="/common/get-host-info.sub.js"></script>
<script>
function loadFrames() {
window.A = document.getElementById('A').contentWindow;
window.B = document.getElementById('B').contentWindow;
window.C = document.getElementById('C').contentWindow;
window.D = document.getElementById('D').contentWindow;
var path = location.pathname.substring(0, location.pathname.lastIndexOf('/')) + '/frame.html';
A.location = 'frame.html';
B.location = '//{{domains[www2]}}:' + get_port(location) + path;
C.location = '//{{domains[www2]}}:' + get_port(location) + path;
D.location = '//{{domains[www1]}}:' + get_port(location) + path;
var loadCount = 0;
function frameLoaded() {
if (++loadCount == 4)
go();
}
var iframes = document.getElementsByTagName('iframe');
for (var i = 0; i < iframes.length; i++) {
iframes[i].onload = frameLoaded;
}
}
var results = [];
function assert(cond, msg) {
results.push({pass: !!cond, message: msg});
}
function go() {
window.onmessage = function(evt) {
try {
assert(evt.data == "PASS", "frame.html processing should be PASS but got " + evt.data);
assert(B.checkWindowReferences(), "B's Window references are still self-consistent after document.domain");
for (var i = 0; i < window.length; ++i) {
assert(window[i] === B.windowReferences[i],
"Window reference " + i + " consistent between globals after document.domain");
assert(window[i].location === B.locationReferences[i],
"Location reference " + i + " consistent between globals after document.domain");
}
} catch(e) {
assert(false, "Should not receive exception: " + e);
}
opener.postMessage(results, '*');
};
A.document.domain = A.document.domain;
document.domain = document.domain;
B.postMessage('', '*');
}
</script>
</head>
<body onload="loadFrames()">
<iframe id="A"></iframe>
<iframe id="B"></iframe>
<iframe id="C"></iframe>
<iframe id="D"></iframe>
</body>
</html>
|