mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1694229 - Show slow script warning only when critical input is pending r=smaug
We want to restrict the slow script warning to cases where the user is actually trying to interact with the browser. Differential Revision: https://phabricator.services.mozilla.com/D106017
This commit is contained in:
parent
9848b858a8
commit
8195515eec
@ -661,12 +661,10 @@ bool XPCJSContext::InterruptCallback(JSContext* cx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t limitWithoutImportantUserInput =
|
||||
StaticPrefs::dom_max_script_run_time_without_important_user_input();
|
||||
if (runningContentJS && XRE_IsContentProcess() && limit &&
|
||||
limitWithoutImportantUserInput > limit &&
|
||||
limitWithoutImportantUserInput >
|
||||
self->mSlowScriptActualWait.ToSeconds()) {
|
||||
// For content scripts, we only want to show the slow script dialogue if the
|
||||
// user is actually trying to perform an important interaction.
|
||||
if (runningContentJS && XRE_IsContentProcess() &&
|
||||
StaticPrefs::dom_max_script_run_time_require_critical_input()) {
|
||||
// Call possibly slow PeekMessages after the other common early returns in
|
||||
// this method.
|
||||
ContentChild* contentChild = ContentChild::GetSingleton();
|
||||
|
@ -350,7 +350,6 @@ class ContentDelegateTest : BaseSessionTest() {
|
||||
private fun setHangReportTestPrefs(timeout: Int = 20000) {
|
||||
sessionRule.setPrefsUntilTestEnd(mapOf(
|
||||
"dom.max_script_run_time" to 1,
|
||||
"dom.max_script_run_time_without_important_user_input" to 1,
|
||||
"dom.max_chrome_script_run_time" to 1,
|
||||
"dom.max_ext_content_script_run_time" to 1,
|
||||
"dom.ipc.cpow.timeout" to 100,
|
||||
|
@ -3539,19 +3539,28 @@
|
||||
value: @IS_ANDROID@
|
||||
mirror: always
|
||||
|
||||
# The following four prefs control the maximum script run time before slow
|
||||
# The following three prefs control the maximum script run time before slow
|
||||
# script warning.
|
||||
|
||||
# Controls the time that a content script can run before showing a
|
||||
# notification.
|
||||
- name: dom.max_script_run_time
|
||||
type: int32_t
|
||||
value: 10
|
||||
mirror: always
|
||||
|
||||
- name: dom.max_script_run_time_without_important_user_input
|
||||
type: int32_t
|
||||
#ifdef NIGHTLY_BUILD
|
||||
value: 20
|
||||
# Controls whether we want to wait for user input before surfacing notifying
|
||||
# the parent process about a long-running script.
|
||||
- name: dom.max_script_run_time.require_critical_input
|
||||
type: bool
|
||||
# On desktop, we don't want to annoy the user with a notification if they're
|
||||
# not interacting with the browser. On Android however, we automatically
|
||||
# terminate long-running scripts, so we want to make sure we don't get in the
|
||||
# way of that by waiting for input.
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
value: false
|
||||
#else
|
||||
value: 10
|
||||
value: true
|
||||
#endif
|
||||
mirror: always
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user