fetch-mixed-content-iframe-inscope-to-inscope.html (1732B)
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 = './sample?url=' + 19 encodeURIComponent(host_info['HTTPS_ORIGIN'] + image_path); 20 } 21 22 function test2() { 23 var img = document.createElement('img'); 24 document.body.appendChild(img); 25 img.onload = function() { 26 test3(); 27 }; 28 img.onerror = function() { 29 results += 'FAIL(2)'; 30 test3(); 31 }; 32 img.src = './sample?mode=no-cors&url=' + 33 encodeURIComponent(host_info['HTTPS_REMOTE_ORIGIN'] + image_path); 34 } 35 36 function test3() { 37 var img = document.createElement('img'); 38 document.body.appendChild(img); 39 img.onload = function() { 40 results += 'FAIL(3)'; 41 test4(); 42 }; 43 img.onerror = function() { 44 test4(); 45 }; 46 img.src = './sample?mode=no-cors&url=' + 47 encodeURIComponent(host_info['HTTP_ORIGIN'] + image_path); 48 } 49 50 function test4() { 51 var img = document.createElement('img'); 52 document.body.appendChild(img); 53 img.onload = function() { 54 results += 'FAIL(4)'; 55 finish(); 56 }; 57 img.onerror = function() { 58 finish(); 59 }; 60 img.src = './sample?mode=no-cors&url=' + 61 encodeURIComponent(host_info['HTTP_REMOTE_ORIGIN'] + image_path); 62 } 63 64 function finish() { 65 results += 'finish'; 66 window.parent.postMessage({results: results}, host_info['HTTPS_ORIGIN']); 67 } 68 </script> 69 70 <body onload='test1();'> 71 </body>