Bug 1490927 - Stop sharing maps in NetworkMonitor between all instances. r=Honza a=pascalc
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 19 Sep 2018 23:26:05 +0000
changeset 490156 d442c34c8ef762d9f32b175017c8e07bdb0bd1c1
parent 490155 aa5533acaf04c5e66d920ffa144800d8c426d669
child 490157 600bf0fc57d47abd1e98b79949f1acc3a4bf5328
push id9927
push userapavel@mozilla.com
push dateWed, 03 Oct 2018 09:22:30 +0000
treeherdermozilla-beta@3947b51293f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza, pascalc
bugs1490927
milestone63.0
Bug 1490927 - Stop sharing maps in NetworkMonitor between all instances. r=Honza a=pascalc When opening a web console and a browser console, we instantiate two NetworkMonitor instances in the same process and they need independant states. Differential Revision: https://phabricator.services.mozilla.com/D6054
devtools/server/actors/network-monitor.js
--- a/devtools/server/actors/network-monitor.js
+++ b/devtools/server/actors/network-monitor.js
@@ -6,19 +6,16 @@
 
 const { Actor, ActorClassWithSpec } = require("devtools/shared/protocol");
 const { networkMonitorSpec } = require("devtools/shared/specs/network-monitor");
 
 loader.lazyRequireGetter(this, "NetworkObserver", "devtools/server/actors/network-monitor/network-observer", true);
 loader.lazyRequireGetter(this, "NetworkEventActor", "devtools/server/actors/network-event", true);
 
 const NetworkMonitorActor = ActorClassWithSpec(networkMonitorSpec, {
-  _netEvents: new Map(),
-  _networkEventActorsByURL: new Map(),
-
   /**
    * NetworkMonitorActor is instanciated from WebConsoleActor.startListeners
    * Either in the same process, for debugging service worker requests or when debugging
    * the parent process itself and tracking chrome requests.
    * Or in another process, for tracking content requests that are actually done in the
    * parent process.
    *
    * @param object filters
@@ -31,16 +28,22 @@ const NetworkMonitorActor = ActorClassWi
    * @param nsIMessageManager messageManager
    *        This is the manager to use to communicate with the console actor. When both
    *        netmonitor and console actor runs in the same process, this is an instance
    *        of MockMessageManager instead of a real message manager.
    */
   initialize(conn, filters, parentID, messageManager) {
     Actor.prototype.initialize.call(this, conn);
 
+    // Map of all NetworkEventActor indexed by channel ID
+    this._netEvents = new Map();
+
+    // Map of all NetworkEventActor indexed by URL
+    this._networkEventActorsByURL = new Map();
+
     this.parentID = parentID;
     this.messageManager = messageManager;
 
     // Immediately start watching for new request according to `filters`.
     // NetworkMonitor will call `onNetworkEvent` method.
     this.observer = new NetworkObserver(filters, this);
     this.observer.init();