| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script> |
| 5 function loadFrames() { |
| 6 window.A = document.getElementById('A').contentWindow; |
| 7 window.B = document.getElementById('B').contentWindow; |
| 8 window.C = document.getElementById('C').contentWindow; |
| 9 window.D = document.getElementById('D').contentWindow; |
| 10 |
| 11 var path = location.pathname.substring(0, location.pathname.lastIndexOf('/
')) + '/frame.html'; |
| 12 A.location = 'frame.html'; |
| 13 B.location = frameURI = 'http://www2.web-platform.test:' + location.port +
path; |
| 14 C.location = frameURI = 'http://www2.web-platform.test:' + location.port +
path; |
| 15 D.location = frameURI = 'http://www1.web-platform.test:' + location.port +
path; |
| 16 |
| 17 var loadCount = 0; |
| 18 function frameLoaded() { |
| 19 if (++loadCount == 4) |
| 20 go(); |
| 21 } |
| 22 Array.prototype.forEach.call(document.getElementsByTagName('iframe'), func
tion(ifr) { ifr.onload = frameLoaded; }); |
| 23 } |
| 24 |
| 25 |
| 26 var results = []; |
| 27 function assert(cond, msg) { |
| 28 results.push({pass: !!cond, message: msg}); |
| 29 } |
| 30 |
| 31 function go() { |
| 32 window.onmessage = function() { |
| 33 assert(B.checkWindowReferences(), "B's Window references are still self-
consistent after document.domain"); |
| 34 for (var i = 0; i < window.length; ++i) { |
| 35 assert(window[i] === B.windowReferences[i], |
| 36 "Window reference " + i + " consistent between globals after do
cument.domain"); |
| 37 assert(window[i].location === B.locationReferences[i], |
| 38 "Location reference " + i + " consistent between globals after
document.domain"); |
| 39 } |
| 40 opener.postMessage(results, '*'); |
| 41 }; |
| 42 A.document.domain = A.document.domain; |
| 43 document.domain = document.domain; |
| 44 B.postMessage('', '*'); |
| 45 } |
| 46 |
| 47 </script> |
| 48 </head> |
| 49 <body onload="loadFrames()"> |
| 50 <iframe id="A"></iframe> |
| 51 <iframe id="B"></iframe> |
| 52 <iframe id="C"></iframe> |
| 53 <iframe id="D"></iframe> |
| 54 </body> |
| 55 </html> |
| OLD | NEW |