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:
@@ -7,6 +7,7 @@
|
||||
#include "mozilla/dom/BrowsingContextGroup.h"
|
||||
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/InputTaskManager.h"
|
||||
#include "mozilla/dom/BrowsingContextBinding.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
@@ -319,6 +320,36 @@ void BrowsingContextGroup::FlushPostMessageEvents() {
|
||||
}
|
||||
}
|
||||
|
||||
void BrowsingContextGroup::IncInputEventSuspensionLevel() {
|
||||
MOZ_ASSERT(StaticPrefs::dom_input_events_canSuspendInBCG_enabled_AtStartup());
|
||||
if (!mInputEventSuspensionLevel && !InputTaskManager::Get()->IsSuspended()) {
|
||||
InputTaskManager::Get()->SetIsSuspended(true);
|
||||
}
|
||||
++mInputEventSuspensionLevel;
|
||||
}
|
||||
|
||||
void BrowsingContextGroup::DecInputEventSuspensionLevel() {
|
||||
MOZ_ASSERT(StaticPrefs::dom_input_events_canSuspendInBCG_enabled_AtStartup());
|
||||
--mInputEventSuspensionLevel;
|
||||
if (!mInputEventSuspensionLevel && InputTaskManager::Get()->IsSuspended()) {
|
||||
InputTaskManager::Get()->SetIsSuspended(false);
|
||||
}
|
||||
}
|
||||
|
||||
void BrowsingContextGroup::UpdateInputTaskManagerIfNeeded() {
|
||||
MOZ_ASSERT(StaticPrefs::dom_input_events_canSuspendInBCG_enabled_AtStartup());
|
||||
InputTaskManager* inputManager = InputTaskManager::Get();
|
||||
|
||||
if (mInputEventSuspensionLevel && !inputManager->IsSuspended()) {
|
||||
inputManager->SetIsSuspended(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mInputEventSuspensionLevel && inputManager->IsSuspended()) {
|
||||
inputManager->SetIsSuspended(false);
|
||||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
BrowsingContextGroup* BrowsingContextGroup::GetChromeGroup() {
|
||||
MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess());
|
||||
|
||||
Reference in New Issue
Block a user