Bug 1662265 - Fix input events handling for sync XHR when both TaskController and e10s are enabled r=smaug

There are two issues in our current setup

1) Input events which are occurring in the same tab are going to be lost
because sync XHR. We have event handling suppression for synx XHR, so input
events are going to be discarded.

2) Input events that are happening in another tab (same process as the
synx XHR tab) are not going to be delayed. This is not correct since
sync XHR should block the Javascript execution.

This patches fixes the above cases for when both TaskController and e10s are
enabled by suspending the InputTaskManager during sync XHR, which
delays the input event handling and keeps the events around.

Differential Revision: https://phabricator.services.mozilla.com/D90780
This commit is contained in:
Sean Feng
2020-12-03 03:13:04 +00:00
parent 0e00a88ad1
commit 35929d7fef
23 changed files with 367 additions and 11 deletions

View File

@@ -4836,6 +4836,18 @@ nsDocShell::SetIsActive(bool aIsActive) {
}
}
// When switching between tabs, there are always docShells that become
// active in the same process if they are same process tabs, so we just
// let the docShells that are becoming active to update the
// InputTaskManager if needed, because it's going to be duplicate works
// to ask both active and inactive docShells to do it.
//
// If the tabs are in different processes, we still don't need to call
// UpdateInputTaskManagerIfNeeded because the it's okay to keep
// the input events suspended for background tabs.
if (aIsActive && InputTaskManager::CanSuspendInputEvent()) {
mBrowsingContext->Group()->UpdateInputTaskManagerIfNeeded();
}
return NS_OK;
}