mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Propagate user interacting flag to timers and promises
This commit is contained in:
parent
6ca767d7f9
commit
5621c887fd
4 changed files with 32 additions and 5 deletions
|
@ -52,6 +52,7 @@ pub struct EnqueuedPromiseCallback {
|
|||
#[ignore_malloc_size_of = "Rc has unclear ownership"]
|
||||
pub callback: Rc<PromiseJobCallback>,
|
||||
pub pipeline: PipelineId,
|
||||
pub is_user_interacting: bool,
|
||||
}
|
||||
|
||||
/// A microtask that comes from a queueMicrotask() Javascript call,
|
||||
|
@ -105,7 +106,10 @@ impl MicrotaskQueue {
|
|||
match *job {
|
||||
Microtask::Promise(ref job) => {
|
||||
if let Some(target) = target_provider(job.pipeline) {
|
||||
let was_interacting = ScriptThread::is_user_interacting();
|
||||
ScriptThread::set_user_interacting(job.is_user_interacting);
|
||||
let _ = job.callback.Call_(&*target, ExceptionHandling::Report);
|
||||
ScriptThread::set_user_interacting(was_interacting);
|
||||
}
|
||||
},
|
||||
Microtask::User(ref job) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue