Bug 1266134 - Prevent browser_computed_keybindings_01.js from opening options panel. r=jryans
☠☠ backed out by 7421808509ca ☠ ☠
authorAlexandre Poirot <poirot.alex@gmail.com>
Thu, 15 Sep 2016 15:08:11 -0700
changeset 317046 e17d5bf3dcfa36df57814cc12b3fcde399525436
parent 317045 5ad2b64b4df76573b770291e93509f1820bdf21c
child 317047 032f01f6d68b6ab27aa1de034d5e99cd33f8526a
push id20681
push userphilringnalda@gmail.com
push dateSat, 08 Oct 2016 23:57:20 +0000
treeherderfx-team@7a7ba250bb2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjryans
bugs1266134
milestone52.0a1
Bug 1266134 - Prevent browser_computed_keybindings_01.js from opening options panel. r=jryans MozReview-Commit-ID: LXCWjQwkwUN
devtools/client/inspector/computed/computed.js
devtools/client/inspector/computed/test/browser_computed_keybindings_01.js
--- a/devtools/client/inspector/computed/computed.js
+++ b/devtools/client/inspector/computed/computed.js
@@ -919,16 +919,19 @@ PropertyView.prototype = {
     // Make it keyboard navigable
     this.element.setAttribute("tabindex", "0");
     this.shortcuts = new KeyShortcuts({
       window: this.tree.styleWindow,
       target: this.element
     });
     this.shortcuts.on("F1", (name, event) => {
       this.mdnLinkClick(event);
+      // Prevent opening the options panel
+      event.preventDefault();
+      event.stopPropagation();
     });
     this.shortcuts.on("Return", (name, event) => this.onMatchedToggle(event));
     this.shortcuts.on("Space", (name, event) => this.onMatchedToggle(event));
 
     let nameContainer = doc.createElementNS(HTML_NS, "div");
     nameContainer.className = "property-name-container";
     this.element.appendChild(nameContainer);
 
@@ -1150,18 +1153,16 @@ PropertyView.prototype = {
    */
   mdnLinkClick: function (event) {
     let inspector = this.tree.inspector;
 
     if (inspector.target.tab) {
       let browserWin = inspector.target.tab.ownerDocument.defaultView;
       browserWin.openUILinkIn(this.link, "tab");
     }
-    event.preventDefault();
-    event.stopPropagation();
   },
 
   /**
    * Destroy this property view, removing event listeners
    */
   destroy: function () {
     this.element.removeEventListener("dblclick", this.onMatchedToggle, false);
     this.shortcuts.destroy();
--- a/devtools/client/inspector/computed/test/browser_computed_keybindings_01.js
+++ b/devtools/client/inspector/computed/test/browser_computed_keybindings_01.js
@@ -68,16 +68,16 @@ function* checkToggleKeyBinding(win, key
   is(rulesTable.innerHTML, "", "The property has been collapsed");
 }
 
 function checkHelpLinkKeybinding(view) {
   info("Check that MDN link is opened on \"F1\"");
   let def = defer();
 
   let propView = getFirstVisiblePropertyView(view);
-  propView.mdnLinkClick = function () {
+  propView.mdnLinkClick = function (event) {
     ok(true, "Pressing F1 opened the MDN link");
     def.resolve();
   };
 
   EventUtils.synthesizeKey("VK_F1", {}, view.styleWindow);
   return def.promise;
 }