Bug 1457687 [wpt PR 10703] - Correct document.domain setter test, a=testonly draft
authorAnne van Kesteren <annevk@annevk.nl>
Thu, 03 May 2018 22:16:09 +0000
changeset 791481 5d5c17fa838749610f9134086bef6b0ab2b2da07
parent 791480 23f954677dc29584c89cd8c0d3debbc1433079a5
child 791482 0c43fa8e9d815a1652e592fdccbd3f92d689e68b
push id108825
push userbmo:james@hoppipolla.co.uk
push dateFri, 04 May 2018 14:12:31 +0000
reviewerstestonly
bugs1457687, 10703, 10695
milestone61.0a1
Bug 1457687 [wpt PR 10703] - Correct document.domain setter test, a=testonly Automatic update from web-platform-testsCorrect document.domain setter test Fixes #10695. -- wpt-commits: a13c9f65c007ddde78fe6c99c0f173dbc87cd245 wpt-pr: 10703
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/html/browsers/origin/.gitkeep
testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/.gitkeep
testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter.html
testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter_iframe.html
testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/support/document_domain_setter_iframe.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -276905,51 +276905,41 @@
      {}
     ]
    ],
    "html/browsers/offline/the-application-cache-selection-algorithm/.gitkeep": [
     [
      {}
     ]
    ],
-   "html/browsers/origin/.gitkeep": [
-    [
-     {}
-    ]
-   ],
    "html/browsers/origin/cross-origin-objects/frame-with-then.html": [
     [
      {}
     ]
    ],
    "html/browsers/origin/cross-origin-objects/frame.html": [
     [
      {}
     ]
    ],
    "html/browsers/origin/cross-origin-objects/win-documentdomain.sub.html": [
     [
      {}
     ]
    ],
-   "html/browsers/origin/relaxing-the-same-origin-restriction/.gitkeep": [
-    [
-     {}
-    ]
-   ],
-   "html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter_iframe.html": [
-    [
-     {}
-    ]
-   ],
    "html/browsers/origin/relaxing-the-same-origin-restriction/support/document_domain_frame.html": [
     [
      {}
     ]
    ],
+   "html/browsers/origin/relaxing-the-same-origin-restriction/support/document_domain_setter_iframe.html": [
+    [
+     {}
+    ]
+   ],
    "html/browsers/sandboxing/.gitkeep": [
     [
      {}
     ]
    ],
    "html/browsers/sandboxing/inner-iframe.html": [
     [
      {}
@@ -562781,20 +562771,16 @@
   "html/browsers/offline/section_network_online-manual.https.html": [
    "6a403d69ed90abeea5a4c61f6f09778224a5c184",
    "manual"
   ],
   "html/browsers/offline/the-application-cache-selection-algorithm/.gitkeep": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
-  "html/browsers/origin/.gitkeep": [
-   "da39a3ee5e6b4b0d3255bfef95601890afd80709",
-   "support"
-  ],
   "html/browsers/origin/cross-origin-objects/cross-origin-objects-on-new-window.html": [
    "604c6ee2bd78187a600dd28e03b60caf89580cfe",
    "testharness"
   ],
   "html/browsers/origin/cross-origin-objects/cross-origin-objects.html": [
    "f28dabd90e50b23816512bbbf5b3392b40a3ec5a",
    "testharness"
   ],
@@ -562809,44 +562795,40 @@
   "html/browsers/origin/cross-origin-objects/win-documentdomain.sub.html": [
    "37d2be417bbc3b8473c2d4bfaa3b7a9973140ce9",
    "support"
   ],
   "html/browsers/origin/origin-of-data-document.html": [
    "9fec457691ac4b071e9bc8de1ebf6f13dbadd4e5",
    "testharness"
   ],
-  "html/browsers/origin/relaxing-the-same-origin-restriction/.gitkeep": [
-   "da39a3ee5e6b4b0d3255bfef95601890afd80709",
-   "support"
-  ],
   "html/browsers/origin/relaxing-the-same-origin-restriction/document_domain.html": [
    "9839a9c24ce78ec42da8a60d2175df06e19983c1",
    "testharness"
   ],
   "html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter.html": [
-   "1f0408464d8d98341c9537c3e3356cacbcf2f489",
-   "testharness"
-  ],
-  "html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter_iframe.html": [
-   "d33427abcc87693bce1f5610f460aad12cb99759",
-   "support"
+   "74417f69455c12f894207e23496c0f92edff7eae",
+   "testharness"
   ],
   "html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter_null.tentative.html": [
    "212e7be483bcb35413156231afcda8fe074558fc",
    "testharness"
   ],
   "html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter_srcdoc.html": [
    "f707d1f40216d35afd04f4cd68cce66feaadddfd",
    "testharness"
   ],
   "html/browsers/origin/relaxing-the-same-origin-restriction/support/document_domain_frame.html": [
    "80d3d94c22642b2c07dae8f9cd8a50b563d36ef3",
    "support"
   ],
+  "html/browsers/origin/relaxing-the-same-origin-restriction/support/document_domain_setter_iframe.html": [
+   "d33427abcc87693bce1f5610f460aad12cb99759",
+   "support"
+  ],
   "html/browsers/sandboxing/.gitkeep": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
   "html/browsers/sandboxing/inner-iframe.html": [
    "ba143e41121916fba5522d5e1dca29d04ab5f4ce",
    "support"
   ],
deleted file mode 100644
deleted file mode 100644
--- a/testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter.html
+++ b/testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter.html
@@ -10,59 +10,58 @@
     <iframe id="iframe"></iframe>
     <script>
       var host_info = get_host_info();
       var HTTP_PORT = host_info.HTTP_PORT;
       var ORIGINAL_HOST = host_info.ORIGINAL_HOST; // e.g. "web-platform.test"
       var SUFFIX_HOST = ORIGINAL_HOST.substring(ORIGINAL_HOST.lastIndexOf('.') + 1); // e.g. "test"
       var PREFIX_HOST = "www1." + ORIGINAL_HOST; // e.g. "www1.web-platform.test"
       var iframe = document.getElementById("iframe");
-      var iframe_url = new URL("document_domain_setter_iframe.html", document.location);
+      var iframe_url = new URL("support/document_domain_setter_iframe.html", document.location);
       iframe_url.hostname = PREFIX_HOST;
       iframe.src = iframe_url;
       test(function() {
         assert_throws("SecurityError", function() { document.domain = SUFFIX_HOST; });
         assert_throws("SecurityError", function() { document.domain = "." + SUFFIX_HOST; });
         assert_throws("SecurityError", function() { document.domain = PREFIX_HOST; });
         assert_throws("SecurityError", function() { document.domain = "example.com"; });
       }, "failed setting of document.domain");
       async_test(function(t) {
-        iframe.addEventListener("load", t.step_func(function() {
+        iframe.addEventListener("load", t.step_func_done(function() {
           // Before setting document.domain, the iframe is not
           // same-origin-domain, so security checks fail.
           assert_equals(iframe.contentDocument, null);
-          assert_equals(iframe.contentWindow.frameElement, null);
+          assert_throws("SecurityError", () => iframe.contentWindow.frameElement);
           assert_throws("SecurityError", function() { iframe.contentWindow.location.origin; });
           assert_throws("SecurityError", function() { iframe.contentWindow.location.href; });
           assert_throws("SecurityError", function() { iframe.contentWindow.location.protocol; });
           assert_throws("SecurityError", function() { iframe.contentWindow.location.host; });
           assert_throws("SecurityError", function() { iframe.contentWindow.location.port; });
           assert_throws("SecurityError", function() { iframe.contentWindow.location.hostname; });
           assert_throws("SecurityError", function() { iframe.contentWindow.location.pathname; });
           assert_throws("SecurityError", function() { iframe.contentWindow.location.hash; });
           assert_throws("SecurityError", function() { iframe.contentWindow.location.search; });
           assert_throws("SecurityError", function() { iframe.contentWindow.location.toString(); });
           // Set document.domain
           document.domain = ORIGINAL_HOST;
           // After setting document.domain, the iframe is
           // same-origin-domain, so security checks pass.
           assert_equals(iframe.contentDocument.domain, document.domain);
-          assert_equals(iframe.contentWindow.frameElement, iframe)
-          assert_equals(iframe.contentWindow.origin, window.origin);
+          assert_equals(iframe.contentWindow.frameElement, iframe);
+          assert_equals(iframe.contentWindow.origin, iframe_url.origin);
           assert_equals(iframe.contentWindow.location.href, iframe_url.href);
           assert_equals(iframe.contentWindow.location.protocol, iframe_url.protocol);
           assert_equals(iframe.contentWindow.location.host, iframe_url.host);
           assert_equals(iframe.contentWindow.location.port, iframe_url.port);
           assert_equals(iframe.contentWindow.location.hostname, iframe_url.hostname);
           assert_equals(iframe.contentWindow.location.pathname, iframe_url.pathname);
           assert_equals(iframe.contentWindow.location.hash, iframe_url.hash);
           assert_equals(iframe.contentWindow.location.search, iframe_url.search);
           assert_equals(iframe.contentWindow.location.search, iframe_url.search);
           assert_equals(iframe.contentWindow.location.toString(), iframe_url.toString());
           // document.open checks for same-origin, not same-origin-domain,
           // https://github.com/whatwg/html/issues/2282
           assert_throws("SecurityError", function() { iframe.contentDocument.open(); });
-          t.done();
         }));
       }, "same-origin-domain iframe");
     </script>
   </body>
 </html>
rename from testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/document_domain_setter_iframe.html
rename to testing/web-platform/tests/html/browsers/origin/relaxing-the-same-origin-restriction/support/document_domain_setter_iframe.html