summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-side-effects-xml.window.js
blob: bbfc015c68e95d5aa8526936adf9693bcacef973 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// META: script=resources/document-open-side-effects.js

async_test(t => {
  const iframe = document.body.appendChild(document.createElement("iframe"));
  t.add_cleanup(() => iframe.remove());
  iframe.src = "/common/dummy.xhtml";
  iframe.onload = t.step_func_done(() => {
    const origURL = iframe.contentDocument.URL;
    assertDocumentIsReadyForSideEffectsTest(iframe.contentDocument, "XML document");
    assert_throws_dom(
      "InvalidStateError",
      iframe.contentWindow.DOMException,
      () => {
        iframe.contentDocument.open();
      },
      "document.open() should throw on XML documents"
    );
    assertOpenHasNoSideEffects(iframe.contentDocument, origURL, "XML document");
  });
}, "document.open bailout should not have any side effects (XML document)");