1 <script src=
"../../resources/get-host-info.js"></script>
2 <script src=
"test-helpers.js?pipe=sub"></script>
4 var image_path
= base_path() + 'fetch-access-control.php?PNGIMAGE';
5 var host_info
= get_host_info();
9 var meta
= document
.createElement('meta');
10 meta
.setAttribute('http-equiv', 'Content-Security-Policy');
11 meta
.setAttribute('content', 'img-src ' + host_info
['HTTP_ORIGIN'] +
12 '; script-src \'unsafe-inline\'');
13 document
.head
.appendChild(meta
);
16 var img
= document
.createElement('img');
17 document
.body
.appendChild(img
);
18 img
.onload = function() {
21 img
.onerror = function() {
25 img
.src
= host_info
['HTTP_ORIGIN'] + image_path
;
29 var img
= document
.createElement('img');
30 document
.body
.appendChild(img
);
31 img
.onload = function() {
35 img
.onerror = function() {
38 img
.src
= host_info
['HTTP_REMOTE_ORIGIN'] + image_path
;
42 var img
= document
.createElement('img');
43 document
.body
.appendChild(img
);
44 img
.onload = function() {
47 img
.onerror = function() {
51 img
.src
= './dummy?url=' +
52 encodeURIComponent(host_info
['HTTP_ORIGIN'] + image_path
);
56 var img
= document
.createElement('img');
57 document
.body
.appendChild(img
);
58 img
.onload = function() {
62 img
.onerror = function() {
65 img
.src
= './dummy?mode=no-cors&url=' +
66 encodeURIComponent(host_info
['HTTP_REMOTE_ORIGIN'] + image_path
);
71 port
.postMessage({results
: results
});
74 window
.addEventListener('message', function(evt
) {