Bug 1436665 - Remove unnecessary argument; r=ochameau draft
authorJan Odvarko <odvarko@gmail.com>
Mon, 26 Mar 2018 19:30:01 +0200
changeset 772636 1bbcf0ff2d06d0dcb15752673eb5bb630c91a4ca
parent 772635 773a07f7efddbaff3f4af44fb68c74907bbf3a71
push id103998
push userjodvarko@mozilla.com
push dateMon, 26 Mar 2018 17:35:53 +0000
reviewersochameau
bugs1436665
milestone61.0a1
Bug 1436665 - Remove unnecessary argument; r=ochameau MozReview-Commit-ID: 960nsrA1ibe
devtools/client/framework/toolbox.js
devtools/client/netmonitor/src/app.js
devtools/client/netmonitor/src/connector/firefox-connector.js
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -3054,17 +3054,17 @@ Toolbox.prototype = {
     if (this._netMonitorApp) {
       return this._netMonitorApp;
     }
 
     // Create and initialize Network monitor application object.
     // This object is only connected to the backend not to the UI.
     // It's supposed to be used by WebExtension API only.
     this._netMonitorApp = new NetMonitorApp();
-    await this._netMonitorApp.connect({toolbox: this});
+    await this._netMonitorApp.connect(this);
 
     return this._netMonitorApp;
   },
 
   /**
    * Returns data (HAR) collected by the Network panel.
    */
   getHARFromNetMonitor: async function() {
--- a/devtools/client/netmonitor/src/app.js
+++ b/devtools/client/netmonitor/src/app.js
@@ -79,32 +79,31 @@ NetMonitorApp.prototype = {
       openSplitConsole,
       sourceMapService
     });
 
     // Render the root Application component.
     const ProviderFactory = createFactory(Provider);
     render(ProviderFactory({ store: this.store }, app), this.mount);
 
-    return this.connect({toolbox, panel});
+    return this.connect(toolbox);
   },
 
-  connect({ toolbox, panel }) {
+  connect(toolbox) {
     this.toolbox = toolbox;
 
     // Register listener for new requests (utilized by WebExtension API).
     this.on(EVENTS.REQUEST_ADDED, this.onRequestAdded);
 
     // Initialize connection to the backend.
     const connection = {
       tabConnection: {
         tabTarget: toolbox.target,
       },
       toolbox,
-      panel,
       app: this,
     };
 
     return this.connectBackend(this.connector, connection, this.actions,
       this.store.getState);
   },
 
   /**
--- a/devtools/client/netmonitor/src/connector/firefox-connector.js
+++ b/devtools/client/netmonitor/src/connector/firefox-connector.js
@@ -35,17 +35,16 @@ class FirefoxConnector {
     this.getNetworkRequest = this.getNetworkRequest.bind(this);
   }
 
   async connect(connection, actions, getState) {
     this.actions = actions;
     this.getState = getState;
     this.tabTarget = connection.tabConnection.tabTarget;
     this.toolbox = connection.toolbox;
-    this.panel = connection.panel;
     this.app = connection.app;
 
     this.webConsoleClient = this.tabTarget.activeConsole;
 
     this.dataProvider = new FirefoxDataProvider({
       webConsoleClient: this.webConsoleClient,
       actions: this.actions,
       app: this.app,
@@ -169,18 +168,19 @@ class FirefoxConnector {
       if (this.dataProvider) {
         this.onReloaded();
       }
     };
     this.app.on(EVENTS.PAYLOAD_READY, listener);
   }
 
   onReloaded() {
-    if (this.panel) {
-      this.panel.emit("reloaded");
+    let panel = this.toolbox.getPanel("netmonitor");
+    if (panel) {
+      panel.emit("reloaded");
     }
   }
 
   /**
    * Display any network events already in the cache.
    */
   displayCachedEvents() {
     for (let networkInfo of this.webConsoleClient.getNetworkEvents()) {