summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module-assertions/cors-crossorigin-requests.html
blob: 757af2901c321d414ec6dc0db36a9ae3f238933e (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
<!doctype html>
<html>
<head>
    <title>json-module-assertions-crossorigin</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
</head>
<body>
    <h1>json-module-assertions-crossorigin</h1>
    <iframe id="import-WithCORS" src="crossorigin-import-with-cors.sub.html"></iframe>
    <iframe id="import-NoCORS" src="crossorigin-import-without-cors.sub.html"></iframe>
    <iframe id="import-parseerror-WithCors" src="crossorigin-import-parse-error-with-cors.sub.html"></iframe>
    <script>

        var tests = [
                { "obj": async_test("Imported JSON module, cross-origin with CORS"), "id": "import-WithCORS", "expected": "imported JSON: 42" },
                { "obj": async_test("Imported JSON module, cross-origin, missing CORS ACAO header"), "id": "import-NoCORS", "expected": "error" },
                { "obj": async_test("Imported JSON module with parse error, cross-origin, with CORS"), "id": "import-parseerror-WithCors", "expected": "0-0" },
            ];

        window.addEventListener("load", function () {
            tests.forEach(function (test) {
                var target = document.getElementById(test.id);
                test.obj.step(function () {
                    assert_equals(target.contentDocument._log, test.expected, "Unexpected _log value");
                });
                test.obj.done();
            });
        });

    </script>
</body>
</html>