020.html (870B)
1 <!doctype html> 2 <title>cross-origin test</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <iframe src="../without-ports/020-1.html"></iframe> 6 <div id="log"></div> 7 <script> 8 setup({ single_test: true }); 9 10 var iframe = document.createElement('iframe'); 11 var url_prefix = location.href.replace('://', '://www1.').replace(/\/with(out)?-ports\/[^\/]+$/, ''); 12 var url = url_prefix + '/without-ports/020-1.html'; 13 iframe.src = url; 14 document.body.appendChild(iframe); 15 </script> 16 <div id=log></div> 17 <script> 18 onload = function() { 19 window[0].postMessage(1, location.href); 20 window[1].postMessage(2, url); 21 var i = 0; 22 onmessage = function(e) { 23 i++; 24 assert_equals(e.data[0], i); 25 assert_equals(e.data[1], location.protocol + '//' + location.host); 26 if (i == 2) { 27 done(); 28 } 29 }; 30 }; 31 </script>