diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index f03112319be9..65f3d87a9d08 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -243,6 +243,7 @@ support-files = !/dom/events/test/event_leak_utils.js ../../../toolkit/components/pdfjs/test/file_pdfjs_test.pdf green.png + slow.sjs [test_anchor_area_referrer.html] [test_anchor_area_referrer_changing.html] @@ -683,6 +684,7 @@ skip-if = (processor == 'aarch64' && os == 'win') # aarch64 due to 1530895 [test_innersize_scrollport.html] skip-if = (verify && (os == 'win' || os == 'mac')) [test_input_vsync_alignment_lower_than_normal.html] +[test_input_vsync_alignment_input_while_vsync.html] [test_integer_attr_with_leading_zero.html] [test_intersectionobservers.html] [test_link_prefetch.html] diff --git a/dom/base/test/slow.sjs b/dom/base/test/slow.sjs new file mode 100644 index 000000000000..94f30e86960f --- /dev/null +++ b/dom/base/test/slow.sjs @@ -0,0 +1,11 @@ +function handleRequest(request, response) +{ + response.processAsync(); + + timer = Components.classes["@mozilla.org/timer;1"]. + createInstance(Components.interfaces.nsITimer); + timer.init(function() { + response.write("Here the content. But slowly."); + response.finish(); + }, 5000, Components.interfaces.nsITimer.TYPE_ONE_SHOT); +} diff --git a/dom/base/test/test_input_vsync_alignment_input_while_vsync.html b/dom/base/test/test_input_vsync_alignment_input_while_vsync.html new file mode 100644 index 000000000000..5673a10afb2f --- /dev/null +++ b/dom/base/test/test_input_vsync_alignment_input_while_vsync.html @@ -0,0 +1,50 @@ + + +
+ + + + + + + + + diff --git a/xpcom/threads/InputTaskManager.cpp b/xpcom/threads/InputTaskManager.cpp index 9804cb87e6a3..d70e3bbc4488 100644 --- a/xpcom/threads/InputTaskManager.cpp +++ b/xpcom/threads/InputTaskManager.cpp @@ -143,7 +143,7 @@ void InputTaskManager::InputPriorityController::EnterPendingVsyncState( mRunInputStartTime = TimeStamp::Now(); } -void InputTaskManager::InputPriorityController::DidVsync() { +void InputTaskManager::InputPriorityController::WillRunVsync() { MOZ_ASSERT(StaticPrefs::dom_input_events_strict_input_vsync_alignment()); if (mInputVsyncState == InputVsyncState::RunVsync || diff --git a/xpcom/threads/InputTaskManager.h b/xpcom/threads/InputTaskManager.h index c5d7d524c6af..fa7867c6e062 100644 --- a/xpcom/threads/InputTaskManager.h +++ b/xpcom/threads/InputTaskManager.h @@ -84,7 +84,7 @@ class InputTaskManager : public TaskManager { void NotifyVsync() { MOZ_ASSERT(StaticPrefs::dom_input_events_strict_input_vsync_alignment()); - mInputPriorityController.DidVsync(); + mInputPriorityController.WillRunVsync(); } private: @@ -97,7 +97,7 @@ class InputTaskManager : public TaskManager { // tasks bool ShouldUseHighestPriority(InputTaskManager*); - void DidVsync(); + void WillRunVsync(); // Gets called when a input task is finished to run; If the current // input vsync state is `HasPendingVsync`, determines whether we diff --git a/xpcom/threads/VsyncTaskManager.cpp b/xpcom/threads/VsyncTaskManager.cpp index 85617ddfdca0..3bfcaefc39f7 100644 --- a/xpcom/threads/VsyncTaskManager.cpp +++ b/xpcom/threads/VsyncTaskManager.cpp @@ -15,8 +15,8 @@ void VsyncTaskManager::Init() { gHighPriorityTaskManager = new VsyncTaskManager(); } -void VsyncTaskManager::DidRunTask() { - TaskManager::DidRunTask(); +void VsyncTaskManager::WillRunTask() { + TaskManager::WillRunTask(); if (StaticPrefs::dom_input_events_strict_input_vsync_alignment()) { InputTaskManager::Get()->NotifyVsync(); diff --git a/xpcom/threads/VsyncTaskManager.h b/xpcom/threads/VsyncTaskManager.h index d58a82c33421..192250397dc8 100644 --- a/xpcom/threads/VsyncTaskManager.h +++ b/xpcom/threads/VsyncTaskManager.h @@ -16,7 +16,7 @@ class VsyncTaskManager : public TaskManager { static void Cleanup() { gHighPriorityTaskManager = nullptr; } static void Init(); - void DidRunTask() override; + void WillRunTask() override; private: static StaticRefPtr