Intent to Experiment: navigator.scheduling.isInputPending

213 views
Skip to first unread message

acom...@fb.com

unread,
Mar 5, 2019, 2:36:25 AM3/5/19
to blink-dev

Contact emails

acom...@fb.com, n...@fb.com, tdre...@google.com, pani...@google.com


Explainer

https://github.com/WICG/is-input-pending/


Summary

A method to query whether or not input events of a given type are likely to be dispatched to a document. Intended for use in JS schedulers to improve the responsiveness of pages by yielding when input is pending prior to processing lower priority tasks.


Link to “Intent to Implement” blink-dev discussion

https://groups.google.com/a/chromium.org/d/msg/blink-dev/eLq8t56CbaQ/KdbOY7ZHCwAJ


Goals for experimentation

We’d like to measure the reduction in event dispatch latency in scheduler-driven pages as a result of yielding more intelligently using this API. Our working hypothesis is that pending input events will be handled sooner due to the scheduler’s improved ability to cooperatively multitask, improving page responsiveness. In particular, Facebook intends on measuring the time elapsed between an event’s timestamp and the time the event handler was dispatched for this.


We’d also like to know what sort of input events developers are interested in querying for specifically, to determine the level of granularity that should be exposed by this API.


Experimental timeline

M74 - M76.


Any risks when the experiment finishes?

The correctness of intended consumers of the feature (JS schedulers) should be unaffected by the removal of the API. It’s worth noting that some schedulers could potentially bias their scheduling design towards a functional implementation of isInputPending, which could negatively affect the responsiveness of scheduling without this API present.


Ongoing technical constraints

None.


Will this feature be supported on all five Blink platforms supported by Origin Trials (Windows, Mac, Linux, Chrome OS, and Android)?

No, only Windows, Mac, Linux, and Chrome OS. The current implementation requires site-per-process to perform attribution of pending input events, which is not shipped by default on Android. This will be addressed before any intent to ship.


Link to entry on the feature dashboard

https://www.chromestatus.com/feature/5719830432841728


smaug

unread,
Mar 5, 2019, 6:36:53 PM3/5/19
to acom...@fb.com, blink-dev
On 03/05/2019 03:47 AM, acom...@fb.com wrote:
> Contact emails
>
> acom...@fb.com <mailto:acom...@fb.com>, n...@fb.com <mailto:n...@fb.com>, tdre...@google.com <mailto:tdre...@google.com>, pani...@google.com
> <mailto:pani...@google.com>
>
>
> Explainer
>
> https://github.com/WICG/is-input-pending/
>
>
> Summary
>
> A method to query whether or not input events of a given type are likely to be dispatched to a document. Intended for use in JS schedulers to improve
> the responsiveness of pages by yielding when input is pending prior to processing lower priority tasks.
>

May I ask what is being experimented exactly? The explainer isn't at the level of a spec.
Especially privacy and security part is rather unclear. If there are for example keyboard events _pending_, one can't
know the target beforehand, since the caller of this new API may move focus elsewhere.



-Olli

>
> Link to “Intent to Implement” blink-dev discussion
>
> https://groups.google.com/a/chromium.org/d/msg/blink-dev/eLq8t56CbaQ/KdbOY7ZHCwAJ
>
>
> Goals for experimentation
>
> We’d like to measure the reduction in event dispatch latency in scheduler-driven pages as a result of yielding more intelligently using this API. Our
> working hypothesis is that pending input events will be handled sooner due to the scheduler’s improved ability to cooperatively multitask, improving
> page responsiveness. In particular, Facebook intends on measuring the time elapsed between an event’s timestamp and the time the event handler was
> dispatched for this.
>
>
> We’d also like to know what sort of input events developers are interested in querying for specifically, to determine the level of granularity that
> should be exposed by this API.
>
>
> Experimental timeline
>
> M74 - M76.
>
>
> Any risks when the experiment finishes?
>
> The correctness of intended consumers of the feature (JS schedulers) should be unaffected by the removal of the API. It’s worth noting that some
> schedulers could potentially bias their scheduling design towards a functional implementation of isInputPending, which could negatively affect the
> responsiveness of scheduling without this API present.
>
>
> Ongoing technical constraints
>
> None.
>
>
> Will this feature be supported on all five Blink platforms supported by Origin Trials (Windows, Mac, Linux, Chrome OS, and Android)?
>
> No, only Windows, Mac, Linux, and Chrome OS. The current implementation requires site-per-process to perform attribution of pending input events,
> which is not shipped by default on Android. This will be addressed before any intent to ship.
>
>
> Link to entry on the feature dashboard <https://www.chromestatus.com/>
>
> https://www.chromestatus.com/feature/5719830432841728
>
>
> --
> You received this message because you are subscribed to the Google Groups "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org
> <mailto:blink-dev+...@chromium.org>.
> To view this discussion on the web visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/ca0587cc-b9c3-4323-b013-f3add6319457%40chromium.org
> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/ca0587cc-b9c3-4323-b013-f3add6319457%40chromium.org?utm_medium=email&utm_source=footer>.

acom...@fb.com

unread,
Mar 6, 2019, 2:19:13 AM3/6/19
to blink-dev, acom...@fb.com, sm...@welho.com
The implementation we're experimenting with uses a primitive mapping of WebInputEvent types to DOM event types that may be dispatched as a result of the event. For example, when a mouse up event is enqueued on a frame's event loop, isInputPending(["click"]) returns true in the frame that mouse up occurred in. Calling isInputPending with no arguments returns true if any input may be pending for the frame.

Regarding privacy and security - we're currently using the input event delegation provided by OOPIFs to isolate cross-site frames, which tracks focus (for key events) and hit test rects (for mouse events) to perform event attribution- which does result in a potential unprocessed 1-event window exposed that you mention before focus() takes effect. For the shipping implementation (which is likely to do this work on a per-renderer basis in the compositor thread) we could consider disabling the API during an inflight call to focus() (or something similar).

Andrew

Chris Harrelson

unread,
Mar 7, 2019, 8:20:54 PM3/7/19
to acom...@fb.com, blink-dev, smaug
LGTM

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/82ff0549-5fb0-419f-b856-55f17ac94851%40chromium.org.
Reply all
Reply to author
Forward
0 new messages