Bug 1360441 - Disable the IsHandlingUserInput timeout for execCommand(copy/cut) commands, r=ehsan

MozReview-Commit-ID: 341K1DEsVCg
This commit is contained in:
Michael Layzell 2017-05-08 12:03:42 -04:00
Родитель 89f6d51919
Коммит 0700aeac13
3 изменённых файлов: 22 добавлений и 14 удалений

Просмотреть файл

@ -7176,9 +7176,22 @@ nsContentUtils::IsFullScreenApiEnabled()
bool
nsContentUtils::IsRequestFullScreenAllowed(CallerType aCallerType)
{
return !sTrustedFullScreenOnly ||
EventStateManager::IsHandlingUserInput() ||
aCallerType == CallerType::System;
// If more time has elapsed since the user input than is specified by the
// dom.event.handling-user-input-time-limit pref (default 1 second), this
// function also returns false.
if (!sTrustedFullScreenOnly || aCallerType == CallerType::System) {
return true;
}
if (EventStateManager::IsHandlingUserInput()) {
TimeDuration timeout = HandlingUserInputTimeout();
return timeout <= TimeDuration(0) ||
(TimeStamp::Now() -
EventStateManager::GetHandlingInputStart()) <= timeout;
}
return false;
}
/* static */

Просмотреть файл

@ -3868,13 +3868,7 @@ public:
/*static*/ bool
EventStateManager::IsHandlingUserInput()
{
if (sUserInputEventDepth <= 0) {
return false;
}
TimeDuration timeout = nsContentUtils::HandlingUserInputTimeout();
return timeout <= TimeDuration(0) ||
(TimeStamp::Now() - sHandlingInputStart) <= timeout;
return sUserInputEventDepth > 0;
}
static void

Просмотреть файл

@ -215,15 +215,16 @@ public:
}
}
static TimeStamp GetHandlingInputStart() {
return sHandlingInputStart;
}
/**
* Returns true if the current code is being executed as a result of
* user input. This includes anything that is initiated by user,
* with the exception of page load events or mouse over events. If
* this method is called from asynchronously executed code, such as
* during layout reflows, it will return false. If more time has
* elapsed since the user input than is specified by the
* dom.event.handling-user-input-time-limit pref (default 1 second),
* this function also returns false.
* during layout reflows, it will return false.
*/
static bool IsHandlingUserInput();