Bug 1503681 - rel=noopener implicit for target=_blank in anchor and area elements when no rel attribute is set - fix tests, r=me

This commit is contained in:
Andrea Marchesini 2018-11-28 08:22:06 +01:00
parent 121f00c38e
commit f399725b04
35 changed files with 44 additions and 37 deletions

View File

@ -76,17 +76,17 @@
<body>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=506389"
title="Some same page links do not fire EVENT_SYSTEM_SCROLLINGSTART">
Mozilla Bug 506389
</a><br>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=437607"
title="Clicking the 'Skip to main content' link once works, second time fails to initiate a V cursor jump">
Mozilla Bug 437607
</a><br>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=519303"
title="Same page links to targets with content fires scrolling start accessible event on leaf text node">
Mozilla Bug 519303

View File

@ -135,7 +135,7 @@
<body>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=410765"
title="nsIAccessible actions testing">
Mozilla Bug 410765

View File

@ -77,7 +77,7 @@
<body>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=477975"
title="nsIAccessible actions testing">
Mozilla Bug 477975

View File

@ -63,17 +63,17 @@
<body>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=523789"
title="nsHTMLLiAccessible shouldn't be inherited from linkable accessible">
Mozilla Bug 523789
</a><br>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409"
title="Expose click action if mouseup and mousedown are registered">
Mozilla Bug 423409
</a>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=659620"
title="hang when trying to edit a page on wikimo with NVDA running">
Mozilla Bug 659620

View File

@ -92,12 +92,12 @@
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=410765"
title="nsIAccessible actions testing">
Mozilla Bug 410765
</a>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=504252"
title="Expose STATE_HASPOPUP on XUL elements that have an @popup attribute">
Mozilla Bug 504252

View File

@ -38,7 +38,7 @@
<body>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=381599"
title="Inverse relations cache">
Mozilla Bug 381599

View File

@ -66,7 +66,7 @@
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=672092"
title="Reorganize access key and keyboard shortcut handling code">
Mozilla Bug 672092

View File

@ -116,7 +116,7 @@
<body>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409"
title="Expose click action if mouseup and mousedown are registered">
Mozilla Bug 423409
@ -126,7 +126,7 @@
<pre id="test">
</pre>
<a href="about:mozilla" id="link1" target="_blank">
<a href="about:mozilla" id="link1" target="_blank" rel="opener">
<img src="../moz.png" id="img1">
</a>
<a id="link2" onmousedown="">

View File

@ -116,7 +116,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
</head>
<body>
<a target="_blank"
<a target="_blank" rel="opener"
title="Expose HTML5 video and audio elements' embedded controls through accessibility APIs"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=483573">Mozilla Bug 483573</a>
<p id="display"></p>

View File

@ -81,7 +81,7 @@
<body>
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=673958"
title="Rework accessible focus handling">
Mozilla Bug 673958

View File

@ -100,7 +100,7 @@
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727

View File

@ -165,7 +165,7 @@
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
<a target="_blank" rel="opener"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=503727"
title="Reorganize implementation of XUL tree accessibility">
Mozilla Bug 503727

View File

@ -11,7 +11,7 @@ requestLongerTimeout(2);
function frame_script() {
content.document.body.innerHTML = `
<a href="http://example.com/" target="_blank" id="testAnchor">Open a window</a>
<a href="http://example.com/" target="_blank" rel="opener" id="testAnchor">Open a window</a>
`;
let element = content.document.getElementById("testAnchor");

View File

@ -33,7 +33,7 @@
<li>
<a id="test-create-new-tab-from-targetblank-click"
href="webNav_createdTarget.html#new-tab-from-targetblank-click"
target="_blank">
target="_blank" rel="opener">
Open a target page in a new tab from click to link with target="_blank"
</a>
</li>

View File

@ -33,7 +33,7 @@
<li>
<a id="test-create-new-tab-from-targetblank-click-subframe"
href="webNav_createdTarget.html#new-tab-from-targetblank-click-subframe"
target="_blank">
target="_blank" rel="opener">
Open a target page in a new tab from click to link with target="_blank"
</a>
</li>

View File

@ -116,6 +116,7 @@ function test6() {
function test7() {
testlink.href = "javascript:opener.activationListener(); window.close();";
testlink.target = "_blank";
testlink.rel = "opener";
activationListener =
function() {
ok(true, "Click() should activate a link");
@ -127,6 +128,7 @@ function test7() {
function test8() {
testlink.href = "javascript:opener.activationListener(); window.close();";
testlink.target = "_blank";
testlink.rel = "opener";
activationListener =
function() {
ok(false, "Click() should not activate a link");

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<body onload="document.querySelector('a').click();">
<a href="javascript:opener.document.getElementById('result').textContent = document.cookie;" target="_blank">test</a>
<a href="javascript:opener.document.getElementById('result').textContent = document.cookie;" target="_blank" rel="opener">test</a>
<div id="result">not tested yet</div>
</body>

View File

@ -1,4 +1,4 @@
<!DOCTYPE html>
<meta charset="UTF-8">
<a id="link" href="about:blank" target="_blank"
<a id="link" href="about:blank" target="_blank" rel="opener"
onclick="document.body.requestFullscreen()">Click here</a>

View File

@ -30,7 +30,7 @@
<body onLoad="doStuff()">
I am sandboxed but with "allow-scripts allow-same-origin"
<a href="file_iframe_sandbox_open_window_fail.html" target="_blank" id="target_blank">open window</a>
<a href="file_iframe_sandbox_open_window_fail.html" target="_blank" id="target_blank" rel="opener">open window</a>
<a href="file_iframe_sandbox_open_window_fail.html" target="BC341604" id="target_BC341604">open window</a>
</body>
</html>

View File

@ -28,7 +28,7 @@
<body onLoad="doStuff()">
I am sandboxed but with "allow-popups allow-scripts allow-same-origin"
<a href="file_iframe_sandbox_open_window_pass.html" target="_blank" id="target_blank">open window</a>
<a href="file_iframe_sandbox_open_window_pass.html" target="_blank" rel="opener" id="target_blank">open window</a>
<a href="file_iframe_sandbox_open_window_pass.html?BC766282" target="BC766282" id="target_BC766282">open window</a>
</body>
</html>

View File

@ -41,7 +41,7 @@
This was opened in an iframe with "allow-scripts allow-popups allow-same-origin".
However allow-same-origin was removed from the iframe before navigating to me,
so I should only have "allow-scripts allow-popups" in force.
<a href="file_iframe_sandbox_k_if2.html" target="_blank" id="target_blank_if2">open window</a>
<a href="file_iframe_sandbox_k_if2.html" target="_blank" id="target_blank_if2" rel="opener">open window</a>
<a href="file_iframe_sandbox_k_if2.html" target="BC766282_if2" id="target_BC766282_if2">open window</a>
</body>
</html>

View File

@ -25,10 +25,10 @@
<body onLoad="doStuff()">
I am sandboxed with "allow-scripts allow-popups allow-same-origin allow-forms allow-top-navigation".
<a href="file_iframe_sandbox_k_if5.html" target="_blank" id="target_blank_if5">open window</a>
<a href="file_iframe_sandbox_k_if5.html" target="_blank" id="target_blank_if5" rel="opener">open window</a>
<a href="file_iframe_sandbox_k_if5.html" target="BC766282_if5" id="target_BC766282_if5">open window</a>
<a href="file_iframe_sandbox_k_if7.html" target="_blank" id="target_blank_if7">open window</a>
<a href="file_iframe_sandbox_k_if7.html" target="_blank" id="target_blank_if7" rel="opener">open window</a>
<a href="file_iframe_sandbox_k_if7.html" target="BC766282_if7" id="target_BC766282_if7">open window</a>
</body>
</html>

View File

@ -26,7 +26,7 @@
After my initial load, "allow-same-origin" is removed and then I open file_iframe_sandbox_k_if9.html
in 3 different ways, which attemps to call a function in my parent.
This should succeed since the new sandbox flags shouldn't have taken affect on me until I'm reloaded.
<a href="file_iframe_sandbox_k_if9.html" target="_blank" id="target_blank_if9">open window</a>
<a href="file_iframe_sandbox_k_if9.html" target="_blank" id="target_blank_if9" rel="opener">open window</a>
<a href="file_iframe_sandbox_k_if9.html" target="BC766282_if9" id="target_BC766282_if9">open window</a>
Now navigate to file_iframe_sandbox_k_if1.html to do tests for a sandbox opening a window

View File

@ -1,5 +1,5 @@
<html>
<body>
<a id="link" href="file_window_open_close_inner.html" target="_blank" onclick="setTimeout(function () { window.close() }, 0)">link</a>
<a id="link" href="file_window_open_close_inner.html" target="_blank" rel="opener" onclick="setTimeout(function () { window.close() }, 0)">link</a>
</html>
</body>

View File

@ -9,7 +9,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=841850
<title>Tests for Mixed Content Frame Navigation</title>
</head>
<body>
<a href="http://example.com/tests/dom/security/test/mixedcontentblocker/file_frameNavigation_innermost.html?blankTarget" id="blankTarget" target="_blank">Go to http site</a>
<a href="http://example.com/tests/dom/security/test/mixedcontentblocker/file_frameNavigation_innermost.html?blankTarget" id="blankTarget" target="_blank" rel="opener">Go to http site</a>
<script>
var blankTarget = document.getElementById("blankTarget");

View File

@ -1,4 +1,4 @@
<a id="test1" href="test_noopener_target.html" target="_blank">1</a>
<a id="test1" href="test_noopener_target.html" target="_blank" rel="opener">1</a>
<a id="test2" href="test_noopener_target.html" target="_blank" rel="noopener">2</a>
<a id="test3" href="test_noopener_target.html" target="_blank" rel="noreferrer">3</a>

View File

@ -16,8 +16,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=458091
</div>
<pre id="test">
<a id="testlink1" target="_blank" href="javascript:window.opener.finish(sessionStorage['testItem']);window.close();">Javascript Link</a>
<a id="testlink2" target="_blank" href="bug458091_child.html">HTTP Link</a>
<a id="testlink1" target="_blank" rel="opener" href="javascript:window.opener.finish(sessionStorage['testItem']);window.close();">Javascript Link</a>
<a id="testlink2" target="_blank" rel="opener" href="bug458091_child.html">HTTP Link</a>
<a id="testlink3" target="alreadyOpened" href="bug458091_child.html">Target Link</a>
<script type="application/javascript">

View File

@ -1,7 +1,7 @@
<html>
<head><title>Hello, world!</title></head>
<body>
<a id="targetBlankLink" target="_blank" href="newSession_child.html">target="_blank"</a>
<a id="targetBlankLink" target="_blank" rel="opener" href="newSession_child.html">target="_blank"</a>
<a id="noOpenerLink" target="_blank" rel="noopener" href="http://example.com">rel="noopener"</a>
</body>
</html>

View File

@ -0,0 +1 @@
prefs: [dom.targetBlankNoOpener.enabled:false]

View File

@ -0,0 +1 @@
prefs: [dom.targetBlankNoOpener.enabled:false]

View File

@ -0,0 +1 @@
prefs: [dom.targetBlankNoOpener.enabled:false]

View File

@ -0,0 +1 @@
prefs: [dom.targetBlankNoOpener.enabled:false]

View File

@ -338,6 +338,7 @@ function addLink(file) {
let a = document.createElement("a");
a.setAttribute("href", file);
a.setAttribute("target", "_blank");
a.setAttribute("rel", "opener");
document.body.appendChild(a);
return a;
}

View File

@ -42,7 +42,7 @@ add_task(async function test_target_blank_link() {
<html>
<head><meta charset="utf-8"></html>
<body>
<a href="${linkURL}" target="_blank" id="link">link</a>
<a href="${linkURL}" target="_blank" id="link" rel="opener">link</a>
</body>
</html>`,
},

View File

@ -13,7 +13,7 @@
</head>
<body>
<a href="download.bin" id="regular_load">regular load</a>
<a href="download.bin" id="target_blank" target="_blank">target blank</a>
<a href="download.bin" id="target_blank" target="_blank" rel="opener">target blank</a>
<a href="#" onclick="launch_download(); return false" id="new_window">new window</a>
<a href="#" onclick="window.open('download_page.html?newwin'); return false" id="open_in_new_tab">click to reopen</a>
</body>