Bug 1475724 [wpt PR 11967] - HTMLBaseElement::href changed to accept TrustedTypes, a=testonly
authorMaja Kabus <kabusm@google.com>
Wed, 25 Jul 2018 15:56:09 +0000
changeset 428934 a71174fc706ad978f45973ce96001eb6d6ce80ec
parent 428933 42d1b3ba971b315331b0d2c9c5c7fa9888b4b6ec
child 428935 7f7d29e85f66a6c69c7437f410941cb783a84443
push id105805
push userjames@hoppipolla.co.uk
push dateSun, 29 Jul 2018 18:28:58 +0000
treeherdermozilla-inbound@7ca03e42cbdf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1475724, 11967, 739170, 1136544, 575232
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1475724 [wpt PR 11967] - HTMLBaseElement::href changed to accept TrustedTypes, a=testonly Automatic update from web-platform-testsHTMLBaseElement::href changed to accept TrustedTypes Changed implementation of setHref(), older version is abandoned. Added href() getter that accepts URLString as an argument. Bug: 739170 Change-Id: I7703c1a33f037a912f1a105d8c79ef8fe5b4a289 Reviewed-on: https://chromium-review.googlesource.com/1136544 Reviewed-by: Mike West <mkwst@chromium.org> Commit-Queue: Maja Kabus <kabusm@google.com> Cr-Commit-Position: refs/heads/master@{#575232} -- wpt-commits: bd2709244a313ed5ea8e08d83c22173955c1ed80 wpt-pr: 11967
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/trusted-types/HTMLBaseElement-href.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -379667,16 +379667,22 @@
     ]
    ],
    "trusted-types/DOMParser.tentative.html": [
     [
      "/trusted-types/DOMParser.tentative.html",
      {}
     ]
    ],
+   "trusted-types/HTMLBaseElement-href.tentative.html": [
+    [
+     "/trusted-types/HTMLBaseElement-href.tentative.html",
+     {}
+    ]
+   ],
    "trusted-types/TrustedHTML.tentative.html": [
     [
      "/trusted-types/TrustedHTML.tentative.html",
      {}
     ]
    ],
    "trusted-types/TrustedScriptURL.tentative.html": [
     [
@@ -379685,16 +379691,22 @@
     ]
    ],
    "trusted-types/TrustedURL.tentative.html": [
     [
      "/trusted-types/TrustedURL.tentative.html",
      {}
     ]
    ],
+   "trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html": [
+    [
+     "/trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html",
+     {}
+    ]
+   ],
    "trusted-types/block-string-assignment-to-createContextualFragment.tentative.html": [
     [
      "/trusted-types/block-string-assignment-to-createContextualFragment.tentative.html",
      {}
     ]
    ],
    "trusted-types/block-string-assignment-to-innerHTML.tentative.html": [
     [
@@ -620362,32 +620374,40 @@
   "trusted-types/DOMParser-requiresTrustedTypes.tentative.html": [
    "0846d9c9f9c97063915cee559bcf4a3e711e9887",
    "testharness"
   ],
   "trusted-types/DOMParser.tentative.html": [
    "a32d31137bcfc113ce1ca9f75c9770d3501364d5",
    "testharness"
   ],
+  "trusted-types/HTMLBaseElement-href.tentative.html": [
+   "5b387ae813ec359650618081128001955c7024e2",
+   "testharness"
+  ],
   "trusted-types/META.yml": [
    "4966e7a03e815dac333218faf57875b57b9dd535",
    "support"
   ],
   "trusted-types/TrustedHTML.tentative.html": [
    "1bcbd6d4d990c00449a95fd9c410c199b83b6661",
    "testharness"
   ],
   "trusted-types/TrustedScriptURL.tentative.html": [
    "2a02a26d6c55e38d51abebe59b470d6f5008440c",
    "testharness"
   ],
   "trusted-types/TrustedURL.tentative.html": [
    "e6cff885204af25c0233d9c18dd3de5cb82ed51b",
    "testharness"
   ],
+  "trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html": [
+   "1a3857314ef43c75bcf398f2429d34adce135edb",
+   "testharness"
+  ],
   "trusted-types/block-string-assignment-to-createContextualFragment.tentative.html": [
    "aa2e78ed37b9b04378e0cbfc93a510bf428f6f78",
    "testharness"
   ],
   "trusted-types/block-string-assignment-to-innerHTML.tentative.html": [
    "cde544697dbfa750e2f5ca8a1d7499d6c85c407e",
    "testharness"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/trusted-types/HTMLBaseElement-href.tentative.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
+  <script src="support/helper.js"></script>
+
+  <script>
+    //helper function for the tests
+    function testHref(str, url) {
+      var base = document.createElement('base');
+      base.href = url;
+      assert_equals(base.href, str);
+    }
+
+    test(t => {
+      testHref(URLS.safe, TrustedURL.create(URLS.safe));
+    }, "base.href = URLS.safe, TrustedURL.create");
+
+    test(t => {
+      testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
+    }, "base.href = URLS.safe, TrustedURL.unsafelyCreate");
+  </script>
+</head>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-HTMLBaseElement-href.tentative.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <script src="/resources/testharness.js"></script>
+  <script src="/resources/testharnessreport.js"></script>
+  <script src="support/helper.js"></script>
+
+  <meta http-equiv="Content-Security-Policy" content="require-trusted-types">
+
+  <script>
+    //helper function for the tests
+    function testHref(str, url) {
+      var base = document.createElement('base');
+      base.href = url;
+      assert_equals(base.href, str);
+    }
+
+    //URL assignments do not throw.
+    test(t => {
+      testHref(URLS.safe, TrustedURL.create(URLS.safe));
+    }, "base.href = URLS.safe, TrustedURL.create");
+
+    test(t => {
+      testHref(URLS.safe, TrustedURL.unsafelyCreate(URLS.safe));
+    }, "base.href = URLS.safe, TrustedURL.unsafelyCreate");
+
+    // String assignments throw.
+    test(t => {
+      var base = document.createElement('base');
+      assert_throws(new TypeError(), _ => {
+        base.href = "A string";
+      });
+    }, "`base.href = string` throws");
+
+    //Null assignment throws.
+    test(t => {
+      var base = document.createElement('base');
+      assert_throws(new TypeError(), _ => {
+        base.href = null;
+      });
+    }, "`base.href = null` throws");
+  </script>
+</head>