Bug 1498665 [wpt PR 13488] - Small adjustment to document.write TrustedTypes test., a=testonly
authorKrzysztof Kotowicz <koto@google.com>
Tue, 16 Oct 2018 09:58:23 +0000
changeset 489990 885733526846e0d7b1e2a1ced9e9621f8d14ac08
parent 489989 5bc90d61ddfd75450347900abd0d1a59b880c202
child 489991 7215ff15639fafc238e36f3d9b63baa171c90806
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerstestonly
bugs1498665, 13488
milestone64.0a1
Bug 1498665 [wpt PR 13488] - Small adjustment to document.write TrustedTypes test., a=testonly Automatic update from web-platform-testsSmall adjustment to document.write TrustedTypes test as WindowTestEnvironment writes to the DOM, breaking the test when viewed in the browser. (#13488) Also removed a duplicate test. -- wpt-commits: 72388ece045369a7b07eed7f52e582cf231b892d wpt-pr: 13488
testing/web-platform/tests/trusted-types/Document-write.tentative.html
testing/web-platform/tests/trusted-types/block-string-assignment-to-Document-write.tentative.html
--- a/testing/web-platform/tests/trusted-types/Document-write.tentative.html
+++ b/testing/web-platform/tests/trusted-types/Document-write.tentative.html
@@ -1,13 +1,14 @@
 <!DOCTYPE html>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="support/helper.sub.js"></script>
 <body>
 <script>
+  // TrustedHTML assignments do not throw.
   test(t => {
     let p = createHTML_policy(window, 1);
     let html = p.createHTML(INPUTS.HTML);
     document.write(html);
-    assert_equals(document.body.innerText, RESULTS.HTML);
-  }, "document.write with html assigned via policy (successful URL transformation).");
+    assert_true(document.body.innerText.indexOf(RESULTS.HTML) !== -1);
+  }, "document.write with html assigned via policy (successful transformation).");
 </script>
--- 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
@@ -4,24 +4,16 @@
   <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 *">
 </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);
-    assert_equals(document.body.innerText, RESULTS.HTML);
-  }, "document.write with html assigned via policy (successful URL transformation).");
-
   // String assignments throw.
   test(t => {
     assert_throws(new TypeError(), _ => {
       document.write('A string');
     });
   }, "`document.write(string)` throws");
 
   // Null assignment throws.