chromium/third_party/blink/web_tests/http/tests/security/subresourceIntegrity/empty-after-revalidate-script.html

<!DOCTYPE html>
<html>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<script>
  var t_script = async_test(
    "SRI with script with empty body after revalidation shouldn't crash");
  window.onload = () => t_script.step_timeout(revalidate_script, 0);
  function revalidate_script() {
    var script = document.createElement('script');
    script.integrity = "sha256-YsI40D9FX0QghiYVdxQyySP2TOmARkLC5uPRO8RL2dE=";
    script.onload = t_script.unreached_func('Second request should fail');
    script.onerror = t_script.step_func_done();
    script.src =
      "../../cache/resources/etag-200-empty.php?empty-after-revalidate-script";
    document.head.appendChild(script);
  }
</script>
<script
  src="../../cache/resources/etag-200-empty.php?empty-after-revalidate-script"
  type="text/javascript"
  integrity="sha256-YsI40D9FX0QghiYVdxQyySP2TOmARkLC5uPRO8RL2dE="
  onerror="t_script.unreached_func('First request should pass')()"
></script>
</html>