Skip to content

Commit 770da49

Browse files
committed
👽️ Replace system event listeners via els on TooltipListenerChild as it is deprecated
1 parent 5314395 commit 770da49

File tree

2 files changed

+18
-53
lines changed

2 files changed

+18
-53
lines changed

actors/DotTooltipListenerChild.sys.mjs

Lines changed: 17 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,17 @@ export class DotTooltipListenerChild extends JSWindowActorChild {
142142
if (this._currentTooltip) {
143143
const doc = this._currentTooltip.ownerDocument;
144144

145-
Services.els.removeSystemEventListener(doc, "wheel", this, true);
146-
Services.els.removeSystemEventListener(
147-
doc,
148-
"mousedown",
149-
this,
150-
true
151-
);
152-
Services.els.removeSystemEventListener(doc, "mouseup", this, true);
153-
Services.els.removeSystemEventListener(doc, "keydown", this, true);
145+
doc.removeEventListener("wheel", this, true);
146+
doc.removeEventListener("mousedown", this, true);
147+
doc.removeEventListener("mouseup", this, true);
148+
doc.removeEventListener("keydown", this, true);
154149

155-
Services.els.removeSystemEventListener(
156-
this._currentTooltip,
150+
this._currentTooltip.removeEventListener(
157151
"popupshowing",
158152
this,
159153
false
160154
);
161-
162-
Services.els.removeSystemEventListener(
163-
this._currentTooltip,
155+
this._currentTooltip.removeEventListener(
164156
"popuphiding",
165157
this,
166158
false
@@ -362,24 +354,13 @@ export class DotTooltipListenerChild extends JSWindowActorChild {
362354
triggerNode || event.target
363355
);
364356

365-
Services.els.addSystemEventListener(
366-
tooltip,
367-
"popupshowing",
368-
this,
369-
false
370-
);
371-
372-
Services.els.addSystemEventListener(
373-
tooltip,
374-
"popuphiding",
375-
this,
376-
false
377-
);
357+
tooltip.addEventListener("popupshowing", this, false);
358+
tooltip.addEventListener("popuphiding", this, false);
378359

379-
Services.els.addSystemEventListener(doc, "wheel", this, true);
380-
Services.els.addSystemEventListener(doc, "mousedown", this, true);
381-
Services.els.addSystemEventListener(doc, "mouseup", this, true);
382-
Services.els.addSystemEventListener(doc, "keydown", this, true);
360+
doc.addEventListener("wheel", this, true);
361+
doc.addEventListener("mousedown", this, true);
362+
doc.addEventListener("mouseup", this, true);
363+
doc.addEventListener("keydown", this, true);
383364

384365
Object.defineProperty(tooltip, "triggerNode", {
385366
configurable: true,
@@ -540,11 +521,11 @@ export class DotTooltipListenerChild extends JSWindowActorChild {
540521
* @param {Node} node
541522
*/
542523
addTooltipSupport(node) {
543-
Services.els.addSystemEventListener(node, "mouseout", this, false);
544-
Services.els.addSystemEventListener(node, "mousemove", this, false);
545-
Services.els.addSystemEventListener(node, "mousedown", this, false);
546-
Services.els.addSystemEventListener(node, "mouseup", this, false);
547-
Services.els.addSystemEventListener(node, "dragstart", this, true);
524+
node.addEventListener("mouseout", this, false);
525+
node.addEventListener("mousemove", this, false);
526+
node.addEventListener("mousedown", this, false);
527+
node.addEventListener("mouseup", this, false);
528+
node.addEventListener("dragstart", this, true);
548529
}
549530

550531
/**

third_party/dothq/gecko-types/lib/services/els.d.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,7 @@ export interface ServicesEls {
5757
* Returns true if a event target has any listener for the given type.
5858
*/
5959
hasListenersFor(aEventTarget: EventTarget, aType: string): boolean;
60-
61-
/**
62-
* Add a system-group eventlistener to a event target.
63-
*/
64-
addSystemEventListener(target: EventTarget,
65-
type: string,
66-
listener: any,
67-
useCapture: boolean): void;
68-
69-
/**
70-
* Remove a system-group eventlistener from a event target.
71-
*/
72-
removeSystemEventListener(target: EventTarget,
73-
type: string,
74-
listener: any,
75-
useCapture: boolean): void;
76-
60+
7761
addListenerForAllEvents(target: EventTarget,
7862
listener: any,
7963
aUseCapture?: boolean,

0 commit comments

Comments
 (0)