зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1650095 - Part 4 - For Fission, reset SHEntryHasUserInteraction cache in the parent when adding/updating SH entries. r=smaug
When re-enabling the test case blocked by bug 1670933 it became apparent that we were not allowing session history entries to be marked with user interaction when the SH entry was created by navigation through a sub-frame. The code that we had for this only covered updating SH entries after pushState etc., not adding new entries for document loads. When SH lives in the child this is easier to manage in nsDocShell, but with Fission it probably makes sense to move this code to the parent. Differential Revision: https://phabricator.services.mozilla.com/D97421
This commit is contained in:
Родитель
7e17b5719b
Коммит
15fcfd1312
|
@ -535,6 +535,8 @@ void CanonicalBrowsingContext::SessionHistoryCommit(uint64_t aLoadId,
|
|||
}
|
||||
}
|
||||
|
||||
ResetSHEntryHasUserInteractionCache();
|
||||
|
||||
HistoryCommitIndexAndLength(aChangeID, caller);
|
||||
|
||||
return;
|
||||
|
@ -650,6 +652,9 @@ void CanonicalBrowsingContext::SetActiveSessionHistoryEntry(
|
|||
UseRemoteSubframes());
|
||||
}
|
||||
}
|
||||
|
||||
ResetSHEntryHasUserInteractionCache();
|
||||
|
||||
// FIXME Need to do the equivalent of EvictContentViewersOrReplaceEntry.
|
||||
HistoryCommitIndexAndLength(aChangeID, caller);
|
||||
}
|
||||
|
@ -667,6 +672,9 @@ void CanonicalBrowsingContext::ReplaceActiveSessionHistoryEntry(
|
|||
shistory->NotifyOnHistoryReplaceEntry();
|
||||
shistory->UpdateRootBrowsingContextState();
|
||||
}
|
||||
|
||||
ResetSHEntryHasUserInteractionCache();
|
||||
|
||||
// FIXME Need to do the equivalent of EvictContentViewersOrReplaceEntry.
|
||||
}
|
||||
|
||||
|
@ -1558,6 +1566,13 @@ void CanonicalBrowsingContext::EndDocumentLoad(bool aForProcessSwitch) {
|
|||
}
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::ResetSHEntryHasUserInteractionCache() {
|
||||
WindowContext* topWc = GetTopWindowContext();
|
||||
if (topWc && !topWc->IsDiscarded()) {
|
||||
MOZ_ALWAYS_SUCCEEDS(topWc->SetSHEntryHasUserInteraction(false));
|
||||
}
|
||||
}
|
||||
|
||||
void CanonicalBrowsingContext::HistoryCommitIndexAndLength() {
|
||||
nsID changeID = {};
|
||||
CallerWillNotifyHistoryIndexAndLengthChanges caller(nullptr);
|
||||
|
|
|
@ -325,6 +325,12 @@ class CanonicalBrowsingContext final : public BrowsingContext {
|
|||
|
||||
uint64_t mCrossGroupOpenerId = 0;
|
||||
|
||||
// This function will make the top window context reset its
|
||||
// "SHEntryHasUserInteraction" cache that prevents documents from repeatedly
|
||||
// setting user interaction on SH entries. Should be called anytime SH
|
||||
// entries are added or replaced.
|
||||
void ResetSHEntryHasUserInteractionCache();
|
||||
|
||||
// The current remoteness change which is in a pending state.
|
||||
RefPtr<PendingRemotenessChange> mPendingRemotenessChange;
|
||||
|
||||
|
|
|
@ -8909,15 +8909,6 @@ nsresult nsDocShell::HandleSameDocumentNavigation(
|
|||
scrollRestorationIsManual.value());
|
||||
}
|
||||
|
||||
// As we're replacing the active session history entry we need to ensure
|
||||
// the top window context resets its "SHEntryHasUserInteraction" cache
|
||||
// that prevents documents from repeatedly setting user interaction
|
||||
// on SH entries.
|
||||
WindowContext* topWc = mBrowsingContext->GetTopWindowContext();
|
||||
if (topWc && !topWc->IsDiscarded()) {
|
||||
MOZ_ALWAYS_SUCCEEDS(topWc->SetSHEntryHasUserInteraction(false));
|
||||
}
|
||||
|
||||
if (LOAD_TYPE_HAS_FLAGS(mLoadType, LOAD_FLAGS_REPLACE_HISTORY)) {
|
||||
mBrowsingContext->ReplaceActiveSessionHistoryEntry(mActiveEntry.get());
|
||||
} else {
|
||||
|
@ -11590,15 +11581,6 @@ void nsDocShell::UpdateActiveEntry(
|
|||
mActiveEntry->SetURIWasModified(aURIWasModified);
|
||||
mActiveEntry->SetScrollRestorationIsManual(aScrollRestorationIsManual);
|
||||
|
||||
// As we're replacing the active session history entry we need to ensure
|
||||
// the top window context resets its "SHEntryHasUserInteraction" cache
|
||||
// that prevents documents from repeatedly setting user interaction
|
||||
// on SH entries.
|
||||
WindowContext* topWc = mBrowsingContext->GetTopWindowContext();
|
||||
if (topWc && !topWc->IsDiscarded()) {
|
||||
MOZ_ALWAYS_SUCCEEDS(topWc->SetSHEntryHasUserInteraction(false));
|
||||
}
|
||||
|
||||
if (replace) {
|
||||
mBrowsingContext->ReplaceActiveSessionHistoryEntry(mActiveEntry.get());
|
||||
} else {
|
||||
|
|
|
@ -376,10 +376,5 @@ add_task(async function test_iframe_pushState() {
|
|||
// entries without user interaction when navigating inside an iframe
|
||||
// by following links.
|
||||
add_task(async function test_iframe_followLink() {
|
||||
// Bug 1670933
|
||||
if (gFissionBrowser) {
|
||||
return;
|
||||
}
|
||||
|
||||
await runIframeTest(followLink);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче