Bug 1888756, part 2 - Text Fragments: Implement setting the textDirectiveUserActivation flag in the document loading algorithm. r=edgar,dom-core
This commit is a prerequisite for part 5 of this patch set. This flag is set in the docshell, based on `user gesture activation`. This is not necessarily sufficient, as the text fragments spec bases the value of this flag also on User Involvement, which is not implemented in Gecko yet. The flag is then plumbed through the parent process (`DocumentLoadListener::CreateDocumentLoadInfo()`) to the document, where it can be consumed. This includes client-side redirects as described in [0]. There is no changed behavior in this commit. [0] https://wicg.github.io/scroll-to-text-fragment/#restricting-the-text-fragment Differential Revision: https://phabricator.services.mozilla.com/D212817
This commit is contained in:
@@ -874,6 +874,13 @@ nsresult HTMLFormElement::SubmitSubmission(
|
||||
loadState->SetCsp(GetCsp());
|
||||
loadState->SetAllowFocusMove(UserActivation::IsHandlingUserInput());
|
||||
|
||||
const bool hasValidUserGestureActivation =
|
||||
doc->HasValidTransientUserGestureActivation();
|
||||
loadState->SetHasValidUserGestureActivation(hasValidUserGestureActivation);
|
||||
loadState->SetTextDirectiveUserActivation(
|
||||
doc->ConsumeTextDirectiveUserActivation() ||
|
||||
hasValidUserGestureActivation);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> nodePrincipal = NodePrincipal();
|
||||
rv = container->OnLinkClickSync(this, loadState, false, nodePrincipal);
|
||||
NS_ENSURE_SUBMIT_SUCCESS(rv);
|
||||
|
||||
Reference in New Issue
Block a user