testing/web-platform/tests/trusted-types/HTMLElement-generic.tentative.html
author Razvan Maries <rmaries@mozilla.com>
Thu, 26 Nov 2020 07:56:23 +0200
changeset 558457 7184fb5a42fbdd37b1d4863045bea812223ffd41
parent 531924 e07cf3d4936f99965d8d52afab0560b7cbfd7975
permissions -rw-r--r--
Backed out changeset 646459eb4a35 (bug 1459118) as per Henrik's request. CLOSED TREE

<!DOCTYPE html>
<head>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="support/helper.sub.js"></script>
</head>
<body>
<script>
  var testnb = 0;

  // TrustedScriptURL Assignments
  const scriptURLTestCases = [
    [ 'embed', 'src' ],
    [ 'script', 'src' ]
  ];

  testnb = 0;
  scriptURLTestCases.forEach(c => {
    test(t => {
      assert_element_accepts_trusted_script_url(window, ++testnb, t, c[0], c[1], RESULTS.SCRIPTURL);
    }, c[0] + "." + c[1] + " assigned via policy (successful ScriptURL transformation)");
  });

  // TrustedHTML Assignments
  const HTMLTestCases = [
    [ 'div', 'innerHTML' ],
    [ 'iframe', 'srcdoc' ]
  ];

  testnb = 0;
  HTMLTestCases.forEach(c => {
    test(t => {
      assert_element_accepts_trusted_html(window, ++testnb, t, c[0], c[1], RESULTS.HTML);
    }, c[0] + "." + c[1] + " assigned via policy (successful HTML transformation)");
  });

  // TrustedScript Assignments
  const scriptTestCases = [
    [ 'script', 'text' ],
    [ 'script', 'innerText' ],
    [ 'script', 'textContent' ]
  ];

  testnb = 0;
  scriptTestCases.forEach(c => {
    test(t => {
      assert_element_accepts_trusted_script(window, c, t, c[0], c[1], RESULTS.SCRIPT);
    }, c[0] + "." + c[1] + " assigned via policy (successful Script transformation)");
  });
</script>