Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / serviceworker / resources / fetch-mixed-content-iframe-inscope-to-outscope.html
1 <script src="test-helpers.js?pipe=sub"></script>
2 <script>
3 var image_path = base_path() + 'fetch-access-control.php?PNGIMAGE';
4 var host_info = get_host_info();
5 var results = '';
6
7 function test1() {
8   var img = document.createElement('img');
9   document.body.appendChild(img);
10   img.onload = function() {
11     test2();
12   };
13   img.onerror = function() {
14     results += 'FAIL(1)';
15     test2();
16   };
17   img.src = host_info['HTTPS_ORIGIN'] + image_path;
18 }
19
20 function test2() {
21   var img = document.createElement('img');
22   document.body.appendChild(img);
23   img.onload = function() {
24     test3();
25   };
26   img.onerror = function() {
27     results += 'FAIL(2)';
28     test3();
29   };
30   img.src = host_info['HTTPS_REMOTE_ORIGIN'] + image_path;
31 }
32
33 function test3() {
34   var img = document.createElement('img');
35   document.body.appendChild(img);
36   img.onload = function() {
37     results += 'FAIL(3)';
38     test4();
39   };
40   img.onerror = function() {
41     test4();
42   };
43   img.src = host_info['HTTP_ORIGIN'] + image_path;
44 }
45
46 function test4() {
47   var img = document.createElement('img');
48   document.body.appendChild(img);
49   img.onload = function() {
50     results += 'FAIL(4)';
51     finish();
52   };
53   img.onerror = function() {
54     finish();
55   };
56   img.src = host_info['HTTP_REMOTE_ORIGIN'] + image_path;
57 }
58
59 function finish() {
60   results += 'finish';
61   window.parent.postMessage({results: results}, host_info['HTTPS_ORIGIN']);
62 }
63 </script>
64
65 <body onload='test1();'>
66 </body>