summaryrefslogtreecommitdiffstats
path: root/tests/auto/core/origins/resources/mixedSchemes.html
blob: 3e50c2c3b44c9d7bf827afe2b45be8d669797796 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
    <head>
        <title>Mixed</title>
        <script>
         var result;
         var canary;

         function setIFrameUrl(frameUrl,imgUrl) {
             result = undefined;
             canary = undefined;
             let img = document.createElement('img');
             img.onerror = function() {
                 console.log("TEST:cannotLoad");
                 console.log("TEST:done");
             };
             img.onload = function() {
                 document.getElementById("iframe").setAttribute("src", frameUrl);
             };
             img.src = imgUrl
         }

         addEventListener("load", function() {
             document.getElementById("iframe").addEventListener("load", function() {
                 if (canary && window[0].canary) {
                     console.log("TEST:canLoadAndAccess");
                     console.log("TEST:done");
                 } else {
                     console.log("TEST:canLoadButNotAccess");
                     console.log("TEST:done");
                 }
             });
         });
         window.onerror = function(message, url, line, col, errorObj) {
             return true;
         };
        </script>
    </head>
    <body>
        <iframe id="iframe"></iframe>
    </body>
</html>