Bug 1494969 [wpt PR 13260] - Trusted Types: Implement "trusted-types *" and reserved names., a=testonly
authorDaniel Vogelheim <vogelheim@chromium.org>
Tue, 09 Oct 2018 20:37:55 +0000
changeset 496214 a476ba8cea70264dc44ffe482c479bef5fbbdb2b
parent 496213 abe1d19c586d1aa678761a8bf6e508daa7771cb3
child 496215 97b48667434b4cc91c4f725a29ab5fde78979bfe
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1494969, 13260, 739170, 1249269, 596638
milestone64.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 1494969 [wpt PR 13260] - Trusted Types: Implement "trusted-types *" and reserved names., a=testonly Automatic update from web-platform-testsTrusted Types: Implement "trusted-types *" and reserved names. - An empty trusted-types declaration means no policies are allowed. - A declaration of only "*" means all policies are allowed. - Quoted strings are considered reserved (and thus cannot be policy names) This aligns the implementation close with the trusted types polyfill. Bug: 739170 Change-Id: If9fc66e80d60a81ec4228da35ae8c8820ebaa9b5 Reviewed-on: https://chromium-review.googlesource.com/c/1249269 Commit-Queue: Daniel Vogelheim <vogelheim@chromium.org> Reviewed-by: Andy Paicu <andypaicu@chromium.org> Cr-Commit-Position: refs/heads/master@{#596638} -- wpt-commits: c93d2c9a6a284f773b6a7ab6275d642a8e05c7ee wpt-pr: 13260
testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html
testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-wildcard.tentative.html
testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-isXXX.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Document-write.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Location-assign.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Location-href.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Location-replace.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Window-open.tentative.html
--- a/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html
+++ b/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-noNamesGiven.tentative.html
@@ -2,13 +2,14 @@
 <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">
 <body>
 <script>
   //No name given test
   test(t => {
-    let policy = window.TrustedTypes.createPolicy('SomeName', { createHTML: s => s } );
-    assert_equals(policy.name, 'SomeName');
-  }, "No name list given - policy creation works");
+    assert_throws(new TypeError(), _ => {
+      window.TrustedTypes.createPolicy('SomeName', { createHTML: s => s } );
+    });
+  }, "No name list given - policy creation throws");
 </script>
 
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests-wildcard.tentative.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<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 *">
+<body>
+<script>
+  //No name given test
+  test(t => {
+    let policy = window.TrustedTypes.createPolicy('SomeName', { createHTML: s => s } );
+    assert_equals(policy.name, 'SomeName');
+  }, "Wildcard given - policy creation works");
+</script>
+
--- a/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-isXXX.tentative.html
+++ b/testing/web-platform/tests/trusted-types/TrustedTypePolicyFactory-isXXX.tentative.html
@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <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">
+<meta http-equiv="Content-Security-Policy" content="trusted-types *">
 <body>
 <script>
   // Policy settings for all tests
   const noopPolicy = {
     'createHTML': (s) => s,
     'createScriptURL': (s) => s,
     'createURL': (s) => s,
     'createScript': (s) => s,
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-DOMParser-parseFromString.tentative.html
@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <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">
+<meta http-equiv="Content-Security-Policy" content="trusted-types *">
 <body>
 <script>
   // Trusted HTML assignments do not throw.
   test(t => {
     let p = createHTML_policy(window, 1);
     let html = p.createHTML(INPUTS.HTML);
     let parser = new DOMParser();
     let doc = parser.parseFromString(html, "text/html");
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-DOMWindowTimers-setTimeout-setInterval.tentative.html
@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <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">
+<meta http-equiv="Content-Security-Policy" content="trusted-types *">
 <body>
 <script>
   // setTimeout tests
   // TrustedScript assignments do not throw.
   async_test(t => {
     window.timeoutTest = t;
     let policy = createScript_policy(window, 'timeout');
     let script = policy.createScript("window.timeoutTest.done();");
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-Document-write.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-Document-write.tentative.html
@@ -1,16 +1,16 @@
 <!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">
+  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
 </head>
 <body>
 <script>
   // TrustedURL assignments do not throw.
   test(t => {
     let p = createHTML_policy(window, 1);
     let html = p.createHTML(INPUTS.HTML);
     document.write(html);
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-insertAdjacentHTML.tentative.html
@@ -1,16 +1,16 @@
 <!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">
+  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
 </head>
 <body>
 <div id="container"></div>
 <script>
   var container = document.querySelector('#container');
 
   // Trusted HTML assignments do not throw.
   test(t => {
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-outerHTML.tentative.html
@@ -1,16 +1,16 @@
 <!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">
+  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
 </head>
 <body>
 <div id="container"></div>
 <script>
   var container = document.querySelector('#container')
 
   // TrustedHTML assignments do not throw.
   test(t => {
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-setAttribute.tentative.html
@@ -1,16 +1,16 @@
 <!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">
+  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
 </head>
 <body>
 <script>
   // TrustedURL Assignments
   let testCases = [
     [ 'a', 'href' ],
     [ 'area', 'href' ],
     [ 'base', 'href' ],
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-Element-setAttributeNS.tentative.html
@@ -1,16 +1,16 @@
 <!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">
+  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
 </head>
 <body>
 <script>
     test(t => {
       assert_element_accepts_trusted_html_set_ns(window, '0', t, 'a', 'b', RESULTS.HTML);
     }, "Element.setAttributeNS assigned via policy (successful HTML transformation)");
 
     test(t => {
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-HTMLElement-generic.tentative.html
@@ -1,16 +1,16 @@
 <!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">
+  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
 </head>
 <body>
 <script>
   var testnb = 0;
   // TrustedURL Assignments
   let testCases = [
     [ 'a', 'href' ],
     [ 'area', 'href' ],
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-Location-assign.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-Location-assign.tentative.html
@@ -1,16 +1,16 @@
 <!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">
+  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
 </head>
 <body>
 <script>
   // TrustedURL assignments do not throw.
   test(t => {
     let p = createURL_policy(window, 1);
     let url = p.createURL(location.href + "#xxx");
     location.assign(url);
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-Location-href.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-Location-href.tentative.html
@@ -1,16 +1,16 @@
 <!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">
+  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
 </head>
 <body>
 <script>
   // TrustedURL assignments do not throw.
   test(t => {
     let p = createURL_policy(window, 1);
     let url = p.createURL(location.href + "#xxx");
     location.href = url;
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-Location-replace.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-Location-replace.tentative.html
@@ -1,16 +1,16 @@
 <!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">
+  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
 </head>
 <body>
 <script>
   // TrustedURL replacements do not throw.
   test(t => {
     let p = createURL_policy(window, 1);
     let url = p.createURL(location.href + "#xxx");
     location.replace(url);
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-Range-createContextualFragment.tentative.html
@@ -1,14 +1,14 @@
 <!DOCTYPE html>
 <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">
+<meta http-equiv="Content-Security-Policy" content="trusted-types *">
 <body>
 <script>
   // TrustedHTML assignments do not throw.
   test(t => {
     let p = createHTML_policy(window, 1);
     let html = p.createHTML(INPUTS.HTML);
     var range = document.createRange();
     range.selectNodeContents(document.documentElement);
--- a/testing/web-platform/tests/trusted-types/block-string-assignment-to-Window-open.tentative.html
+++ b/testing/web-platform/tests/trusted-types/block-string-assignment-to-Window-open.tentative.html
@@ -1,16 +1,16 @@
 <!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">
+  <meta http-equiv="Content-Security-Policy" content="trusted-types *">
 </head>
 <body>
 <script>
   var testnb = 0;
   // helper functions for the tests
   function testWindowOpen(t, win, nb) {
     let p = createURL_policy(window, nb);
     let url = p.createURL(INPUTS.URL);