Bug 1292081 - Prevent reloading web pages twice when devtools are opened. r=jryans, a=ritu
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 11 Aug 2016 04:14:36 -0700
changeset 349828 c6110450ff8f25ee4ce5073a9a4a4cb48474ecd5
parent 349827 b263ff7776f278a5c0e0f4d70e1d6b209f4c4542
child 349829 baaef0504ff7b390b83297091b9cdfa241b79d2c
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans, ritu
bugs1292081
milestone50.0a2
Bug 1292081 - Prevent reloading web pages twice when devtools are opened. r=jryans, a=ritu
devtools/client/framework/toolbox.js
--- a/devtools/client/framework/toolbox.js
+++ b/devtools/client/framework/toolbox.js
@@ -578,17 +578,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));