Bug 1137935 - remove usage of sdk event-target in devtools;r=ochameau draft
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 16 Aug 2017 15:17:24 +0200
changeset 648298 f18375b8b6d4138897d1707c489b5bce4f68f906
parent 648297 22d0003b40e0fc49e309187ea3c943a6f5048db5
child 649067 d8189c7400fbba975877b6341822bd1bae7767ea
child 649073 a11e04dda872b42ca69a3cd634918d1481670d42
child 649081 9e702fb6936a1389ec8a989dff75022447c0bafb
child 649083 04b963c4d91d3c9550bc1d2f938dd560824ff5da
push id74698
push userjdescottes@mozilla.com
push dateThu, 17 Aug 2017 15:14:34 +0000
reviewersochameau
bugs1137935
milestone57.0a1
Bug 1137935 - remove usage of sdk event-target in devtools;r=ochameau MozReview-Commit-ID: 2lPCVNq7wN0
devtools/client/webaudioeditor/includes.js
devtools/client/webaudioeditor/models.js
devtools/server/performance/memory.js
devtools/server/performance/profiler.js
devtools/server/performance/recorder.js
devtools/server/performance/timeline.js
devtools/shared/protocol.js
--- a/devtools/client/webaudioeditor/includes.js
+++ b/devtools/client/webaudioeditor/includes.js
@@ -2,20 +2,20 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
 
 const { loader, require } = Cu.import("resource://devtools/shared/Loader.jsm", {});
 const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
-const { EventTarget } = require("sdk/event/target");
 const { Task } = require("devtools/shared/task");
 const { Class } = require("sdk/core/heritage");
-const EventEmitter = require("devtools/shared/old-event-emitter");
+const OldEventEmitter = require("devtools/shared/old-event-emitter");
+const EventEmitter = require("devtools/shared/event-emitter");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 const Services = require("Services");
 const { gDevTools } = require("devtools/client/framework/devtools");
 const { LocalizationHelper } = require("devtools/shared/l10n");
 const { ViewHelpers } = require("devtools/client/shared/widgets/view-helpers");
 
 const STRINGS_URI = "devtools/client/locales/webaudioeditor.properties";
 const L10N = new LocalizationHelper(STRINGS_URI);
@@ -75,17 +75,17 @@ XPCOMUtils.defineConstant(this, "EVENTS"
 /**
  * The current target and the Web Audio Editor front, set by this tool's host.
  */
 var gToolbox, gTarget, gFront;
 
 /**
  * Convenient way of emitting events from the panel window.
  */
-EventEmitter.decorate(this);
+OldEventEmitter.decorate(this);
 
 /**
  * DOM query helper.
  */
 function $(selector, target = document) { return target.querySelector(selector); }
 function $$(selector, target = document) { return target.querySelectorAll(selector); }
 
 /**
--- a/devtools/client/webaudioeditor/models.js
+++ b/devtools/client/webaudioeditor/models.js
@@ -1,27 +1,23 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
-// Import as different name `coreEmit`, so we don't conflict
-// with the global `window` listener itself.
-const { emit: coreEmit } = require("devtools/shared/event-emitter");
-
 /**
  * Representational wrapper around AudioNodeActors. Adding and destroying
  * AudioNodes should be performed through the AudioNodes collection.
  *
  * Events:
  * - `connect`: node, destinationNode, parameter
  * - `disconnect`: node
  */
 const AudioNodeModel = Class({
-  extends: EventTarget,
+  extends: EventEmitter,
 
   // Will be added via AudioNodes `add`
   collection: null,
 
   initialize: function (actor) {
     this.actor = actor;
     this.id = actor.actorID;
     this.type = actor.type;
@@ -40,26 +36,26 @@ const AudioNodeModel = Class({
    * @param AudioNodeModel destination
    * @param String param
    */
   connect: function (destination, param) {
     let edge = findWhere(this.connections, { destination: destination.id, param: param });
 
     if (!edge) {
       this.connections.push({ source: this.id, destination: destination.id, param: param });
-      coreEmit(this, "connect", this, destination, param);
+      EventEmitter.emit(this, "connect", this, destination, param);
     }
   },
 
   /**
    * Clears out all internal connection data. Emits "disconnect" event.
    */
   disconnect: function () {
     this.connections.length = 0;
-    coreEmit(this, "disconnect", this);
+    EventEmitter.emit(this, "disconnect", this);
   },
 
   /**
    * Gets the bypass status of the audio node.
    *
    * @return Boolean
    */
   isBypassed: function () {
@@ -69,17 +65,17 @@ const AudioNodeModel = Class({
   /**
    * Sets the bypass value of an AudioNode.
    *
    * @param Boolean enable
    * @return Promise
    */
   bypass: function (enable) {
     this._bypassed = enable;
-    return this.actor.bypass(enable).then(() => coreEmit(this, "bypass", this, enable));
+    return this.actor.bypass(enable).then(() => EventEmitter.emit(this, "bypass", this, enable));
   },
 
   /**
    * Returns a promise that resolves to an array of objects containing
    * both a `param` name property and a `value` property.
    *
    * @return Promise->Object
    */
@@ -149,17 +145,17 @@ const AudioNodeModel = Class({
  *
  * Events:
  * - `add`: node
  * - `remove`: node
  * - `connect`: node, destinationNode, parameter
  * - `disconnect`: node
  */
 const AudioNodesCollection = Class({
-  extends: EventTarget,
+  extends: EventEmitter,
 
   model: AudioNodeModel,
 
   initialize: function () {
     this.models = new Set();
     this._onModelEvent = this._onModelEvent.bind(this);
   },
 
@@ -185,29 +181,29 @@ const AudioNodesCollection = Class({
    */
   add: function (obj) {
     let node = new this.model(obj);
     node.collection = this;
 
     this.models.add(node);
 
     node.on("*", this._onModelEvent);
-    coreEmit(this, "add", node);
+    EventEmitter.emit(this, "add", node);
     return node;
   },
 
   /**
    * Removes an AudioNodeModel from the internal collection. Calls `delete` method
    * on the model, and emits "remove" on this instance.
    *
    * @param AudioNodeModel node
    */
   remove: function (node) {
     this.models.delete(node);
-    coreEmit(this, "remove", node);
+    EventEmitter.emit(this, "remove", node);
   },
 
   /**
    * Empties out the internal collection of all AudioNodeModels.
    */
   reset: function () {
     this.models.clear();
   },
@@ -275,14 +271,14 @@ const AudioNodesCollection = Class({
   _onModelEvent: function (eventName, node, ...args) {
     if (eventName === "remove") {
       // If a `remove` event from the model, remove it
       // from the collection, and let the method handle the emitting on
       // the collection
       this.remove(node);
     } else {
       // Pipe the event to the collection
-      coreEmit(this, eventName, node, ...args);
+      EventEmitter.emit(this, eventName, node, ...args);
     }
   },
 
   toString: () => "[object AudioNodeCollection]",
 });
--- a/devtools/server/performance/memory.js
+++ b/devtools/server/performance/memory.js
@@ -3,18 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { Cc, Ci, Cu } = require("chrome");
 const { reportException } = require("devtools/shared/DevToolsUtils");
 const { Class } = require("sdk/core/heritage");
 const { expectState } = require("devtools/server/actors/common");
-loader.lazyRequireGetter(this, "events", "sdk/event/core");
-loader.lazyRequireGetter(this, "EventTarget", "sdk/event/target", true);
+loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
 loader.lazyRequireGetter(this, "DeferredTask",
   "resource://gre/modules/DeferredTask.jsm", true);
 loader.lazyRequireGetter(this, "StackFrameCache",
   "devtools/server/actors/utils/stack", true);
 loader.lazyRequireGetter(this, "ThreadSafeChromeUtils");
 loader.lazyRequireGetter(this, "HeapSnapshotFileUtils",
   "devtools/shared/heapsnapshot/HeapSnapshotFileUtils");
 loader.lazyRequireGetter(this, "ChromeActor", "devtools/server/actors/chrome",
@@ -28,38 +27,38 @@ loader.lazyRequireGetter(this, "ChildPro
  * parent tab. Using a global-scoped actor instance however, will measure the memory
  * footprint of the chrome window referenced by its root actor.
  *
  * To be consumed by actor's, like MemoryActor using this module to
  * send information over RDP, and TimelineActor for using more light-weight
  * utilities like GC events and measuring memory consumption.
  */
 exports.Memory = Class({
-  extends: EventTarget,
+  extends: EventEmitter,
 
   /**
    * Requires a root actor and a StackFrameCache.
    */
   initialize: function (parent, frameCache = new StackFrameCache()) {
     this.parent = parent;
     this._mgr = Cc["@mozilla.org/memory-reporter-manager;1"]
                   .getService(Ci.nsIMemoryReporterManager);
     this.state = "detached";
     this._dbg = null;
     this._frameCache = frameCache;
 
     this._onGarbageCollection = this._onGarbageCollection.bind(this);
     this._emitAllocations = this._emitAllocations.bind(this);
     this._onWindowReady = this._onWindowReady.bind(this);
 
-    events.on(this.parent, "window-ready", this._onWindowReady);
+    EventEmitter.on(this.parent, "window-ready", this._onWindowReady);
   },
 
   destroy: function () {
-    events.off(this.parent, "window-ready", this._onWindowReady);
+    EventEmitter.off(this.parent, "window-ready", this._onWindowReady);
 
     this._mgr = null;
     if (this.state === "attached") {
       this.detach();
     }
   },
 
   get dbg() {
@@ -394,34 +393,34 @@ exports.Memory = Class({
   residentUnique: function () {
     return this._mgr.residentUnique;
   },
 
   /**
    * Handler for GC events on the Debugger.Memory instance.
    */
   _onGarbageCollection: function (data) {
-    events.emit(this, "garbage-collection", data);
+    EventEmitter.emit(this, "garbage-collection", data);
 
     // If `drainAllocationsTimeout` set, fire an allocations event with the drained log,
     // which will restart the timer.
     if (this._poller) {
       this._poller.disarm();
       this._emitAllocations();
     }
   },
 
   /**
    * Called on `drainAllocationsTimeoutTimer` interval if and only if set
    * during `startRecordingAllocations`, or on a garbage collection event if
    * drainAllocationsTimeout was set.
    * Drains allocation log and emits as an event and restarts the timer.
    */
   _emitAllocations: function () {
-    events.emit(this, "allocations", this.getAllocations());
+    EventEmitter.emit(this, "allocations", this.getAllocations());
     this._poller.arm();
   },
 
   /**
    * Accesses the docshell to return the current process time.
    */
   _getCurrentTime: function () {
     return (this.parent.isRootActor ? this.parent.docShell :
--- a/devtools/server/performance/profiler.js
+++ b/devtools/server/performance/profiler.js
@@ -1,18 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 "use strict";
 
 const { Cc, Ci, Cu } = require("chrome");
 const Services = require("Services");
 const { Class } = require("sdk/core/heritage");
-loader.lazyRequireGetter(this, "events", "sdk/event/core");
-loader.lazyRequireGetter(this, "EventTarget", "sdk/event/target", true);
+loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
 loader.lazyRequireGetter(this, "DevToolsUtils", "devtools/shared/DevToolsUtils");
 loader.lazyRequireGetter(this, "DeferredTask", "resource://gre/modules/DeferredTask.jsm", true);
 loader.lazyRequireGetter(this, "Task", "devtools/shared/task", true);
 
 // Events piped from system observers to Profiler instances.
 const PROFILER_SYSTEM_EVENTS = [
   "console-api-profiler",
   "profiler-started",
@@ -348,17 +347,17 @@ const ProfilerManager = (function () {
      * @param {object} data
      */
     emitEvent: function (eventName, data) {
       let subscribers = Array.from(consumers).filter(c => {
         return c.subscribedEvents.has(eventName);
       });
 
       for (let subscriber of subscribers) {
-        events.emit(subscriber, eventName, data);
+        EventEmitter.emit(subscriber, eventName, data);
       }
     },
 
     /**
      * Updates the frequency that the "profiler-status" event is emitted
      * during recording.
      *
      * @param {number} interval
@@ -403,17 +402,17 @@ const ProfilerManager = (function () {
     }
   };
 })();
 
 /**
  * The profiler actor provides remote access to the built-in nsIProfiler module.
  */
 var Profiler = exports.Profiler = Class({
-  extends: EventTarget,
+  extends: EventEmitter,
 
   initialize: function () {
     this.subscribedEvents = new Set();
     ProfilerManager.addInstance(this);
   },
 
   destroy: function () {
     this.unregisterEventNotifications({ events: Array.from(this.subscribedEvents) });
--- a/devtools/server/performance/recorder.js
+++ b/devtools/server/performance/recorder.js
@@ -5,20 +5,17 @@
 
 const { Cu } = require("chrome");
 const { Task } = require("devtools/shared/task");
 
 loader.lazyRequireGetter(this, "Services");
 loader.lazyRequireGetter(this, "promise");
 loader.lazyRequireGetter(this, "Class",
   "sdk/core/heritage", true);
-loader.lazyRequireGetter(this, "EventTarget",
-  "sdk/event/target", true);
-loader.lazyRequireGetter(this, "events",
-  "sdk/event/core");
+loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
 
 loader.lazyRequireGetter(this, "Memory",
   "devtools/server/performance/memory", true);
 loader.lazyRequireGetter(this, "Timeline",
   "devtools/server/performance/timeline", true);
 loader.lazyRequireGetter(this, "Profiler",
   "devtools/server/performance/profiler", true);
 loader.lazyRequireGetter(this, "PerformanceRecordingActor",
@@ -46,17 +43,17 @@ const DRAIN_ALLOCATIONS_TIMEOUT = 2000;
 /**
  * A connection to underlying actors (profiler, memory, framerate, etc.)
  * shared by all tools in a target.
  *
  * @param Target target
  *        The target owning this connection.
  */
 exports.PerformanceRecorder = Class({
-  extends: EventTarget,
+  extends: EventEmitter,
 
   initialize: function (conn, tabActor) {
     this.conn = conn;
     this.tabActor = tabActor;
 
     this._pendingConsoleRecordings = [];
     this._recordings = [];
 
@@ -151,17 +148,17 @@ exports.PerformanceRecorder = Class({
       if (data.subject.action === "profile") {
         this._onConsoleProfileStart(data.details);
       } else if (data.subject.action === "profileEnd") {
         this._onConsoleProfileEnd(data.details);
       }
     } else if (topic === "profiler-stopped") {
       this._onProfilerUnexpectedlyStopped();
     } else if (topic === "profiler-status") {
-      events.emit(this, "profiler-status", data);
+      EventEmitter.emit(this, "profiler-status", data);
     }
   },
 
   /**
    * Invoked whenever `console.profile` is called.
    *
    * @param string profileLabel
    *        The provided string argument if available; undefined otherwise.
@@ -174,17 +171,17 @@ exports.PerformanceRecorder = Class({
 
     // Abort if a profile with this label already exists.
     if (recordings.find(e => e.getLabel() === profileLabel)) {
       return;
     }
 
     // Immediately emit this so the client can start setting things up,
     // expecting a recording very soon.
-    events.emit(this, "console-profile-start");
+    EventEmitter.emit(this, "console-profile-start");
 
     yield this.startRecording(Object.assign({}, getPerformanceRecordingPrefs(), {
       console: true,
       label: profileLabel
     }));
   }),
 
   /**
@@ -271,17 +268,17 @@ exports.PerformanceRecorder = Class({
       }
     }
 
     // Filter by only recordings that are currently recording;
     // TODO should filter by recordings that have realtimeMarkers enabled.
     let activeRecordings = this._recordings.filter(r => r.isRecording());
 
     if (activeRecordings.length) {
-      events.emit(this, "timeline-data", eventName, eventData, activeRecordings);
+      EventEmitter.emit(this, "timeline-data", eventName, eventData, activeRecordings);
     }
   },
 
   /**
    * Checks whether or not recording is currently supported. At the moment,
    * this is only influenced by private browsing mode and the profiler.
    */
   canCurrentlyRecord: function () {
@@ -371,17 +368,17 @@ exports.PerformanceRecorder = Class({
     data.totalSize = profilerStartData.totalSize;
 
     data.systemClient = this._systemClient;
     data.systemHost = yield getSystemInfo();
 
     let model = new PerformanceRecordingActor(this.conn, options, data);
     this._recordings.push(model);
 
-    events.emit(this, "recording-started", model);
+    EventEmitter.emit(this, "recording-started", model);
     return model;
   }),
 
   /**
    * Manually ends the recording session for the corresponding PerformanceRecording.
    *
    * @param PerformanceRecording model
    *        The corresponding PerformanceRecording that belongs to the recording
@@ -395,17 +392,17 @@ exports.PerformanceRecorder = Class({
     // from a different target.
     if (this._recordings.indexOf(model) === -1) {
       return model;
     }
 
     // Flag the recording as no longer recording, so that `model.isRecording()`
     // is false. Do this before we fetch all the data, and then subsequently
     // the recording can be considered "completed".
-    events.emit(this, "recording-stopping", model);
+    EventEmitter.emit(this, "recording-stopping", model);
 
     // Currently there are two ways profiles stop recording. Either manually in the
     // performance tool, or via console.profileEnd. Once a recording is done,
     // we want to deliver the model to the performance tool (either as a return
     // from the PerformanceFront or via `console-profile-stop` event) and then
     // remove it from the internal store.
     //
     // In the case where a console.profile is generated via the console (so the tools are
@@ -430,17 +427,17 @@ exports.PerformanceRecorder = Class({
 
     let recordingData = {
       // Data available only at the end of a recording.
       profile: profilerData.profile,
       // End times for all the actors.
       duration: profilerData.currentTime - startTime,
     };
 
-    events.emit(this, "recording-stopped", model, recordingData);
+    EventEmitter.emit(this, "recording-stopped", model, recordingData);
     return model;
   }),
 
   /**
    * Checks all currently stored recording handles and returns a boolean
    * if there is a session currently being recorded.
    *
    * @return Boolean
--- a/devtools/server/performance/timeline.js
+++ b/devtools/server/performance/timeline.js
@@ -19,58 +19,56 @@
  * When markers are available, an event is emitted:
  *   timeline.on("markers", function(markers) {...})
  */
 
 const { Ci, Cu } = require("chrome");
 const { Class } = require("sdk/core/heritage");
 // Be aggressive about lazy loading, as this will run on every
 // toolbox startup
-loader.lazyRequireGetter(this, "events", "sdk/event/core");
 loader.lazyRequireGetter(this, "Task", "devtools/shared/task", true);
 loader.lazyRequireGetter(this, "Memory", "devtools/server/performance/memory", true);
 loader.lazyRequireGetter(this, "Framerate", "devtools/server/performance/framerate", true);
 loader.lazyRequireGetter(this, "StackFrameCache", "devtools/server/actors/utils/stack", true);
-loader.lazyRequireGetter(this, "EventTarget", "sdk/event/target", true);
+loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
 
 // How often do we pull markers from the docShells, and therefore, how often do
 // we send events to the front (knowing that when there are no markers in the
 // docShell, no event is sent). In milliseconds.
 const DEFAULT_TIMELINE_DATA_PULL_TIMEOUT = 200;
 
 /**
  * The timeline actor pops and forwards timeline markers registered in docshells.
  */
 exports.Timeline = Class({
-  extends: EventTarget,
-
+  extends: EventEmitter,
   /**
    * Initializes this actor with the provided connection and tab actor.
    */
   initialize: function (tabActor) {
     this.tabActor = tabActor;
 
     this._isRecording = false;
     this._stackFrames = null;
     this._memory = null;
     this._framerate = null;
 
     // Make sure to get markers from new windows as they become available
     this._onWindowReady = this._onWindowReady.bind(this);
     this._onGarbageCollection = this._onGarbageCollection.bind(this);
-    events.on(this.tabActor, "window-ready", this._onWindowReady);
+    EventEmitter.on(this.tabActor, "window-ready", this._onWindowReady);
   },
 
   /**
    * Destroys this actor, stopping recording first.
    */
   destroy: function () {
     this.stop();
 
-    events.off(this.tabActor, "window-ready", this._onWindowReady);
+    EventEmitter.off(this.tabActor, "window-ready", this._onWindowReady);
     this.tabActor = null;
   },
 
   /**
    * Get the list of docShells in the currently attached tabActor. Note that we
    * always list the docShells included in the real root docShell, even if the
    * tabActor was switched to a child frame. This is because for now, paint
    * markers are only recorded at parent frame level so switching the timeline
@@ -140,43 +138,43 @@ exports.Timeline = Class({
               );
             }
           }
 
           // Emit some helper events for "DOMContentLoaded" and "Load" markers.
           if (this._withDocLoadingEvents) {
             if (marker.name == "document::DOMContentLoaded" ||
                 marker.name == "document::Load") {
-              events.emit(this, "doc-loading", marker, endTime);
+              EventEmitter.emit(this, "doc-loading", marker, endTime);
             }
           }
         }
       }
     }
 
     // Emit markers if requested.
     if (this._withMarkers && markers.length > 0) {
-      events.emit(this, "markers", markers, endTime);
+      EventEmitter.emit(this, "markers", markers, endTime);
     }
 
     // Emit framerate data if requested.
     if (this._withTicks) {
-      events.emit(this, "ticks", endTime, this._framerate.getPendingTicks());
+      EventEmitter.emit(this, "ticks", endTime, this._framerate.getPendingTicks());
     }
 
     // Emit memory data if requested.
     if (this._withMemory) {
-      events.emit(this, "memory", endTime, this._memory.measure());
+      EventEmitter.emit(this, "memory", endTime, this._memory.measure());
     }
 
     // Emit stack frames data if requested.
     if (this._withFrames && this._withMarkers) {
       let frames = this._stackFrames.makeEvent();
       if (frames) {
-        events.emit(this, "frames", endTime, frames);
+        EventEmitter.emit(this, "frames", endTime, frames);
       }
     }
 
     this._dataPullTimeout = setTimeout(() => {
       this._pullTimelineData();
     }, DEFAULT_TIMELINE_DATA_PULL_TIMEOUT);
   },
 
@@ -246,17 +244,17 @@ exports.Timeline = Class({
     }
 
     if (this._withMemory || this._withGCEvents) {
       this._memory = new Memory(this.tabActor, this._stackFrames);
       this._memory.attach();
     }
 
     if (this._withGCEvents) {
-      events.on(this._memory, "garbage-collection", this._onGarbageCollection);
+      EventEmitter.on(this._memory, "garbage-collection", this._onGarbageCollection);
     }
 
     if (this._withFrames && this._withMarkers) {
       this._stackFrames = new StackFrameCache();
       this._stackFrames.initFrames();
     }
 
     this._pullTimelineData();
@@ -289,17 +287,17 @@ exports.Timeline = Class({
     }
 
     if (this._withMemory || this._withGCEvents) {
       this._memory.detach();
       this._memory.destroy();
     }
 
     if (this._withGCEvents) {
-      events.off(this._memory, "garbage-collection", this._onGarbageCollection);
+      EventEmitter.off(this._memory, "garbage-collection", this._onGarbageCollection);
     }
 
     if (this._withFrames && this._withMarkers) {
       this._stackFrames = null;
     }
 
     this._isRecording = false;
     this._withMarkers = false;
@@ -341,17 +339,17 @@ exports.Timeline = Class({
   }) {
     let docShells = this.docShells;
     if (!this._isRecording || !docShells.length) {
       return;
     }
 
     let endTime = docShells[0].now();
 
-    events.emit(this, "markers", collections.map(({
+    EventEmitter.emit(this, "markers", collections.map(({
       startTimestamp: start, endTimestamp: end
     }) => {
       return {
         name: "GarbageCollection",
         causeName: reason,
         nonincrementalReason: nonincrementalReason,
         cycle: gcCycleNumber,
         start,
--- a/devtools/shared/protocol.js
+++ b/devtools/shared/protocol.js
@@ -2,22 +2,21 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var promise = require("promise");
 var defer = require("devtools/shared/defer");
 var {Class} = require("sdk/core/heritage");
-var {EventTarget} = require("sdk/event/target");
-var events = require("devtools/shared/event-emitter");
+var EventEmitter = require("devtools/shared/event-emitter");
 var {getStack, callFunctionWithAsyncStack} = require("devtools/shared/platform/stack");
 var {settleAll} = require("devtools/shared/DevToolsUtils");
 
-exports.emit = events.emit;
+exports.emit = EventEmitter.emit;
 
 /**
  * Types: named marshallers/demarshallers.
  *
  * Types provide a 'write' function that takes a js representation and
  * returns a protocol representation, and a "read" function that
  * takes a protocol representation and returns a js representation.
  *
@@ -718,17 +717,17 @@ var Response = Class({
  * Actor and Front implementations
  */
 
 /**
  * A protocol object that can manage the lifetime of other protocol
  * objects.
  */
 var Pool = Class({
-  extends: EventTarget,
+  extends: EventEmitter,
 
   /**
    * Pools are used on both sides of the connection to help coordinate
    * lifetimes.
    *
    * @param optional conn
    *   Either a DebuggerServerConnection or a DebuggerClient.  Must have
    *   addActorPool, removeActorPool, and poolFor.
@@ -1289,23 +1288,23 @@ var Front = Class({
       }
       if (event.pre) {
         let results = event.pre.map(pre => pre.apply(this, args));
 
         // Check to see if any of the preEvents returned a promise -- if so,
         // wait for their resolution before emitting. Otherwise, emit synchronously.
         if (results.some(result => result && typeof result.then === "function")) {
           promise.all(results).then(() => {
-            return events.emit.apply(null, [this, event.name].concat(args));
+            return EventEmitter.emit.apply(null, [this, event.name].concat(args));
           });
           return;
         }
       }
 
-      events.emit.apply(null, [this, event.name].concat(args));
+      EventEmitter.emit.apply(null, [this, event.name].concat(args));
       return;
     }
 
     // Remaining packets must be responses.
     if (this._requests.length === 0) {
       let msg = "Unexpected packet " + this.actorID + ", " + JSON.stringify(packet);
       let err = Error(msg);
       console.error(err);