Bug 1382581 - Adapt webaudioeditor code to the EventEmitter change in devtools/client/framework; r=sole.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Wed, 14 Mar 2018 18:16:28 +0100
changeset 408653 79e040625d0d9c2f74e97d3b75980072f7b6bb24
parent 408652 3ccfccd21cc7d8dd0e8b7443efc15157497b548d
child 408654 0027f4cb4994178a80ec0a06412896a7d6bcd09d
push id100996
push userbtara@mozilla.com
push dateSat, 17 Mar 2018 10:37:43 +0000
treeherdermozilla-inbound@97160a734959 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssole
bugs1382581
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382581 - Adapt webaudioeditor code to the EventEmitter change in devtools/client/framework; r=sole. MozReview-Commit-ID: 1lmzZZSyO7c
devtools/client/webaudioeditor/controller.js
--- a/devtools/client/webaudioeditor/controller.js
+++ b/devtools/client/webaudioeditor/controller.js
@@ -39,21 +39,20 @@ function shutdownWebAudioEditor() {
 /**
  * Functions handling target-related lifetime events.
  */
 var WebAudioEditorController = {
   /**
    * Listen for events emitted by the current tab target.
    */
   async initialize() {
-    this._onTabNavigated = this._onTabNavigated.bind(this);
+    this._onTabWillNavigate = this._onTabWillNavigate.bind(this);
     this._onThemeChange = this._onThemeChange.bind(this);
 
-    gTarget.on("will-navigate", this._onTabNavigated);
-    gTarget.on("navigate", this._onTabNavigated);
+    gTarget.on("will-navigate", this._onTabWillNavigate);
     gFront.on("start-context", this._onStartContext);
     gFront.on("create-node", this._onCreateNode);
     gFront.on("connect-node", this._onConnectNode);
     gFront.on("connect-param", this._onConnectParam);
     gFront.on("disconnect-node", this._onDisconnectNode);
     gFront.on("change-param", this._onChangeParam);
     gFront.on("destroy-node", this._onDestroyNode);
 
@@ -80,18 +79,17 @@ var WebAudioEditorController = {
     // globals.
     gFront.setup({ reload: false });
   },
 
   /**
    * Remove events emitted by the current tab target.
    */
   destroy: function () {
-    gTarget.off("will-navigate", this._onTabNavigated);
-    gTarget.off("navigate", this._onTabNavigated);
+    gTarget.off("will-navigate", this._onTabWillNavigate);
     gFront.off("start-context", this._onStartContext);
     gFront.off("create-node", this._onCreateNode);
     gFront.off("connect-node", this._onConnectNode);
     gFront.off("connect-param", this._onConnectParam);
     gFront.off("disconnect-node", this._onDisconnectNode);
     gFront.off("change-param", this._onChangeParam);
     gFront.off("destroy-node", this._onDestroyNode);
     this._prefObserver.off("devtools.theme", this._onThemeChange);
@@ -137,47 +135,37 @@ var WebAudioEditorController = {
   _onThemeChange: function () {
     let newValue = Services.prefs.getCharPref("devtools.theme");
     window.emit(EVENTS.THEME_CHANGE, newValue);
   },
 
   /**
    * Called for each location change in the debugged tab.
    */
-  async _onTabNavigated(event, {isFrameSwitching}) {
-    switch (event) {
-      case "will-navigate": {
-        // Clear out current UI.
-        this.reset();
+  _onTabWillNavigate: function({isFrameSwitching}) {
+    // Clear out current UI.
+    this.reset();
 
-        // When switching to an iframe, ensure displaying the reload button.
-        // As the document has already been loaded without being hooked.
-        if (isFrameSwitching) {
-          $("#reload-notice").hidden = false;
-          $("#waiting-notice").hidden = true;
-        } else {
-          // Otherwise, we are loading a new top level document,
-          // so we don't need to reload anymore and should receive
-          // new node events.
-          $("#reload-notice").hidden = true;
-          $("#waiting-notice").hidden = false;
-        }
+    // When switching to an iframe, ensure displaying the reload button.
+    // As the document has already been loaded without being hooked.
+    if (isFrameSwitching) {
+      $("#reload-notice").hidden = false;
+      $("#waiting-notice").hidden = true;
+    } else {
+      // Otherwise, we are loading a new top level document,
+      // so we don't need to reload anymore and should receive
+      // new node events.
+      $("#reload-notice").hidden = true;
+      $("#waiting-notice").hidden = false;
+    }
 
-        // Clear out stored audio nodes
-        gAudioNodes.reset();
+    // Clear out stored audio nodes
+    gAudioNodes.reset();
 
-        window.emit(EVENTS.UI_RESET);
-        break;
-      }
-      case "navigate": {
-        // TODO Case of bfcache, needs investigating
-        // bug 994250
-        break;
-      }
-    }
+    window.emit(EVENTS.UI_RESET);
   },
 
   /**
    * Called after the first audio node is created in an audio context,
    * signaling that the audio context is being used.
    */
   _onStartContext: function () {
     $("#reload-notice").hidden = true;