Bug 967853 - Hide variable tooltip when stepping in devtools debugger. r=pbrosset
☠☠ backed out by 58eed354d2a9 ☠ ☠
authorHallvord R. M. Steen <hsteen@mozilla.com>
Tue, 20 Jan 2015 07:25:31 +0100
changeset 242080 86ed8b7700c895ccf95732d7a4b0cf29b2a24b41
parent 242079 cc4794a3d8696f6649795bcadb6ccca8781512e0
child 242081 2bf7be61d48b28c96bced94d29798ce8835ac555
push id634
push usermozilla@noorenberghe.ca
push dateTue, 10 Feb 2015 22:34:30 +0000
reviewerspbrosset
bugs967853
milestone38.0a1
Bug 967853 - Hide variable tooltip when stepping in devtools debugger. r=pbrosset
browser/devtools/debugger/debugger-panes.js
browser/devtools/debugger/test/browser.ini
browser/devtools/debugger/test/browser_dbg_variables-view-popup-17.js
--- a/browser/devtools/debugger/debugger-panes.js
+++ b/browser/devtools/debugger/debugger-panes.js
@@ -1892,16 +1892,19 @@ VariableBubbleView.prototype = {
     this._tooltip = new Tooltip(document, {
       closeOnEvents: [{
         emitter: DebuggerController._toolbox,
         event: "select"
       }, {
         emitter: this._editorContainer,
         event: "scroll",
         useCapture: true
+      }, {
+        emitter: DebuggerController._toolbox.target,
+        event: "thread-resumed"
       }]
     });
     this._tooltip.defaultPosition = EDITOR_VARIABLE_POPUP_POSITION;
     this._tooltip.defaultShowDelay = EDITOR_VARIABLE_HOVER_DELAY;
     this._tooltip.panel.addEventListener("popuphiding", this._onPopupHiding);
   },
 
   /**
--- a/browser/devtools/debugger/test/browser.ini
+++ b/browser/devtools/debugger/test/browser.ini
@@ -540,16 +540,18 @@ skip-if = e10s && debug
 [browser_dbg_variables-view-popup-13.js]
 skip-if = e10s && debug
 [browser_dbg_variables-view-popup-14.js]
 skip-if = true # Bug 1029545
 [browser_dbg_variables-view-popup-15.js]
 skip-if = e10s && debug
 [browser_dbg_variables-view-popup-16.js]
 skip-if = e10s  && debug
+[browser_dbg_variables-view-popup-17.js]
+skip-if = e10s  && debug
 [browser_dbg_variables-view-reexpand-01.js]
 skip-if = e10s && debug
 [browser_dbg_variables-view-reexpand-02.js]
 skip-if = e10s && debug
 [browser_dbg_variables-view-reexpand-03.js]
 skip-if = e10s && debug
 [browser_dbg_variables-view-webidl.js]
 skip-if = e10s && debug
new file mode 100644
--- /dev/null
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-17.js
@@ -0,0 +1,96 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Tests opening the variable inspection popup while stopped at a debugger statement,
+ * clicking "step in" and verifying that the popup is gone.
+ */
+
+const TAB_URL = EXAMPLE_URL + "doc_with-frame.html";
+
+let gTab, gPanel, gDebugger;
+let gBreakpoints, gSources, gVariables;
+
+function test() {
+  // Debug test slaves are a bit slow at this test.
+  requestLongerTimeout(4);
+
+  initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
+    gTab = aTab;
+    gPanel = aPanel;
+    gDebugger = gPanel.panelWin;
+    gBreakpoints = gDebugger.DebuggerController.Breakpoints;
+    gSources = gDebugger.DebuggerView.Sources;
+    gVariables = gDebugger.DebuggerView.Variables;
+    let bubble = gDebugger.DebuggerView.VariableBubble;
+    let tooltip = bubble._tooltip.panel;
+
+    waitForSourceShown(gPanel, ".html")
+      .then(addBreakpoint)
+      .then(() => ensureThreadClientState(gPanel, "resumed"))
+      .then(pauseDebuggee)
+      .then(() => openVarPopup(gPanel, { line: 20, ch: 17 }))
+      .then(function(){
+        is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
+          "The popup should be open with a simple text entry");
+        return stepInDebuggee(gDebugger, gPanel);
+      })
+      .then(() => checkVariablePopupClosed(bubble, tooltip))
+      .then(() => resumeDebuggerThenCloseAndFinish(gPanel))
+      .then(null, aError => {
+        ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
+      });
+  });
+}
+
+function addBreakpoint() {
+  return gBreakpoints.addBreakpoint({ actor: gSources.selectedValue, line: 21 });
+}
+
+function pauseDebuggee() {
+  sendMouseClickToTab(gTab, content.document.querySelector("button"));
+
+  // The first 'with' scope should be expanded by default, but the
+  // variables haven't been fetched yet. This is how 'with' scopes work.
+  return promise.all([
+    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES),
+    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES)
+  ]);
+}
+
+function stepInDebuggee(gDebugger, gPanel) {
+  // Spin the event loop before causing the debuggee to pause, to allow
+  // this function to return first.
+  executeSoon(() => {
+    EventUtils.sendMouseEvent({ type: "mousedown" },
+      gDebugger.document.querySelector("#step-in"),
+      gDebugger);
+  });
+
+  return promise.all([
+    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_SCOPES, 1),
+    waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FETCHED_VARIABLES, 1)
+  ]);
+}
+
+function checkVariablePopupClosed(bubble){
+  ok(!bubble.contentsShown(),
+    "When stepping, popup should close and be hidden.");
+  ok(bubble._tooltip.isEmpty(),
+    "The variable inspection popup should now be empty.");
+  ok(!bubble._markedText,
+    "The marked text in the editor was removed.");
+
+  return promise.resolve(null);
+}
+
+
+
+registerCleanupFunction(function() {
+  gTab = null;
+  gPanel = null;
+  gDebugger = null;
+  gBreakpoints = null;
+  gSources = null;
+  gVariables = null;
+});