Open Bug 1345374 Opened 5 years ago Updated 2 years ago

Event listeners cannot distinguish if event is synthesized by chrome script

Categories

(Core :: DOM: UI Events & Focus Handling, enhancement, P3)

enhancement

Tracking

()

Tracking Status
firefox55 --- affected

People

(Reporter: masayuki, Unassigned)

References

Details

If an event is created by chrome script, its trusted flag is true.  If synthesized event instance inherits WidgetGUIEvent, the mWidget is nullptr. But otherwise, we cannot distinguish them.

So, I think that we should add new flag indicating if it's created by script and if event listeners need to ban such events, they should use it.
It is unclear to me _why_ we need to know whether the event is created by chrome JS vs created by native code.
(In reply to Olli Pettay [:smaug] (high review load, queue closed for couple of days) from comment #1)
> It is unclear to me _why_ we need to know whether the event is created by
> chrome JS vs created by native code.

In bug 1344149, I realized that if "focus" and "blur" events are created with proper instance, EditorBase will initialize or finalize selection (e.g., selection limit ancestor, caret visibility, etc). Of course, it's too bad for any modules since such wrong behavior has never been expected.
And similarly, editor rejects keyboard/composition events created in chrome script. For checking it, editor checks WidgetGUIEvent::mWidget but it's not easy to understand for the other developers.
Priority: -- → P3
Component: Event Handling → User events and focus handling

Resetting assignee which I don't work on in this several months.

Assignee: masayuki → nobody
Status: ASSIGNED → NEW
You need to log in before you can comment on or make changes to this bug.