diff --git a/browser/actors/ClickHandlerParent.sys.mjs b/browser/actors/ClickHandlerParent.sys.mjs index bdb722d95870..bd3112f1a57a 100644 --- a/browser/actors/ClickHandlerParent.sys.mjs +++ b/browser/actors/ClickHandlerParent.sys.mjs @@ -119,6 +119,7 @@ export class ClickHandlerParent extends JSWindowActorParent { openerBrowser: browser, // The child ensures that untrusted events have a valid user activation. hasValidUserGestureActivation: true, + textDirectiveUserActivation: true, triggeringRemoteType: this.manager.domProcess?.remoteType, }; diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js index ae8c3b7ca628..e0e087b893c1 100644 --- a/browser/components/tabbrowser/content/tabbrowser.js +++ b/browser/components/tabbrowser/content/tabbrowser.js @@ -2692,6 +2692,8 @@ globalHistoryOptions, triggeringRemoteType, wasSchemelessInput, + hasValidUserGestureActivation = false, + textDirectiveUserActivation = false, } = {} ) { // all callers of addTab that pass a params object need to pass @@ -2880,8 +2882,10 @@ triggeringRemoteType, wasSchemelessInput, hasValidUserGestureActivation: + hasValidUserGestureActivation || !!openWindowInfo?.hasValidUserGestureActivation, textDirectiveUserActivation: + textDirectiveUserActivation || !!openWindowInfo?.textDirectiveUserActivation, }); } diff --git a/browser/modules/URILoadingHelper.sys.mjs b/browser/modules/URILoadingHelper.sys.mjs index 413a28af3689..9a226943c73d 100644 --- a/browser/modules/URILoadingHelper.sys.mjs +++ b/browser/modules/URILoadingHelper.sys.mjs @@ -445,6 +445,8 @@ export const URILoadingHelper = { resolveOnNewTabCreated, resolveOnContentBrowserCreated, globalHistoryOptions, + hasValidUserGestureActivation, + textDirectiveUserActivation, } = params; // We want to overwrite some things for convenience when passing it to other @@ -588,6 +590,8 @@ export const URILoadingHelper = { fromExternal: params.fromExternal, globalHistoryOptions, wasSchemelessInput: params.wasSchemelessInput, + hasValidUserGestureActivation, + textDirectiveUserActivation, }); targetBrowser = tabUsedForLoad.linkedBrowser; diff --git a/testing/web-platform/meta/scroll-to-text-fragment/scroll-to-text-fragment-open-link-in-new-tab-desktop.html.ini b/testing/web-platform/meta/scroll-to-text-fragment/scroll-to-text-fragment-open-link-in-new-tab-desktop.html.ini new file mode 100644 index 000000000000..a8c329f7cb5c --- /dev/null +++ b/testing/web-platform/meta/scroll-to-text-fragment/scroll-to-text-fragment-open-link-in-new-tab-desktop.html.ini @@ -0,0 +1,5 @@ +[scroll-to-text-fragment-open-link-in-new-tab-desktop.html] + expected: + if os == "android": TIMEOUT + [Test that the text fragment directive requires a user activation when invoked by clicking a link in the same or a new tab] + expected: if os == "android": TIMEOUT diff --git a/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-open-link-in-new-tab-desktop.html b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-open-link-in-new-tab-desktop.html new file mode 100644 index 000000000000..01efe38f8f17 --- /dev/null +++ b/testing/web-platform/tests/scroll-to-text-fragment/scroll-to-text-fragment-open-link-in-new-tab-desktop.html @@ -0,0 +1,28 @@ + +Navigating to a text fragment directive in a new tab + + + + + + + + + + +