Bug 1292081 - Prevents reloading web pages twice when devtools are opened. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 11 Aug 2016 04:14:36 -0700
changeset 308986 39fdb9c2017e96940075926234809cef0f8b5f1b
parent 308985 481b43b3340f0f960063264eee946314d4357a79
child 308987 9dae91a2c31d1d7ee1f426b4f61179a42e0dab64
push id20290
push userapoirot@mozilla.com
push dateThu, 11 Aug 2016 11:15:13 +0000
treeherderfx-team@39fdb9c2017e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1292081
milestone51.0a1
Bug 1292081 - Prevents reloading web pages twice when devtools are opened. r=jryans
devtools/client/framework/toolbox.js
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -586,17 +586,22 @@ Toolbox.prototype = {
   _addReloadKeys: function (shortcuts) {
     [
       ["reload", false],
       ["reload2", false],
       ["forceReload", true],
       ["forceReload2", true]
     ].forEach(([id, force]) => {
       let key = toolboxStrings("toolbox." + id + ".key");
-      shortcuts.on(key, this.reloadTarget.bind(this, force));
+      shortcuts.on(key, (name, event) => {
+        this.reloadTarget(force);
+
+        // Prevent Firefox shortcuts from reloading the page
+        event.preventDefault();
+      });
     });
   },
 
   _addHostListeners: function (shortcuts) {
     shortcuts.on(toolboxStrings("toolbox.nextTool.key"),
                  this.selectNextTool.bind(this));
     shortcuts.on(toolboxStrings("toolbox.previousTool.key"),
                  this.selectPreviousTool.bind(this));