Bug 1116977 - disallow link clicks during beforeunload, r=smaug

--HG--
extra : rebase_source : 48e4d19b5f76077f91432644b22c736d06ed3218
This commit is contained in:
Gijs Kruitbosch 2015-01-23 15:35:10 +00:00
parent 6fbdd616e8
commit 9afcd38d44
2 changed files with 25 additions and 2 deletions

View File

@ -13187,7 +13187,7 @@ nsDocShell::OnLinkClick(nsIContent* aContent,
{ {
NS_ASSERTION(NS_IsMainThread(), "wrong thread"); NS_ASSERTION(NS_IsMainThread(), "wrong thread");
if (!IsOKToLoadURI(aURI)) { if (!IsNavigationAllowed() || !IsOKToLoadURI(aURI)) {
return NS_OK; return NS_OK;
} }
@ -13243,7 +13243,7 @@ nsDocShell::OnLinkClickSync(nsIContent *aContent,
*aRequest = nullptr; *aRequest = nullptr;
} }
if (!IsOKToLoadURI(aURI)) { if (!IsNavigationAllowed() || !IsOKToLoadURI(aURI)) {
return NS_OK; return NS_OK;
} }

View File

@ -113,6 +113,29 @@ var testFns = [
e.target.location.replace('otherpage-location-replaced.html'); e.target.location.replace('otherpage-location-replaced.html');
return "stop"; return "stop";
}, },
function(e) {
var link = e.target.createElement('a');
link.href = "otherpage.html";
e.target.body.appendChild(link);
link.click();
return "stop";
},
function(e) {
var link = e.target.createElement('a');
link.href = "otherpage.html";
link.setAttribute("target", "_blank");
e.target.body.appendChild(link);
link.click();
return "stop";
},
function(e) {
var link = e.target.createElement('a');
link.href = e.target.location.href;
e.target.body.appendChild(link);
link.setAttribute("target", "somearbitrarywindow");
link.click();
return "stop";
},
]; ];
function runNextTest() { function runNextTest() {