Backed out 3 changesets (bug 1503681) for landing incorrectly on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Tue, 27 Nov 2018 10:42:27 +0200
changeset 448273 70abf246cac81298bb518e1dcaf07ed24cd1512e
parent 448272 9aa0df597d30cd478644423b8848638950b4481e
child 448274 f3361f0816dd2a7e63d1acb92e23b74f0e8f0f30
push id35108
push userrmaries@mozilla.com
push dateTue, 27 Nov 2018 17:33:10 +0000
treeherdermozilla-central@f83dcdf69769 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1503681
milestone65.0a1
backs out9aa0df597d30cd478644423b8848638950b4481e
c7483919d6be908019b331c09e8ed09394b6b4ae
99ae47766ba9732664c0f828126beadb37220be4
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
Backed out 3 changesets (bug 1503681) for landing incorrectly on a CLOSED TREE Backed out changeset 9aa0df597d30 (bug 1503681) Backed out changeset c7483919d6be (bug 1503681) Backed out changeset 99ae47766ba9 (bug 1503681)
docshell/base/nsDocShell.cpp
dom/html/test/browser.ini
dom/html/test/browser_targetBlankNoOpener.js
dom/html/test/empty.html
dom/html/test/image_yellow.png
modules/libpref/init/StaticPrefList.h
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
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -13284,53 +13284,28 @@ nsDocShell::OnLinkClickSync(nsIContent* 
   }
 
   uint32_t flags = INTERNAL_LOAD_FLAGS_NONE;
   if (IsElementAnchorOrArea(aContent)) {
     MOZ_ASSERT(aContent->IsHTMLElement());
     nsAutoString referrer;
     aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::rel, referrer);
     nsWhitespaceTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tok(referrer);
-
-    bool targetBlank = aTargetSpec.LowerCaseEqualsLiteral("_blank");
-    bool explicitOpenerSet = false;
-
-    // The opener behaviour follows a hierarchy, such that if a higher priority
-    // behaviour is specified, it always takes priority. That priority is
-    // currently: norefrerer > noopener > opener > default
-
     while (tok.hasMoreTokens()) {
       const nsAString& token = tok.nextToken();
       if (token.LowerCaseEqualsLiteral("noreferrer")) {
         flags |= INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER |
                  INTERNAL_LOAD_FLAGS_NO_OPENER;
-        // noreferrer cannot be overwritten by a 'rel=opener'.
-        explicitOpenerSet = true;
+        // We now have all the flags we could possibly have, so just stop.
         break;
       }
-
       if (token.LowerCaseEqualsLiteral("noopener")) {
         flags |= INTERNAL_LOAD_FLAGS_NO_OPENER;
-        explicitOpenerSet = true;
-      }
-
-      if (targetBlank &&
-          StaticPrefs::dom_targetBlankNoOpener_enabled() &&
-          token.LowerCaseEqualsLiteral("opener") &&
-          !explicitOpenerSet) {
-        explicitOpenerSet = true;
-      }
-    }
-
-    if (targetBlank &&
-        StaticPrefs::dom_targetBlankNoOpener_enabled() &&
-        !explicitOpenerSet) {
-      flags |= INTERNAL_LOAD_FLAGS_NO_OPENER;
-    }
-
+      }
+    }
     if (aNoOpenerImplied) {
       flags |= INTERNAL_LOAD_FLAGS_NO_OPENER;
     }
   }
 
   // Get the owner document of the link that was clicked, this will be
   // the document that the link is in, or the last document that the
   // link was in. From that document, we'll get the URI to use as the
--- a/dom/html/test/browser.ini
+++ b/dom/html/test/browser.ini
@@ -32,12 +32,8 @@ tags = fullscreen
 [browser_fullscreen-newtab.js]
 tags = fullscreen
 support-files = file_fullscreen-newtab.html
 skip-if = os == 'mac' # bug 1494843
 [browser_submission_flush.js]
 [browser_refresh_wyciwyg_url.js]
 support-files =
   file_refresh_wyciwyg_url.html
-[browser_targetBlankNoOpener.js]
-support-files =
-  empty.html
-  image_yellow.png
deleted file mode 100644
--- a/dom/html/test/browser_targetBlankNoOpener.js
+++ /dev/null
@@ -1,83 +0,0 @@
-const TEST_URL = "http://mochi.test:8888/browser/dom/html/test/empty.html";
-
-async function checkOpener(browser, elm, name, rel) {
-  let p = BrowserTestUtils.waitForNewTab(gBrowser, null, true, true);
-
-  await ContentTask.spawn(browser, {url: TEST_URL, name, rel, elm }, async obj => {
-    let element;
-
-    if (obj.elm == "anchor") {
-      element = content.document.createElement("a");
-      content.document.body.appendChild(element);
-      element.appendChild(content.document.createTextNode(obj.name));
-    } else {
-      let img = content.document.createElement('img');
-      img.src = "image_yellow.png";
-      content.document.body.appendChild(img);
-
-      element = content.document.createElement("area");
-      img.appendChild(element);
-
-      element.setAttribute("shape", "rect");
-      element.setAttribute("coords", "0,0,100,100");
-    }
-
-    element.setAttribute("target", "_blank");
-    element.setAttribute("href", obj.url);
-
-    if (obj.rel) {
-      element.setAttribute("rel", obj.rel);
-    }
-
-    element.click();
-  });
-
-  let newTab = await p;
-  let newBrowser = gBrowser.getBrowserForTab(newTab);
-
-  let hasOpener = await ContentTask.spawn(newTab.linkedBrowser, null, _ => !!content.window.opener);
-
-  BrowserTestUtils.removeTab(newTab);
-  return hasOpener;
-}
-
-async function runTests(browser, elm) {
-  info("Creating an " + elm + " with target=_blank rel=opener");
-  ok(!!(await checkOpener(browser, elm, "rel=opener", "opener")), "We want the opener with rel=opener");
-
-  info("Creating an " + elm + " with target=_blank rel=noopener");
-  ok(!(await checkOpener(browser, elm, "rel=noopener", "noopener")), "We don't want the opener with rel=noopener");
-
-  info("Creating an " + elm + " with target=_blank");
-  ok(!(await checkOpener(browser, elm, "no rel", null)), "We don't want the opener with no rel is passed");
-
-  info("Creating an " + elm + " with target=_blank rel='noopener opener'");
-  ok(!(await checkOpener(browser, elm, "rel=noopener+opener", "noopener opener")), "noopener wins with rel=noopener+opener");
-
-  info("Creating an " + elm + " with target=_blank rel='noreferrer opener'");
-  ok(!(await checkOpener(browser, elm, "noreferrer wins", "noreferrer opener")), "We don't want the opener with rel=noreferrer+opener");
-
-  info("Creating an " + elm + " with target=_blank rel='opener noreferrer'");
-  ok(!(await checkOpener(browser, elm, "noreferrer wins again", "noreferrer opener")), "We don't want the opener with rel=opener+noreferrer");
-}
-
-add_task(async _ => {
-  await SpecialPowers.flushPrefEnv();
-  await SpecialPowers.pushPrefEnv({"set": [
-    ["dom.block_multiple_popups", false],
-    ["dom.disable_open_during_load", true],
-    ["dom.targetBlankNoOpener.enabled", true],
-  ]});
-
-  let tab = BrowserTestUtils.addTab(gBrowser, TEST_URL);
-  gBrowser.selectedTab = tab;
-
-  let browser = gBrowser.getBrowserForTab(tab);
-  await BrowserTestUtils.browserLoaded(browser);
-
-  await runTests(browser, 'anchor');
-  await runTests(browser, 'area');
-
-  info("Removing the tab");
-  BrowserTestUtils.removeTab(tab);
-});
deleted file mode 100644
--- a/dom/html/test/empty.html
+++ /dev/null
@@ -1,1 +0,0 @@
-<html><body></body></html>
deleted file mode 100644
index 51e8aaf38c1b3a105fc6038c93b5648a4bf9efd4..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -447,26 +447,16 @@ VARCACHE_PREF(
 
 // Block multiple window.open() per single event.
 VARCACHE_PREF(
   "dom.block_multiple_popups",
    dom_block_multiple_popups,
   bool, true
 )
 
-// For area and anchor elements with target=_blank and no rel set to
-// opener/noopener.
-#define PREF_VALUE false
-#endif
-VARCACHE_PREF(
-  "dom.targetBlankNoOpener.enabled",
-   dom_targetBlankNoOpener_enabled,
-  bool, false
-)
-
 //---------------------------------------------------------------------------
 // Clear-Site-Data prefs
 //---------------------------------------------------------------------------
 
 VARCACHE_PREF(
   "dom.clearSiteData.enabled",
    dom_clearSiteData_enabled,
   bool, true
deleted file mode 100644
--- a/testing/web-platform/meta/html/semantics/links/links-created-by-a-and-area-elements/__dir__.ini
+++ /dev/null
@@ -1,1 +0,0 @@
-prefs: [dom.targetBlankNoOpener.enabled:true]
deleted file mode 100644
--- a/testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/support/target_blank_iplicit_noopener.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<!DOCTYPE html>
-<script>
-  let bc = new BroadcastChannel(window.location.search.substring(1));
-  bc.postMessage({ hasOpener: opener !== null });
-  window.close();
-</script>
deleted file mode 100644
--- a/testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/target_blank_implicit_noopener.tentative.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!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>