mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +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
|
@ -42,9 +42,11 @@ use js::glue::{
|
|||
StreamConsumerNoteResponseURLs, StreamConsumerStreamEnd, StreamConsumerStreamError,
|
||||
};
|
||||
use js::jsapi::ContextOptionsRef;
|
||||
use js::jsapi::GetPromiseUserInputEventHandlingState;
|
||||
use js::jsapi::InitConsumeStreamCallback;
|
||||
use js::jsapi::InitDispatchToEventLoop;
|
||||
use js::jsapi::MimeType;
|
||||
use js::jsapi::PromiseUserInputEventHandlingState;
|
||||
use js::jsapi::StreamConsumer as JSStreamConsumer;
|
||||
use js::jsapi::{BuildIdCharVector, DisableIncrementalGC, GCDescription, GCProgress};
|
||||
use js::jsapi::{Dispatchable as JSRunnable, Dispatchable_MaybeShuttingDown};
|
||||
|
@ -197,7 +199,7 @@ unsafe extern "C" fn empty(extra: *const c_void) -> bool {
|
|||
unsafe extern "C" fn enqueue_promise_job(
|
||||
extra: *const c_void,
|
||||
cx: *mut RawJSContext,
|
||||
_promise: HandleObject,
|
||||
promise: HandleObject,
|
||||
job: HandleObject,
|
||||
_allocation_site: HandleObject,
|
||||
incumbent_global: HandleObject,
|
||||
|
@ -208,10 +210,18 @@ unsafe extern "C" fn enqueue_promise_job(
|
|||
let microtask_queue = &*(extra as *const MicrotaskQueue);
|
||||
let global = GlobalScope::from_object(incumbent_global.get());
|
||||
let pipeline = global.pipeline_id();
|
||||
let interaction = if promise.get().is_null() {
|
||||
PromiseUserInputEventHandlingState::DontCare
|
||||
} else {
|
||||
GetPromiseUserInputEventHandlingState(promise)
|
||||
};
|
||||
let is_user_interacting =
|
||||
interaction == PromiseUserInputEventHandlingState::HadUserInteractionAtCreation;
|
||||
microtask_queue.enqueue(
|
||||
Microtask::Promise(EnqueuedPromiseCallback {
|
||||
callback: PromiseJobCallback::new(cx, job.get()),
|
||||
pipeline,
|
||||
is_user_interacting,
|
||||
}),
|
||||
cx,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue