Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

  • This WPT test may be referenced by the following Test IDs:
    • /html/webappapis/dynamic-markup-insertion/opening-the-input-stream/origin-check-in-document-open-same-origin-domain.sub.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>Origin check in document.open() - same origin-domain (but not same origin) documents</title>
<link rel="author" title="Jochen Eisinger" href="mailto:jochen@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/resources/common.js"></script>
<body>
<script>
document.domain = document.domain;
let doc = ctx.iframes[0].contentDocument;
let constructor = ctx.iframes[0].contentWindow.DOMException;
assert_throws_dom("SecurityError", constructor, doc.open.bind(doc), "Opening a same origin-domain (but not same origin) document doesn't throw.");
}, "It should not be possible to open same origin-domain (but not same origin) documents.");
document.domain = document.domain;
let doc = ctx.iframes[0].contentDocument;
let constructor = ctx.iframes[0].contentWindow.DOMException;
assert_throws_dom("SecurityError", constructor, doc.write.bind(doc, ""), "Implicitly opening a same origin-domain (but not same origin) document doesn't throw.");
}, "It should not be possible to implicitly open same origin-domain (but not same origin) documents.");
</script>
</body>