OLD | NEW |
| (Empty) |
1 <script src="../../resources/get-host-info.js?pipe=sub"></script> | |
2 <script src="test-helpers.js"></script> | |
3 <script> | |
4 var image_path = base_path() + 'fetch-access-control.php?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['UNAUTHENTICATED_ORIGIN'] + image_path; | |
45 } | |
46 | |
47 function test4() { | |
48 var img = document.createElement('img'); | |
49 document.body.appendChild(img); | |
50 img.onload = function() { | |
51 finish(); | |
52 }; | |
53 img.onerror = function() { | |
54 results += 'FAIL(4)'; | |
55 finish(); | |
56 }; | |
57 img.src = './dummy?generate-png'; | |
58 } | |
59 | |
60 function finish() { | |
61 results += 'finish'; | |
62 window.parent.postMessage({results: results}, host_info['HTTPS_ORIGIN']); | |
63 } | |
64 </script> | |
65 | |
66 <body onload='test1();'> | |
67 </body> | |
OLD | NEW |