fetch-mixed-content-iframe-inscope-to-outscope.html (1748B)
1 <script src="/common/get-host-info.sub.js"></script> 2 <script src="test-helpers.sub.js?pipe=sub"></script> 3 <script> 4 var image_path = base_path() + 'fetch-access-control.py?PNGIMAGE'; 5 var host_info = get_host_info(); 6 var results = ''; 7 8 function test1() { 9 var img = document.createElement('img'); 10 document.body.appendChild(img); 11 img.onload = function() { 12 test2(); 13 }; 14 img.onerror = function() { 15 results += 'FAIL(1)'; 16 test2(); 17 }; 18 img.src = host_info['HTTPS_ORIGIN'] + image_path; 19 } 20 21 function test2() { 22 var img = document.createElement('img'); 23 document.body.appendChild(img); 24 img.onload = function() { 25 test3(); 26 }; 27 img.onerror = function() { 28 results += 'FAIL(2)'; 29 test3(); 30 }; 31 img.src = host_info['HTTPS_REMOTE_ORIGIN'] + image_path; 32 } 33 34 function test3() { 35 var img = document.createElement('img'); 36 document.body.appendChild(img); 37 img.onload = function() { 38 results += 'FAIL(3)'; 39 test4(); 40 }; 41 img.onerror = function() { 42 test4(); 43 }; 44 img.src = host_info['HTTP_ORIGIN'] + image_path; 45 } 46 47 function test4() { 48 var img = document.createElement('img'); 49 document.body.appendChild(img); 50 img.onload = function() { 51 results += 'FAIL(4)'; 52 test5(); 53 }; 54 img.onerror = function() { 55 test5(); 56 }; 57 img.src = host_info['HTTP_REMOTE_ORIGIN'] + image_path; 58 } 59 60 function test5() { 61 var img = document.createElement('img'); 62 document.body.appendChild(img); 63 img.onload = function() { 64 finish(); 65 }; 66 img.onerror = function() { 67 results += 'FAIL(5)'; 68 finish(); 69 }; 70 img.src = './sample?generate-png'; 71 } 72 73 function finish() { 74 results += 'finish'; 75 window.parent.postMessage({results: results}, host_info['HTTPS_ORIGIN']); 76 } 77 </script> 78 79 <body onload='test1();'> 80 </body>