Bug 1700871 - Only allow focus move for links / form submission iff actually handling user input. r=smaug

The other navigation that allows focus moves (window.open) already goes
through the popup blocker, so that one is fine.

I think given how weird yet conservative other browsers are, this should
be a good trade-off to avoid false positives.

Differential Revision: https://phabricator.services.mozilla.com/D110196
This commit is contained in:
Emilio Cobos Álvarez
2021-03-31 01:51:46 +00:00
parent 591fcc402b
commit b6fe451bdc
7 changed files with 102 additions and 37 deletions

View File

@@ -825,6 +825,7 @@ nsresult HTMLFormElement::SubmitSubmission(
loadState->SetTriggeringPrincipal(NodePrincipal());
loadState->SetPrincipalToInherit(NodePrincipal());
loadState->SetCsp(GetCsp());
loadState->SetAllowFocusMove(UserActivation::IsHandlingUserInput());
rv = nsDocShell::Cast(container)->OnLinkClickSync(this, loadState, false,
NodePrincipal());