Bug 1344504 - handle rejected promise when showing/hiding box model in markup view;r=gl draft
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 15 Mar 2017 08:44:31 +0100
changeset 499371 ff5e3e8c3c9a66877bef723c1b274534300e25fc
parent 498295 08f709c14bf70434c153defd6049b29078acba9f
child 499372 8f1cfbf2a307c65b384859845fa018877f0f371a
push id49384
push userjdescottes@mozilla.com
push dateWed, 15 Mar 2017 17:52:07 +0000
reviewersgl
bugs1344504
milestone55.0a1
Bug 1344504 - handle rejected promise when showing/hiding box model in markup view;r=gl MozReview-Commit-ID: C3aGIk1RUOU
devtools/client/inspector/markup/markup.js
--- a/devtools/client/inspector/markup/markup.js
+++ b/devtools/client/inspector/markup/markup.js
@@ -413,30 +413,32 @@ MarkupView.prototype = {
    *
    * @param  {NodeFront} nodeFront
    *         The node to show the highlighter for
    * @return {Promise} Resolves when the highlighter for this nodeFront is
    *         shown, taking into account that there could already be highlighter
    *         requests queued up
    */
   _showBoxModel: function (nodeFront) {
-    return this.toolbox.highlighterUtils.highlightNodeFront(nodeFront);
+    return this.toolbox.highlighterUtils.highlightNodeFront(nodeFront)
+      .catch(this._handleRejectionIfNotDestroyed);
   },
 
   /**
    * Hide the box model highlighter on a given node front
    *
    * @param  {Boolean} forceHide
    *         See toolbox-highlighter-utils/unhighlight
    * @return {Promise} Resolves when the highlighter for this nodeFront is
    *         hidden, taking into account that there could already be highlighter
    *         requests queued up
    */
   _hideBoxModel: function (forceHide) {
-    return this.toolbox.highlighterUtils.unhighlight(forceHide);
+    return this.toolbox.highlighterUtils.unhighlight(forceHide)
+      .catch(this._handleRejectionIfNotDestroyed);
   },
 
   _briefBoxModelTimer: null,
 
   _clearBriefBoxModelTimer: function () {
     if (this._briefBoxModelTimer) {
       clearTimeout(this._briefBoxModelTimer);
       this._briefBoxModelPromise.resolve();