Backed out 2 changesets (bug 1901064) for blocking the backout of bug 1888756

Backed out changeset 0e582d262ca8 (bug 1901064)
Backed out changeset 992a876144a0 (bug 1901064)
This commit is contained in:
Sebastian Hengst
2024-06-21 12:07:33 +02:00
parent 560cc55d72
commit e43a62744c
17 changed files with 284 additions and 108 deletions

View File

@@ -2854,10 +2854,6 @@
globalHistoryOptions,
triggeringRemoteType,
wasSchemelessInput,
hasValidUserGestureActivation:
!!openWindowInfo?.hasValidUserGestureActivation,
textDirectiveUserActivation:
!!openWindowInfo?.textDirectiveUserActivation,
});
}
@@ -3098,8 +3094,6 @@
globalHistoryOptions,
triggeringRemoteType,
wasSchemelessInput,
hasValidUserGestureActivation,
textDirectiveUserActivation,
}
) {
if (
@@ -3164,8 +3158,6 @@
globalHistoryOptions,
triggeringRemoteType,
wasSchemelessInput,
hasValidUserGestureActivation,
textDirectiveUserActivation,
});
} catch (ex) {
console.error(ex);

View File

@@ -456,7 +456,7 @@ nsresult nsDocShellLoadState::CreateFromLoadURIOptions(
loadState->SetHasValidUserGestureActivation(
aLoadURIOptions.mHasValidUserGestureActivation);
loadState->SetTextDirectiveUserActivation(
aLoadURIOptions.mTextDirectiveUserActivation);
aLoadURIOptions.mHasValidUserGestureActivation);
loadState->SetTriggeringSandboxFlags(aLoadURIOptions.mTriggeringSandboxFlags);
loadState->SetTriggeringWindowId(aLoadURIOptions.mTriggeringWindowId);
loadState->SetTriggeringStorageAccess(

View File

@@ -68,11 +68,7 @@ dictionary LoadURIOptions {
*/
boolean hasValidUserGestureActivation = false;
/**
* Indicates if there is a user activation for text directives,
* which would allow to scroll to the first text directive.
*/
boolean textDirectiveUserActivation = false;
/**
* The SandboxFlags of the entity thats
* responsible for causing the load.

View File

@@ -993,8 +993,7 @@ nsresult ContentChild::ProvideWindowCommon(
aChromeFlags & nsIWebBrowserChrome::CHROME_FISSION_WINDOW;
uint32_t parentSandboxFlags = parent->SandboxFlags();
Document* doc = parent->GetDocument();
if (doc) {
if (Document* doc = parent->GetDocument()) {
parentSandboxFlags = doc->GetSandboxFlags();
}
@@ -1036,32 +1035,11 @@ nsresult ContentChild::ProvideWindowCommon(
MOZ_DIAGNOSTIC_ASSERT(!nsContentUtils::IsSpecialName(name));
const bool hasValidUserGestureActivation = [aLoadState, doc] {
if (aLoadState) {
return aLoadState->HasValidUserGestureActivation();
}
if (doc) {
return doc->HasValidTransientUserGestureActivation();
}
return false;
}();
const bool textDirectiveUserActivation = [aLoadState, doc] {
if (doc && doc->ConsumeTextDirectiveUserActivation()) {
return true;
}
if (aLoadState) {
return aLoadState->GetTextDirectiveUserActivation();
}
return false;
}() || hasValidUserGestureActivation;
Unused << SendCreateWindowInDifferentProcess(
aTabOpener, parent, aChromeFlags, aCalledFromJS,
aOpenWindowInfo->GetIsTopLevelCreatedByWebContent(), aURI, features,
aModifiers, name, triggeringPrincipal, csp, referrerInfo,
aOpenWindowInfo->GetOriginAttributes(), hasValidUserGestureActivation,
textDirectiveUserActivation);
aOpenWindowInfo->GetOriginAttributes());
// We return NS_ERROR_ABORT, so that the caller knows that we've abandoned
// the window open as far as it is concerned.
@@ -1262,16 +1240,13 @@ nsresult ContentChild::ProvideWindowCommon(
return rv;
}
SendCreateWindow(
aTabOpener, parent, newChild, aChromeFlags, aCalledFromJS,
aOpenWindowInfo->GetIsForPrinting(),
aOpenWindowInfo->GetIsForWindowDotPrint(),
aOpenWindowInfo->GetIsTopLevelCreatedByWebContent(), aURI, features,
aModifiers, triggeringPrincipal, csp, referrerInfo,
aOpenWindowInfo->GetOriginAttributes(),
aLoadState ? aLoadState->HasValidUserGestureActivation() : false,
aLoadState ? aLoadState->GetTextDirectiveUserActivation() : false,
std::move(resolve), std::move(reject));
SendCreateWindow(aTabOpener, parent, newChild, aChromeFlags, aCalledFromJS,
aOpenWindowInfo->GetIsForPrinting(),
aOpenWindowInfo->GetIsForWindowDotPrint(),
aOpenWindowInfo->GetIsTopLevelCreatedByWebContent(), aURI,
features, aModifiers, triggeringPrincipal, csp, referrerInfo,
aOpenWindowInfo->GetOriginAttributes(), std::move(resolve),
std::move(reject));
// =======================
// Begin Nested Event Loop

View File

@@ -5252,8 +5252,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
bool* aWindowIsNew, int32_t& aOpenLocation,
nsIPrincipal* aTriggeringPrincipal, nsIReferrerInfo* aReferrerInfo,
bool aLoadURI, nsIContentSecurityPolicy* aCsp,
const OriginAttributes& aOriginAttributes, bool aUserActivation,
bool aTextDirectiveUserActivation) {
const OriginAttributes& aOriginAttributes) {
// The content process should never be in charge of computing whether or
// not a window should be private - the parent will do that.
const uint32_t badFlags = nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW |
@@ -5272,8 +5271,6 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
openInfo->mNextRemoteBrowser = aNextRemoteBrowser;
openInfo->mOriginAttributes = aOriginAttributes;
openInfo->mIsTopLevelCreatedByWebContent = aIsTopLevelCreatedByWebContent;
openInfo->mHasValidUserGestureActivation = aUserActivation;
openInfo->mTextDirectiveUserActivation = aTextDirectiveUserActivation;
MOZ_ASSERT_IF(aForWindowDotPrint, aForPrinting);
@@ -5481,7 +5478,6 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
const UserActivation::Modifiers& aModifiers,
nsIPrincipal* aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
nsIReferrerInfo* aReferrerInfo, const OriginAttributes& aOriginAttributes,
bool aUserActivation, bool aTextDirectiveUserActivation,
CreateWindowResolver&& aResolve) {
if (!aTriggeringPrincipal) {
return IPC_FAIL(this, "No principal");
@@ -5567,8 +5563,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
aForPrinting, aForWindowDotPrint, aIsTopLevelCreatedByWebContent,
aURIToLoad, aFeatures, aModifiers, newTab, VoidString(), rv, newRemoteTab,
&cwi.windowOpened(), openLocation, aTriggeringPrincipal, aReferrerInfo,
/* aLoadUri = */ false, aCsp, aOriginAttributes, aUserActivation,
aTextDirectiveUserActivation);
/* aLoadUri = */ false, aCsp, aOriginAttributes);
if (!ipcResult) {
return ipcResult;
}
@@ -5606,8 +5601,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindowInDifferentProcess(
const nsACString& aFeatures, const UserActivation::Modifiers& aModifiers,
const nsAString& aName, nsIPrincipal* aTriggeringPrincipal,
nsIContentSecurityPolicy* aCsp, nsIReferrerInfo* aReferrerInfo,
const OriginAttributes& aOriginAttributes, bool aUserActivation,
bool aTextDirectiveUserActivation) {
const OriginAttributes& aOriginAttributes) {
MOZ_DIAGNOSTIC_ASSERT(!nsContentUtils::IsSpecialName(aName));
// Don't continue to try to create a new window if we've been fully discarded.
@@ -5653,8 +5647,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindowInDifferentProcess(
aURIToLoad, aFeatures, aModifiers,
/* aNextRemoteBrowser = */ nullptr, aName, rv, newRemoteTab, &windowIsNew,
openLocation, aTriggeringPrincipal, aReferrerInfo,
/* aLoadUri = */ true, aCsp, aOriginAttributes, aUserActivation,
aTextDirectiveUserActivation);
/* aLoadUri = */ true, aCsp, aOriginAttributes);
if (!ipcResult) {
return ipcResult;
}

View File

@@ -530,7 +530,6 @@ class ContentParent final : public PContentParent,
const UserActivation::Modifiers& aModifiers,
nsIPrincipal* aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
nsIReferrerInfo* aReferrerInfo, const OriginAttributes& aOriginAttributes,
bool aUserActivation, bool aTextDirectiveUserActivation,
CreateWindowResolver&& aResolve);
mozilla::ipc::IPCResult RecvCreateWindowInDifferentProcess(
@@ -540,8 +539,7 @@ class ContentParent final : public PContentParent,
const nsACString& aFeatures, const UserActivation::Modifiers& aModifiers,
const nsAString& aName, nsIPrincipal* aTriggeringPrincipal,
nsIContentSecurityPolicy* aCsp, nsIReferrerInfo* aReferrerInfo,
const OriginAttributes& aOriginAttributes, bool aUserActivation,
bool aTextDirectiveUserActivation);
const OriginAttributes& aOriginAttributes);
static void BroadcastBlobURLRegistration(
const nsACString& aURI, BlobImpl* aBlobImpl, nsIPrincipal* aPrincipal,
@@ -751,8 +749,7 @@ class ContentParent final : public PContentParent,
bool* aWindowIsNew, int32_t& aOpenLocation,
nsIPrincipal* aTriggeringPrincipal, nsIReferrerInfo* aReferrerInfo,
bool aLoadUri, nsIContentSecurityPolicy* aCsp,
const OriginAttributes& aOriginAttributes, bool aUserActivation,
bool aTextDirectiveUserActivation);
const OriginAttributes& aOriginAttributes);
explicit ContentParent(const nsACString& aRemoteType);

View File

@@ -1547,9 +1547,7 @@ parent:
nullable nsIPrincipal aTriggeringPrincipal,
nullable nsIContentSecurityPolicy aCsp,
nullable nsIReferrerInfo aReferrerInfo,
OriginAttributes aOriginAttributes,
bool aUserActivation,
bool aTextDirectiveUserActivation)
OriginAttributes aOriginAttributes)
returns (CreatedWindowInfo window);
async CreateWindowInDifferentProcess(
@@ -1565,9 +1563,7 @@ parent:
nullable nsIPrincipal aTriggeringPrincipal,
nullable nsIContentSecurityPolicy aCsp,
nullable nsIReferrerInfo aReferrerInfo,
OriginAttributes aOriginAttributes,
bool aUserActivation,
bool aTextDirectiveUserActivation);
OriginAttributes aOriginAttributes);
/**
* Tell the parent that a decoder's' benchmark has been completed.

View File

@@ -571,10 +571,6 @@ export class GeckoViewNavigation extends GeckoViewModule {
triggeringPrincipal,
csp,
referrerInfo,
hasValidUserGestureActivation:
!!openWindowInfo?.hasValidUserGestureActivation,
textDirectiveUserActivation:
!!openWindowInfo?.textDirectiveUserActivation,
});
return browser;
}

View File

@@ -0,0 +1,80 @@
[find-range-from-text-directive.html]
[Basic smoke test - full word match.]
expected:
if not fission: FAIL
[Prefix need not end on a word boundary.]
expected:
if not fission: FAIL
[Multiple overlapping prefixes.]
expected:
if not fission: FAIL
[Multiple overlapping one letter prefixes.]
expected:
if not fission: FAIL
[Match text after prefix.]
expected:
if not fission: FAIL
[Search invisible content between prefix and match.]
expected:
if not fission: FAIL
[suffix means |start| need not end on word boundary.]
expected:
if not fission: FAIL
[|start| doesn't need to start on word boundary.]
expected:
if not fission: FAIL
[match doesn't immediately follow first prefix instance.]
expected:
if not fission: FAIL
[no-prefix; suffix means |start| need not end on word boundary.]
expected:
if not fission: FAIL
[overlapping exact matches with suffix.]
expected:
if not fission: FAIL
[overlapping one letter exact matches with suffix.]
expected:
if not fission: FAIL
[matching range search.]
expected:
if not fission: FAIL
[suffix means |end| need not be end bounded.]
expected:
if not fission: FAIL
[Match with no suffix.]
expected:
if not fission: FAIL
[Search invisible content between |end| and suffix.]
expected:
if not fission: FAIL
[Suffix need not be start bounded.]
expected:
if not fission: FAIL
[Non-matching suffix in first potential match.]
expected:
if not fission: FAIL
[Non-matching suffix search continues to prefix match.]
expected:
if not fission: FAIL
[Range end matches correct suffix.]
expected:
if not fission: FAIL

View File

@@ -13,8 +13,18 @@
[force-load-at-top must block scroll on load from history scroll restoration.]
expected: [FAIL, TIMEOUT, NOTRUN]
[force-load-at-top must block scroll on load from text fragment with element fallback.]
expected: FAIL
[no-force-load-at-top must not block scroll on load from text fragment.]
expected:
if not fission: FAIL
[no-force-load-at-top must not block scroll on load from text fragment with element fallback.]
expected:
if not fission: FAIL
[force-load-at-top must block scroll on load from text fragment.]
expected: FAIL
expected:
if fission: FAIL
[force-load-at-top must block scroll on load from text fragment with element fallback.]
expected:
if fission: FAIL

View File

@@ -0,0 +1,56 @@
[redirects.html]
[Text fragment works from HTTP 301 redirect.]
expected:
if not fission: FAIL
[Text fragment works from HTTP 302 redirect.]
expected:
if not fission: FAIL
[Text fragment works from HTTP 303 redirect.]
expected:
if not fission: FAIL
[Text fragment works from HTTP 307 redirect.]
expected:
if not fission: FAIL
[Text fragment works from HTTP 308 redirect.]
expected:
if not fission: FAIL
[Text fragment propagated through HTTP 301 redirect.]
expected:
if not fission: FAIL
[Text fragment propagated through HTTP 302 redirect.]
expected:
if not fission: FAIL
[Text fragment propagated through HTTP 303 redirect.]
expected:
if not fission: FAIL
[Text fragment propagated through HTTP 307 redirect.]
expected:
if not fission: FAIL
[Text fragment propagated through HTTP 308 redirect.]
expected:
if not fission: FAIL
[Text fragment works on client-side location redirect.]
expected:
if not fission: FAIL
[Text fragment works on client-side meta redirect.]
expected:
if not fission: FAIL
[One text fragment per user gesture allowed in client-side location redirect.]
expected:
if not fission: FAIL
[One text fragment per user gesture allowed in client-side meta redirect.]
expected:
if not fission: FAIL

View File

@@ -0,0 +1,4 @@
[scroll-to-text-fragment-after-DOMContentLoaded.html]
[Navigating to a text fragment directive]
expected:
if not fission: FAIL

View File

@@ -1,3 +1,12 @@
[scroll-to-text-fragment-security.sub.html]
[Test that a text fragment directive requires a user activation (user_activation=true).]
expected:
if not fission: FAIL
[Test that a text fragment directive is not activated when there is a window opener (noopener=true).]
expected:
if not fission: FAIL
[Test that a text fragment directive requires a user activation (user_activation=false).]
expected: FAIL
expected:
if fission: FAIL

View File

@@ -1,4 +1,105 @@
[scroll-to-text-fragment.html]
[Test navigation with fragment: Text directive should horizontally scroll into view.]
expected:
if (os == "android"): [PASS, FAIL]
if os == "android": [PASS, FAIL]
if not fission: FAIL
[Test navigation with fragment: Exact text with no context should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Case-insensitive search with no context should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Exact text with prefix should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Exact text with suffix should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Exact text with prefix and suffix should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Exact text with prefix and suffix and query equals prefix..]
expected:
if not fission: FAIL
[Test navigation with fragment: Text range with no context should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Text range with prefix should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Text range with suffix should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Text range with prefix and suffix should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Exact text with percent encoded spaces should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Fragment directive with percent encoded syntactical characters "&,-" should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Fragment directive with percent encoded non-ASCII unicode character should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Fragment directive with all TextMatchChars should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Multiple matching exact texts should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: A non-matching text directive followed by a matching text directive should match and scroll into view the second text directive.]
expected:
if not fission: FAIL
[Test navigation with fragment: Text directive followed by non-text directive should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Multiple text directives and a non-text directive should match text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Text directive with existing element fragment should match and scroll into view text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Text directive with nonexistent element fragment should match and scroll into view text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Multiple match text directive disambiguated by prefix should match the prefixed text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Multiple match text directive disambiguated by suffix should match the suffixed text.]
expected:
if not fission: FAIL
[Test navigation with fragment: Multiple match text directive disambiguated by prefix and suffix should match the text with the given context.]
expected:
if not fission: FAIL
[Test navigation with fragment: Text directive should match when context terms are separated by node boundaries.]
expected:
if not fission: FAIL
[Test navigation with fragment: Text directive should match text within shadow DOM.]
expected:
if not fission: FAIL

View File

@@ -64,21 +64,6 @@ interface nsIOpenWindowInfo : nsISupports {
[infallible]
readonly attribute boolean isTopLevelCreatedByWebContent;
/**
* Whether there is a user gesture activation for the document
* opened in the window.
*/
[infallible]
readonly attribute boolean hasValidUserGestureActivation;
/**
* Whether there is a text directive user activation for the document
* opened in the window. If true, the first text directive may be scrolled
* into view.
*/
[infallible]
readonly attribute boolean textDirectiveUserActivation;
/** BrowserParent instance to use in the new window */
[notxpcom, nostdcall]
BrowserParent getNextRemoteBrowser();

View File

@@ -43,18 +43,6 @@ NS_IMETHODIMP nsOpenWindowInfo::GetIsTopLevelCreatedByWebContent(
return NS_OK;
}
NS_IMETHODIMP nsOpenWindowInfo::GetHasValidUserGestureActivation(
bool* aHasValidUserGestureActivation) {
*aHasValidUserGestureActivation = mHasValidUserGestureActivation;
return NS_OK;
}
NS_IMETHODIMP nsOpenWindowInfo::GetTextDirectiveUserActivation(
bool* aTextDirectiveUserActivation) {
*aTextDirectiveUserActivation = mTextDirectiveUserActivation;
return NS_OK;
}
NS_IMETHODIMP nsOpenWindowInfo::GetScriptableOriginAttributes(
JSContext* aCx, JS::MutableHandle<JS::Value> aAttrs) {
bool ok = ToJSValue(aCx, mOriginAttributes, aAttrs);

View File

@@ -23,8 +23,6 @@ class nsOpenWindowInfo : public nsIOpenWindowInfo {
bool mIsForPrinting = false;
bool mIsForWindowDotPrint = false;
bool mIsTopLevelCreatedByWebContent = false;
bool mHasValidUserGestureActivation = false;
bool mTextDirectiveUserActivation = false;
RefPtr<mozilla::dom::BrowserParent> mNextRemoteBrowser;
mozilla::OriginAttributes mOriginAttributes;
RefPtr<mozilla::dom::BrowsingContext> mParent;