https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 6a33b243f29a42f0a38e95b3bf3c8428e109b10a authored by Javier Fernandez on 18 December 2018, 22:50:09 UTC
[LayoutNG] New value 'break-spaces' for the white-space property
Tip revision: 6a33b24
block-string-assignment-to-Document-write.tentative.html
<!DOCTYPE html>
<html>
<head>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="support/helper.sub.js"></script>

  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
</head>
<body>
<script>
  // TrustedURL assignments do not throw.
  test(t => {
    document.body.innerText = '';
    let p = createHTML_policy(window, 1);
    let html = p.createHTML(INPUTS.HTML);
    document.write(html);
    assert_equals(document.body.innerText, RESULTS.HTML);
  }, "document.write with html assigned via policy (successful URL transformation).");

  // String assignments throw.
  test(t => {
    const old = document.body.innerText;
    assert_throws(new TypeError(), _ => {
      document.write('A string');
    });
    assert_equals(document.body.innerText, old);
  }, "`document.write(string)` throws");

  // Null assignment throws.
  test(t => {
    const old = document.body.innerText;
    assert_throws(new TypeError(), _ => {
      document.write(null);
    });
    assert_equals(document.body.innerText, old);
  }, "`document.write(null)` throws");
</script>
back to top