summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain.html
blob: d3af35c6d7ac50de4fd8942066875d52229634f2 (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
<!doctype html>
<html>
    <head>
        <title>document.domain's getter</title>
        <script src="/resources/testharness.js"></script>
        <script src="/resources/testharnessreport.js"></script>
        <script>
            test(function() {
                assert_equals(typeof document.domain, "string", "document.domain is a string");
                assert_not_equals(document.domain, "", "document.domain is not empty");
            }, "basics");

            test(function() {
                assert_equals(document.domain, window.location.hostname, "equals location.hostname");
            }, "current document");

            test(function() {
                var doc = new Document();
                assert_equals(doc.domain, window.location.hostname, "equals location.hostname");
            }, "new Document()");

            async_test(t => {
                const client = new XMLHttpRequest();
                client.open("GET", "/common/blank.html");
                client.responseType = "document"
                client.send();
                client.onload = t.step_func_done(() => {
                    assert_equals(client.response.domain, window.location.hostname);
                });
            }, "XMLHttpRequest's response document");
        </script>
    </head>
    <body>
    </body>
</html>