Bug 1503681 - rel=noopener implicit for target=_blank in anchor and area elements when no rel attribute is set - WPT, r=annevk
☠☠ backed out by 70abf246cac8 ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Tue, 27 Nov 2018 09:31:47 +0100
changeset 507487 c7483919d6be908019b331c09e8ed09394b6b4ae
parent 507486 99ae47766ba9732664c0f828126beadb37220be4
child 507488 9aa0df597d30cd478644423b8848638950b4481e
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersannevk
bugs1503681
milestone65.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 1503681 - rel=noopener implicit for target=_blank in anchor and area elements when no rel attribute is set - WPT, r=annevk
testing/web-platform/meta/html/semantics/links/links-created-by-a-and-area-elements/__dir__.ini
testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/support/target_blank_iplicit_noopener.html
testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/target_blank_implicit_noopener.tentative.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/html/semantics/links/links-created-by-a-and-area-elements/__dir__.ini
@@ -0,0 +1,1 @@
+prefs: [dom.targetBlankNoOpener.enabled:true]
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/support/target_blank_iplicit_noopener.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<script>
+  let bc = new BroadcastChannel(window.location.search.substring(1));
+  bc.postMessage({ hasOpener: opener !== null });
+  window.close();
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/target_blank_implicit_noopener.tentative.html
@@ -0,0 +1,60 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset=utf-8>
+  <title>Test behavior of rel="noopener" links</title>
+  <script src=/resources/testharness.js></script>
+  <script src=/resources/testharnessreport.js></script>
+</head>
+<body>
+  <a href="support/target_blank_iplicit_noopener.html?a1" id="a1" rel="noopener" target="_blank">Click me</a>
+  <a href="support/target_blank_iplicit_noopener.html?a2" id="a2" rel="opener" target="_blank">Click me</a>
+  <a href="support/target_blank_iplicit_noopener.html?a3" id="a3" target="_blank">Click me</a>
+  <a href="support/target_blank_iplicit_noopener.html?a4" id="a4" rel="opener noopener" target="_blank">Click me</a>
+  <a href="support/target_blank_iplicit_noopener.html?a5" id="a5" rel="noopener opener" target="_blank">Click me</a>
+
+  <img src="/images/threecolors.png" />
+    <area shape="rect" coords="0,0,99,50" href="support/target_blank_iplicit_noopener.html?area1" id="area1" rel="noopener" target="_blank" />
+  </img>
+  <img src="/images/threecolors.png" />
+    <area shape="rect" coords="0,0,99,50" href="support/target_blank_iplicit_noopener.html?area2" id="area2" rel="opener" target="_blank" />
+  </img>
+  <img src="/images/threecolors.png" />
+    <area shape="rect" coords="0,0,99,50" href="support/target_blank_iplicit_noopener.html?area3" id="area3" target="_blank" />
+  </img>
+  <img src="/images/threecolors.png" />
+    <area shape="rect" coords="0,0,99,50" href="support/target_blank_iplicit_noopener.html?area4" id="area4" rel="opener noopener" target="_blank" />
+  </img>
+  <img src="/images/threecolors.png" />
+    <area shape="rect" coords="0,0,99,50" href="support/target_blank_iplicit_noopener.html?area5" id="area5" rel="noopener opener" target="_blank" />
+  </img>
+
+  <script>
+
+  let tests = [
+    { id: "a1", hasOpener: false, name: "Anchor element with target=_blank with rel=noopener" },
+    { id: "a2", hasOpener: true, name: "Anchor element with target=_blank with rel=opener" },
+    { id: "a3", hasOpener: false, name: "Anchor element with target=_blank with implicit rel=noopener" },
+    { id: "a4", hasOpener: false, name: "Anchor element with target=_blank with rel=opener+noopener" },
+    { id: "a5", hasOpener: false, name: "Anchor element with target=_blank with rel=noopener+opener" },
+    { id: "area1", hasOpener: false, name: "Area element with target=_blank with rel=noopener" },
+    { id: "area2", hasOpener: true, name: "Area element with target=_blank with rel=opener" },
+    { id: "area3", hasOpener: false, name: "Area element with target=_blank with implicit rel=noopener" },
+    { id: "area4", hasOpener: false, name: "Area element with target=_blank with rel=opener+noopener" },
+    { id: "area5", hasOpener: false, name: "Area element with target=_blank with rel=noopener+opener" },
+  ];
+
+  tests.forEach(data => {
+    async_test(
+      test => {
+        let bc = new BroadcastChannel(data.id);
+        bc.addEventListener("message", test.step_func_done(e => {
+          assert_equals(e.data.hasOpener, data.hasOpener);
+        }), {once: true});
+
+        document.getElementById(data.id).click();
+      }, data.name);
+  });
+  </script>
+</body>
+</html>