Closed Bug 1522404 Opened 1 year ago Closed 1 year ago

Refactor devtools/server/actors/inspector/event-parsers.js to use ES6 classes


(DevTools :: Inspector, defect, P2)



(firefox67 fixed)

Firefox 67
Tracking Status
firefox67 --- fixed


(Reporter: miker, Assigned: miker)




(1 file)

After working on bug 1042082 it has become very obvious that devtools/server/actors/inspector/event-parsers.js is an unmaintainable, confusing mess of objects and helper functions.

It will only take a few hours to refactor it to use ES6 classes and much easier to understand and maintain. Some functionality should also be moved from devtools/server/actors/inspector/node.js so that other modules can make use of event-parsers.js.

As I say this will only take a few hours so this should be done before bug 1042082 is completed.


  • Because hasListeners() and getListeners() share the same code some jQuery handlers, which are part of jQuery library itself are no longer displayed (they are no use to the average developer). We have always hid some but now we hide more. This is visible in the jQuery tests.
  • Tests now all use backticks to simplify adding function source to handler properties.
  • helper_events_test_runner.js now uses jsbeautify on handler source code as part of using backticks to add handlers.
  • devtools/server/actors/inspector/node.js now
  • event-parsers.js has been renamed to event-collector.js to properly indicate what the file does. There are numerous changes to this file:
    • ES6 classes are used wherever possible.
    • hasListeners() now simply calls getListeners() with a checkOnly flag, which means that if we find listeners they can always be displayed.
    • Object.entries() is now used when looping through objects.
    • getAllEventListeners() was added to help jlast, who can make use of it in the debugger.
    • The logic for processHandlerForEvent(), hasListeners() and getListeners() was moved from devtools/server/actors/inspector/node.js to event-parsers.js so that we have all the event collection code in one place.
    • event-parsers.js now returns an EventCollector class that can be used to access getListeners(), hasListeners() and getAllListeners().
Pushed by
Refactor devtools/server/actors/inspector/event-parsers.js to use ES6 classes r=ochameau
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 67
Depends on: 1524097
Depends on: 1524005
Blocks: 1524005
No longer depends on: 1524005
You need to log in before you can comment on or make changes to this bug.