Bug 1463510 [wpt PR 11104] - Fix race condition in frameElement.html., a=testonly
authorarthursonzogni <arthursonzogni@chromium.org>
Wed, 06 Jun 2018 14:46:58 +0000
changeset 422146 4974dd754e87bd571438ea2d2881f60e711494b1
parent 422145 f89c4982a46dd8111c3463d6efb5c566c46708fa
child 422147 6801a998b9dd4e159b80a4f3ab47e007e27de695
push id34122
push userebalazs@mozilla.com
push dateMon, 11 Jun 2018 09:37:00 +0000
treeherdermozilla-central@9941eb8c3b29 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1463510, 11104, 831155, 1069013, 561659
milestone62.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 1463510 [wpt PR 11104] - Fix race condition in frameElement.html., a=testonly Automatic update from web-platform-testsFix race condition in frameElement.html. I am working on https://crbug.com/831155. Some tests that are relying on how things are scheduled in Blink are failing. There was a race condition in this test. The iframe "#fr2" was asked to navigate to a first URL, but soon after, a javascript function modifies the iframe.src to navigate elsewhere. What happened when it didn't work? 1) The first navigation starts. 2) The second navigation is scheduled (See blink's NavigationScheduler) 3) The first navigation commits. FrameLoader::CommitProvisionalLoad() executes: frame_->GetNavigationScheduler().Cancel(). It cancels the second navigation. This CL fixes the race condition. Bug: 831155 Change-Id: I2dd951140b4c5a671c749348ca0247f1901d8b77 Reviewed-on: https://chromium-review.googlesource.com/1069013 Commit-Queue: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/master@{#561659} -- wpt-commits: a89693b62066da0e4808c0bc76c581188398e73d wpt-pr: 11104
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.html
testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -336427,19 +336427,19 @@
     ]
    ],
    "html/browsers/windows/browsing-context.html": [
     [
      "/html/browsers/windows/browsing-context.html",
      {}
     ]
    ],
-   "html/browsers/windows/nested-browsing-contexts/frameElement.html": [
-    [
-     "/html/browsers/windows/nested-browsing-contexts/frameElement.html",
+   "html/browsers/windows/nested-browsing-contexts/frameElement.sub.html": [
+    [
+     "/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html",
      {}
     ]
    ],
    "html/browsers/windows/nested-browsing-contexts/window-parent-null.html": [
     [
      "/html/browsers/windows/nested-browsing-contexts/window-parent-null.html",
      {}
     ]
@@ -569094,18 +569094,18 @@
   "html/browsers/windows/nested-browsing-contexts/.gitkeep": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
   "html/browsers/windows/nested-browsing-contexts/contains.json": [
    "0f2e164f656015ba43e2b3471af67a5d16fb97ea",
    "support"
   ],
-  "html/browsers/windows/nested-browsing-contexts/frameElement.html": [
-   "9272ddfc9d2d7301e7adadc5ca06f03d9a224b1f",
+  "html/browsers/windows/nested-browsing-contexts/frameElement.sub.html": [
+   "480ab947e93b63641f6920b17851ae2d98605b5c",
    "testharness"
   ],
   "html/browsers/windows/nested-browsing-contexts/resources/frameElement-nested-frame.html": [
    "f9b0142274439bb5e64cd35758c2573b7ff4dfd8",
    "support"
   ],
   "html/browsers/windows/nested-browsing-contexts/resources/frameElement-window-post.html": [
    "e18bdb8a34bcf88b92e9b73ce75ed3a412889b09",
deleted file mode 100644
--- a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.html
+++ /dev/null
@@ -1,74 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8"/>
-<title>HTML Test: window.frameElement</title>
-<link rel="author" title="Intel" href="http://www.intel.com/" />
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/common/get-host-info.sub.js"></script>
-<script>
-
-var t1 = async_test("The window's frameElement attribute must return its container element if it is a nested browsing context");
-var t2 = async_test("The SecurityError must be thrown if the window accesses to frameElement attribute of a Window which does not have the same effective script origin");
-var t3 = async_test("The window's frameElement attribute must return null if the container's document does not have the same effective script origin");
-
-function on_load() {
-  t1.step(function () {
-    assert_equals(frames[0].frameElement, document.getElementById("fr1"),
-                  "The frameElement attribute should be the first iframe element.");
-    assert_equals(window["win2"].frameElement, document.getElementById("obj"),
-                  "The frameElement attribute should be the object element.");
-    assert_equals(window["win3"].frameElement, document.getElementById("emb"),
-                  "The frameElement attribute should be the embed element.");
-    assert_equals(document.getElementById("fr4").contentWindow[0].frameElement,
-                  document.getElementById("fr4").contentDocument.getElementById("f1"),
-                  "The frameElement attribute should be the frame element in 'resources/frameElement-nested-frame.html'.");
-  });
-  t1.done();
-
-  t2.step(function () {
-    assert_throws("SecurityError", function () { frames[1].frameElement; },
-                  "The SecurityError exception should be thrown.");
-  });
-  t2.done();
-
-  t3.step(function () {
-    document.getElementById("fr5").contentWindow.postMessage(null, "*");
-  });
-  window.addEventListener("message", function (event) {
-    var data = JSON.parse(event.data);
-    if (data.name == "testcase3") {
-      t3.step(function () {
-        assert_equals(data.result, "window.frameElement = null",
-                      "The frameElement attribute should be null.");
-      });
-      t3.done();
-    }
-  }, false);
-}
-
-</script>
-<body onload="on_load()">
-  <div id="log"></div>
-  <iframe id="fr1"></iframe>
-  <iframe id="fr2" src="resources/frameElement-nested-frame.html"></iframe> <!-- cross origin -->
-  <iframe id="fr3" src="" style="display:none"></iframe>
-  <object id="obj" name="win2" type="text/html" data="about:blank"></object>
-  <embed id="emb" name="win3" type="image/svg+xml" src="/images/green.svg" />
-  <iframe id="fr4" src="resources/frameElement-nested-frame.html"></iframe> <!-- same origin -->
-  <iframe id="fr5" src="resources/frameElement-window-post.html"></iframe> <!-- cross origin -->
-  <script>
-
-  setup(function () {
-    var src_base = get_host_info().HTTP_REMOTE_ORIGIN;
-    src_base += document.location.pathname.substring(0, document.location.pathname.lastIndexOf("/") + 1);
-    document.getElementById("fr2").src = src_base + "/resources/frameElement-nested-frame.html";
-    document.getElementById("fr5").src = src_base + "/resources/frameElement-window-post.html";
-  });
-
-  test(function () {
-    assert_equals(window.frameElement, null,
-                  "The frameElement attribute should be null.");
-  }, "The window's frameElement attribute must return null if it is not a nested browsing context");
-
-  </script>
-</body>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>HTML Test: window.frameElement</title>
+<link rel="author" title="Intel" href="http://www.intel.com/" />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+
+var t1 = async_test("The window's frameElement attribute must return its container element if it is a nested browsing context");
+var t2 = async_test("The SecurityError must be thrown if the window accesses to frameElement attribute of a Window which does not have the same effective script origin");
+var t3 = async_test("The window's frameElement attribute must return null if the container's document does not have the same effective script origin");
+
+function on_load() {
+  t1.step(function () {
+    assert_equals(frames[0].frameElement, document.getElementById("fr1"),
+                  "The frameElement attribute should be the first iframe element.");
+    assert_equals(window["win2"].frameElement, document.getElementById("obj"),
+                  "The frameElement attribute should be the object element.");
+    assert_equals(window["win3"].frameElement, document.getElementById("emb"),
+                  "The frameElement attribute should be the embed element.");
+    assert_equals(document.getElementById("fr4").contentWindow[0].frameElement,
+                  document.getElementById("fr4").contentDocument.getElementById("f1"),
+                  "The frameElement attribute should be the frame element in 'resources/frameElement-nested-frame.html'.");
+  });
+  t1.done();
+
+  t2.step(function () {
+    assert_throws("SecurityError", function () { frames[1].frameElement; },
+                  "The SecurityError exception should be thrown.");
+  });
+  t2.done();
+
+  t3.step(function () {
+    document.getElementById("fr5").contentWindow.postMessage(null, "*");
+  });
+  window.addEventListener("message", function (event) {
+    var data = JSON.parse(event.data);
+    if (data.name == "testcase3") {
+      t3.step(function () {
+        assert_equals(data.result, "window.frameElement = null",
+                      "The frameElement attribute should be null.");
+      });
+      t3.done();
+    }
+  }, false);
+}
+
+</script>
+<body onload="on_load()">
+  <div id="log"></div>
+  <iframe id="fr1"></iframe>
+  <iframe id="fr2" src="http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/nested-browsing-contexts/resources/frameElement-nested-frame.html"></iframe><!--cross origin -->
+  <iframe id="fr3" src="" style="display:none"></iframe>
+  <object id="obj" name="win2" type="text/html" data="about:blank"></object>
+  <embed id="emb" name="win3" type="image/svg+xml" src="/images/green.svg" />
+  <iframe id="fr4" src="resources/frameElement-nested-frame.html"></iframe> <!-- same origin -->
+  <iframe id="fr5" src="http://{{hosts[alt][]}}:{{ports[http][0]}}/html/browsers/windows/nested-browsing-contexts/resources/frameElement-window-post.html"></iframe> <!-- cross origin -->
+  <script>
+
+  test(function () {
+    assert_equals(window.frameElement, null,
+                  "The frameElement attribute should be null.");
+  }, "The window's frameElement attribute must return null if it is not a nested browsing context");
+
+  </script>
+</body>