Skip to content

Commit

Permalink
👽️ Replace system event listeners via els on TooltipListenerChild as …
Browse files Browse the repository at this point in the history
…it is deprecated
  • Loading branch information
kierandrewett committed Apr 19, 2024
1 parent 5314395 commit 770da49
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 53 deletions.
53 changes: 17 additions & 36 deletions actors/DotTooltipListenerChild.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -142,25 +142,17 @@ export class DotTooltipListenerChild extends JSWindowActorChild {
if (this._currentTooltip) {
const doc = this._currentTooltip.ownerDocument;

Services.els.removeSystemEventListener(doc, "wheel", this, true);
Services.els.removeSystemEventListener(
doc,
"mousedown",
this,
true
);
Services.els.removeSystemEventListener(doc, "mouseup", this, true);
Services.els.removeSystemEventListener(doc, "keydown", this, true);
doc.removeEventListener("wheel", this, true);
doc.removeEventListener("mousedown", this, true);
doc.removeEventListener("mouseup", this, true);
doc.removeEventListener("keydown", this, true);

Services.els.removeSystemEventListener(
this._currentTooltip,
this._currentTooltip.removeEventListener(
"popupshowing",
this,
false
);

Services.els.removeSystemEventListener(
this._currentTooltip,
this._currentTooltip.removeEventListener(
"popuphiding",
this,
false
Expand Down Expand Up @@ -362,24 +354,13 @@ export class DotTooltipListenerChild extends JSWindowActorChild {
triggerNode || event.target
);

Services.els.addSystemEventListener(
tooltip,
"popupshowing",
this,
false
);

Services.els.addSystemEventListener(
tooltip,
"popuphiding",
this,
false
);
tooltip.addEventListener("popupshowing", this, false);
tooltip.addEventListener("popuphiding", this, false);

Services.els.addSystemEventListener(doc, "wheel", this, true);
Services.els.addSystemEventListener(doc, "mousedown", this, true);
Services.els.addSystemEventListener(doc, "mouseup", this, true);
Services.els.addSystemEventListener(doc, "keydown", this, true);
doc.addEventListener("wheel", this, true);
doc.addEventListener("mousedown", this, true);
doc.addEventListener("mouseup", this, true);
doc.addEventListener("keydown", this, true);

Object.defineProperty(tooltip, "triggerNode", {
configurable: true,
Expand Down Expand Up @@ -540,11 +521,11 @@ export class DotTooltipListenerChild extends JSWindowActorChild {
* @param {Node} node
*/
addTooltipSupport(node) {
Services.els.addSystemEventListener(node, "mouseout", this, false);
Services.els.addSystemEventListener(node, "mousemove", this, false);
Services.els.addSystemEventListener(node, "mousedown", this, false);
Services.els.addSystemEventListener(node, "mouseup", this, false);
Services.els.addSystemEventListener(node, "dragstart", this, true);
node.addEventListener("mouseout", this, false);
node.addEventListener("mousemove", this, false);
node.addEventListener("mousedown", this, false);
node.addEventListener("mouseup", this, false);
node.addEventListener("dragstart", this, true);
}

/**
Expand Down
18 changes: 1 addition & 17 deletions third_party/dothq/gecko-types/lib/services/els.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,7 @@ export interface ServicesEls {
* Returns true if a event target has any listener for the given type.
*/
hasListenersFor(aEventTarget: EventTarget, aType: string): boolean;

/**
* Add a system-group eventlistener to a event target.
*/
addSystemEventListener(target: EventTarget,
type: string,
listener: any,
useCapture: boolean): void;

/**
* Remove a system-group eventlistener from a event target.
*/
removeSystemEventListener(target: EventTarget,
type: string,
listener: any,
useCapture: boolean): void;


addListenerForAllEvents(target: EventTarget,
listener: any,
aUseCapture?: boolean,
Expand Down

0 comments on commit 770da49

Please sign in to comment.