swh:1:snp:b37d435721bbd450624165f334724e3585346499
Raw File
Tip revision: 70e133613ba68282617c33db22e17b05a1f93430 authored by Anne van Kesteren on 15 August 2018, 14:25:47 UTC
this is it
Tip revision: 70e1336
block-string-assignment-to-location-assign.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="require-trusted-types">
</head>
<body>
<script>
  //TrustedURL assignments work
  test(t => {
    var url = TrustedURL.create(location.href + "#xxx");
    location.assign(url);
    assert_equals("" + url, location.href, "location href");
  }, "Basic processing: safe URL, safe construction.");

  test(t => {
    var url = TrustedURL.unsafelyCreate(location.href + "#xxx");
    location.assign(url);
    assert_equals("" + url, location.href, "location href");
  }, "Basic processing: safe URL, unsafe construction.");

  // String assignments throw.
  test(t => {
    assert_throws(new TypeError(), _ => {
      location.assign("A string");
    });
  }, "`location.assign = string` throws");

  //Null assignment throws
  test(t => {
    assert_throws(new TypeError(), _ => {
      location.assign(null);
    });
  }, "`location.assign = null` throws");
</script>
back to top