Bug 1721217 - Part 2: Fix the race between navigations originating in the parent and in the content, r=nika
Add a synced ParentInitiatedNavigationEpoch field to browsing context, which only gets incremented when we start navigations in the parent process. When a child process initiates a navigation, it sends the current value of the field that it sees via DocumentChannelCreationArgs. In the parent process, we can compare the value of that field with the latest one for the same browsing context. If the latest value is higher than the one provided by the content process, it means that in the meantime parent process has started a navigation so the earlier navigation originating in the content process will be cancelled. Differential Revision: https://phabricator.services.mozilla.com/D126842
This commit is contained in:
@@ -3182,6 +3182,11 @@ auto BrowsingContext::CanSet(FieldIndex<IDX_CurrentInnerWindowId>,
|
||||
return CanSetResult::Allow;
|
||||
}
|
||||
|
||||
bool BrowsingContext::CanSet(FieldIndex<IDX_ParentInitiatedNavigationEpoch>,
|
||||
const uint64_t& aValue, ContentParent* aSource) {
|
||||
return XRE_IsParentProcess() && !aSource;
|
||||
}
|
||||
|
||||
void BrowsingContext::DidSet(FieldIndex<IDX_CurrentInnerWindowId>) {
|
||||
RefPtr<WindowContext> prevWindowContext = mCurrentWindowContext.forget();
|
||||
mCurrentWindowContext = WindowContext::GetById(GetCurrentInnerWindowId());
|
||||
|
||||
Reference in New Issue
Block a user