Bug 945482 - Intermittent browser_dbg_variables-view-popup-08.js | Should have two frames. - Got 0, expected 2 | Test timed out | Found a tab after previous test timed out, r=me
authorVictor Porof <vporof@mozilla.com>
Wed, 04 Dec 2013 10:12:05 +0200
changeset 174448 b947d59fe3c156b51211ae5dce5c7d35a4f4e3a9
parent 174447 d791c9be9a6ea664c203973a4bc2ac23041c0778
child 174449 17aacd34982ceabe666f203c7edfdc5ccc364aac
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs945482
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 945482 - Intermittent browser_dbg_variables-view-popup-08.js | Should have two frames. - Got 0, expected 2 | Test timed out | Found a tab after previous test timed out, r=me
browser/devtools/debugger/test/browser_dbg_variables-view-popup-01.js
browser/devtools/debugger/test/browser_dbg_variables-view-popup-02.js
browser/devtools/debugger/test/browser_dbg_variables-view-popup-03.js
browser/devtools/debugger/test/browser_dbg_variables-view-popup-04.js
browser/devtools/debugger/test/browser_dbg_variables-view-popup-05.js
browser/devtools/debugger/test/browser_dbg_variables-view-popup-06.js
browser/devtools/debugger/test/browser_dbg_variables-view-popup-07.js
browser/devtools/debugger/test/browser_dbg_variables-view-popup-08.js
browser/devtools/debugger/test/head.js
--- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-01.js
@@ -7,34 +7,19 @@
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
 
 function test() {
   Task.spawn(function() {
     let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
     let win = panel.panelWin;
-    let events = win.EVENTS;
-    let editor = win.DebuggerView.editor;
     let bubble = win.DebuggerView.VariableBubble;
     let tooltip = bubble._tooltip.panel;
 
-    function openPopup(coords) {
-      let popupshown = once(tooltip, "popupshown");
-      let { left, top } = editor.getCoordsFromPosition(coords);
-      bubble._findIdentifier(left, top);
-      return popupshown;
-    }
-
-    function hidePopup() {
-      let popuphiding = once(tooltip, "popuphiding");
-      bubble.hideContents();
-      return popuphiding.then(waitForTick);
-    }
-
     function verifyContents(textContent, className) {
       is(tooltip.querySelectorAll(".variables-view-container").length, 0,
         "There should be no variables view containers added to the tooltip.");
       is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
         "There should be a simple text node added to the tooltip instead.");
 
       is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent,
         "The inspected property's value is correct.");
@@ -42,32 +27,32 @@ function test() {
         "The inspected property's value is colorized correctly.");
     }
 
     // Allow this generator function to yield first.
     executeSoon(() => debuggee.start());
     yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
 
     // Inspect variables.
-    yield openPopup({ line: 15, ch: 12 });
+    yield openVarPopup(panel, { line: 15, ch: 12 });
     verifyContents("1", "token-number");
 
-    yield hidePopup().then(() => openPopup({ line: 16, ch: 21 }));
+    yield reopenVarPopup(panel, { line: 16, ch: 21 });
     verifyContents("1", "token-number");
 
-    yield hidePopup().then(() => openPopup({ line: 17, ch: 21 }));
+    yield reopenVarPopup(panel, { line: 17, ch: 21 });
     verifyContents("1", "token-number");
 
-    yield hidePopup().then(() => openPopup({ line: 17, ch: 27 }));
+    yield reopenVarPopup(panel, { line: 17, ch: 27 });
     verifyContents("\"beta\"", "token-string");
 
-    yield hidePopup().then(() => openPopup({ line: 17, ch: 44 }));
+    yield reopenVarPopup(panel, { line: 17, ch: 44 });
     verifyContents("false", "token-boolean");
 
-    yield hidePopup().then(() => openPopup({ line: 17, ch: 54 }));
+    yield reopenVarPopup(panel, { line: 17, ch: 54 });
     verifyContents("null", "token-null");
 
-    yield hidePopup().then(() => openPopup({ line: 17, ch: 63 }));
+    yield reopenVarPopup(panel, { line: 17, ch: 63 });
     verifyContents("undefined", "token-undefined");
 
     yield resumeDebuggerThenCloseAndFinish(panel);
   });
 }
--- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-02.js
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-02.js
@@ -7,34 +7,19 @@
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
 
 function test() {
   Task.spawn(function() {
     let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
     let win = panel.panelWin;
-    let events = win.EVENTS;
-    let editor = win.DebuggerView.editor;
     let bubble = win.DebuggerView.VariableBubble;
     let tooltip = bubble._tooltip.panel;
 
-    function openPopup(coords) {
-      let popupshown = once(tooltip, "popupshown");
-      let { left, top } = editor.getCoordsFromPosition(coords);
-      bubble._findIdentifier(left, top);
-      return popupshown;
-    }
-
-    function hidePopup() {
-      let popuphiding = once(tooltip, "popuphiding");
-      bubble.hideContents();
-      return popuphiding.then(waitForTick);
-    }
-
     function verifyContents(textContent, className) {
       is(tooltip.querySelectorAll(".variables-view-container").length, 0,
         "There should be no variables view containers added to the tooltip.");
       is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
         "There should be a simple text node added to the tooltip instead.");
 
       is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent,
         "The inspected property's value is correct.");
@@ -42,20 +27,20 @@ function test() {
         "The inspected property's value is colorized correctly.");
     }
 
     // Allow this generator function to yield first.
     executeSoon(() => debuggee.start());
     yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
 
     // Inspect properties.
-    yield openPopup({ line: 19, ch: 10 });
+    yield openVarPopup(panel, { line: 19, ch: 10 });
     verifyContents("42", "token-number");
 
-    yield hidePopup().then(() => openPopup({ line: 20, ch: 14 }));
+    yield reopenVarPopup(panel, { line: 20, ch: 14 });
     verifyContents("42", "token-number");
 
-    yield hidePopup().then(() => openPopup({ line: 21, ch: 14 }));
+    yield reopenVarPopup(panel, { line: 21, ch: 14 });
     verifyContents("42", "token-number");
 
     yield resumeDebuggerThenCloseAndFinish(panel);
   });
 }
--- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-03.js
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-03.js
@@ -6,49 +6,33 @@
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
 
 function test() {
   Task.spawn(function() {
     let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
     let win = panel.panelWin;
-    let events = win.EVENTS;
-    let editor = win.DebuggerView.editor;
     let bubble = win.DebuggerView.VariableBubble;
-    let tooltip = bubble._tooltip.panel;
-
-    function openPopup(coords) {
-      let popupshown = once(tooltip, "popupshown");
-      let { left, top } = editor.getCoordsFromPosition(coords);
-      bubble._findIdentifier(left, top);
-      return popupshown;
-    }
-
-    function hidePopup() {
-      let popuphiding = once(tooltip, "popuphiding");
-      bubble.hideContents();
-      return popuphiding.then(waitForTick);
-    }
 
     // Allow this generator function to yield first.
     executeSoon(() => debuggee.start());
     yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
 
     // Inspect variable.
-    yield openPopup({ line: 15, ch: 12 });
+    yield openVarPopup(panel, { line: 15, ch: 12 });
 
     ok(!bubble._tooltip.isEmpty(),
       "The variable inspection popup isn't empty.");
     ok(bubble._markedText,
       "There's some marked text in the editor.");
     ok(bubble._markedText.clear,
       "The marked text in the editor can be cleared.");
 
-    yield hidePopup();
+    yield hideVarPopup(panel);
 
     ok(bubble._tooltip.isEmpty(),
       "The variable inspection popup is now empty.");
     ok(!bubble._markedText,
       "The marked text in the editor was removed.");
 
     yield resumeDebuggerThenCloseAndFinish(panel);
   });
--- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-04.js
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-04.js
@@ -6,41 +6,25 @@
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
 
 function test() {
   Task.spawn(function() {
     let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
     let win = panel.panelWin;
-    let events = win.EVENTS;
-    let editor = win.DebuggerView.editor;
     let bubble = win.DebuggerView.VariableBubble;
-    let tooltip = bubble._tooltip.panel;
-
-    function openPopup(coords) {
-      let popupshown = once(tooltip, "popupshown");
-      let { left, top } = editor.getCoordsFromPosition(coords);
-      bubble._findIdentifier(left, top);
-      return popupshown;
-    }
-
-    function scrollEditor() {
-      let popuphiding = once(tooltip, "popuphiding");
-      editor.setFirstVisibleLine(0);
-      return popuphiding.then(waitForTick);
-    }
 
     // Allow this generator function to yield first.
     executeSoon(() => debuggee.start());
     yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
 
     // Inspect variable.
-    yield openPopup({ line: 15, ch: 12 });
-    yield scrollEditor();
+    yield openVarPopup(panel, { line: 15, ch: 12 });
+    yield hideVarPopupByScrollingEditor(panel);
     ok(true, "The variable inspection popup was hidden.");
 
     ok(bubble._tooltip.isEmpty(),
       "The variable inspection popup is now empty.");
     ok(!bubble._markedText,
       "The marked text in the editor was removed.");
 
     yield resumeDebuggerThenCloseAndFinish(panel);
--- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-05.js
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-05.js
@@ -7,29 +7,19 @@
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
 
 function test() {
   Task.spawn(function() {
     let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
     let win = panel.panelWin;
-    let events = win.EVENTS;
-    let editor = win.DebuggerView.editor;
     let bubble = win.DebuggerView.VariableBubble;
     let tooltip = bubble._tooltip.panel;
 
-    function openPopup(coords) {
-      let popupshown = once(tooltip, "popupshown");
-      let fetched = waitForDebuggerEvents(panel, events.FETCHED_BUBBLE_PROPERTIES);
-      let { left, top } = editor.getCoordsFromPosition(coords);
-      bubble._findIdentifier(left, top);
-      return promise.all([popupshown, fetched]);
-    }
-
     function verifyContents() {
       is(tooltip.querySelectorAll(".variables-view-container").length, 1,
         "There should be one variables view container added to the tooltip.");
 
       is(tooltip.querySelectorAll(".variables-view-scope[non-header]").length, 1,
         "There should be one scope with no header displayed.");
       is(tooltip.querySelectorAll(".variables-view-variable[non-header]").length, 1,
         "There should be one variable with no header displayed.");
@@ -48,14 +38,14 @@ function test() {
         "The second property's value is correct.");
     }
 
     // Allow this generator function to yield first.
     executeSoon(() => debuggee.start());
     yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
 
     // Inspect variable.
-    yield openPopup({ line: 16, ch: 12 });
+    yield openVarPopup(panel, { line: 16, ch: 12 }, true);
     verifyContents();
 
     yield resumeDebuggerThenCloseAndFinish(panel);
   });
 }
--- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-06.js
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-06.js
@@ -7,29 +7,19 @@
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
 
 function test() {
   Task.spawn(function() {
     let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
     let win = panel.panelWin;
-    let events = win.EVENTS;
-    let editor = win.DebuggerView.editor;
     let bubble = win.DebuggerView.VariableBubble;
     let tooltip = bubble._tooltip.panel;
 
-    function openPopup(coords) {
-      let popupshown = once(tooltip, "popupshown");
-      let fetched = waitForDebuggerEvents(panel, events.FETCHED_BUBBLE_PROPERTIES);
-      let { left, top } = editor.getCoordsFromPosition(coords);
-      bubble._findIdentifier(left, top);
-      return promise.all([popupshown, fetched]);
-    }
-
     function verifyContents() {
       is(tooltip.querySelectorAll(".variables-view-container").length, 1,
         "There should be one variables view container added to the tooltip.");
 
       is(tooltip.querySelectorAll(".variables-view-scope[non-header]").length, 1,
         "There should be one scope with no header displayed.");
       is(tooltip.querySelectorAll(".variables-view-variable[non-header]").length, 1,
         "There should be one variable with no header displayed.");
@@ -73,14 +63,14 @@ function test() {
         "The seventh property's value is correct.");
     }
 
     // Allow this generator function to yield first.
     executeSoon(() => debuggee.start());
     yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
 
     // Inspect variable.
-    yield openPopup({ line: 17, ch: 12 });
+    yield openVarPopup(panel, { line: 17, ch: 12 }, true);
     verifyContents();
 
     yield resumeDebuggerThenCloseAndFinish(panel);
   });
 }
--- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-07.js
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-07.js
@@ -7,42 +7,19 @@
  */
 
 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html";
 
 function test() {
   Task.spawn(function() {
     let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
     let win = panel.panelWin;
-    let events = win.EVENTS;
-    let editor = win.DebuggerView.editor;
     let bubble = win.DebuggerView.VariableBubble;
     let tooltip = bubble._tooltip.panel;
 
-    function openSimplePopup(coords) {
-      let popupshown = once(tooltip, "popupshown");
-      let { left, top } = editor.getCoordsFromPosition(coords);
-      bubble._findIdentifier(left, top);
-      return popupshown;
-    }
-
-    function openComplexPopup(coords) {
-      let popupshown = once(tooltip, "popupshown");
-      let fetched = waitForDebuggerEvents(panel, events.FETCHED_BUBBLE_PROPERTIES);
-      let { left, top } = editor.getCoordsFromPosition(coords);
-      bubble._findIdentifier(left, top);
-      return promise.all([popupshown, fetched]);
-    }
-
-    function hidePopup() {
-      let popuphiding = once(tooltip, "popuphiding");
-      bubble.hideContents();
-      return popuphiding.then(waitForTick);
-    }
-
     function verifySimpleContents(textContent, className) {
       is(tooltip.querySelectorAll(".variables-view-container").length, 0,
         "There should be no variables view container added to the tooltip.");
       is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
         "There should be one simple text node added to the tooltip.");
 
       is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent,
         "The inspected property's value is correct.");
@@ -65,23 +42,23 @@ function test() {
         "There should be some properties displayed.");
     }
 
     // Allow this generator function to yield first.
     executeSoon(() => debuggee.start());
     yield waitForSourceAndCaretAndScopes(panel, ".html", 24);
 
     // Inspect variables.
-    yield openSimplePopup({ line: 15, ch: 12 });
+    yield openVarPopup(panel, { line: 15, ch: 12 });
     verifySimpleContents("1", "token-number");
 
-    yield hidePopup().then(() => openComplexPopup({ line: 16, ch: 12 }));
+    yield reopenVarPopup(panel, { line: 16, ch: 12 }, true);
     verifyComplexContents(2);
 
-    yield hidePopup().then(() => openSimplePopup({ line: 19, ch: 10 }));
+    yield reopenVarPopup(panel, { line: 19, ch: 10 });
     verifySimpleContents("42", "token-number");
 
-    yield hidePopup().then(() => openComplexPopup({ line: 31, ch: 10 }));
+    yield reopenVarPopup(panel, { line: 31, ch: 10 }, true);
     verifyComplexContents(100);
 
     yield resumeDebuggerThenCloseAndFinish(panel);
   });
 }
--- a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-08.js
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-08.js
@@ -12,29 +12,16 @@ function test() {
     let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
     let win = panel.panelWin;
     let events = win.EVENTS;
     let editor = win.DebuggerView.editor;
     let frames = win.DebuggerView.StackFrames;
     let bubble = win.DebuggerView.VariableBubble;
     let tooltip = bubble._tooltip.panel;
 
-    function openPopup(coords) {
-      let popupshown = once(tooltip, "popupshown");
-      let { left, top } = editor.getCoordsFromPosition(coords);
-      bubble._findIdentifier(left, top);
-      return popupshown;
-    }
-
-    function hidePopup() {
-      let popuphiding = once(tooltip, "popuphiding");
-      bubble.hideContents();
-      return popuphiding.then(waitForTick);
-    }
-
     function verifyContents(textContent, className) {
       is(tooltip.querySelectorAll(".variables-view-container").length, 0,
         "There should be no variables view containers added to the tooltip.");
       is(tooltip.querySelectorAll(".devtools-tooltip-simple-text").length, 1,
         "There should be a simple text node added to the tooltip instead.");
 
       is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent,
         "The inspected property's value is correct.");
@@ -54,26 +41,26 @@ function test() {
     }
 
     // Allow this generator function to yield first.
     executeSoon(() => debuggee.test());
     yield waitForSourceAndCaretAndScopes(panel, ".html", 20);
     checkView(0, 20);
 
     // Inspect variable in topmost frame.
-    yield openPopup({ line: 18, ch: 12 });
+    yield openVarPopup(panel, { line: 18, ch: 12 });
     verifyContents("\"second scope\"", "token-string");
     checkView(0, 20);
 
     // Change frame.
     let updatedFrame = waitForDebuggerEvents(panel, events.FETCHED_SCOPES);
-    yield hidePopup().then(() => frames.selectedDepth = 1);
+    frames.selectedDepth = 1;
     yield updatedFrame;
     checkView(1, 15);
 
     // Inspect variable in oldest frame.
-    yield openPopup({ line: 13, ch: 12 });
+    yield reopenVarPopup(panel, { line: 13, ch: 12 });
     verifyContents("\"first scope\"", "token-string");
     checkView(1, 15);
 
     yield resumeDebuggerThenCloseAndFinish(panel);
   });
 }
--- a/browser/devtools/debugger/test/head.js
+++ b/browser/devtools/debugger/test/head.js
@@ -523,16 +523,18 @@ function closeDebuggerAndFinish(aPanel, 
 
 function resumeDebuggerThenCloseAndFinish(aPanel, aFlags = {}) {
   let deferred = promise.defer();
   let thread = aPanel.panelWin.gThreadClient;
   thread.resume(() => closeDebuggerAndFinish(aPanel, aFlags).then(deferred.resolve));
   return deferred.promise;
 }
 
+// Blackboxing helpers
+
 function getBlackBoxButton(aPanel) {
   return aPanel.panelWin.document.getElementById("black-box");
 }
 
 function toggleBlackBoxing(aPanel, aSource = null) {
   function clickBlackBoxButton() {
     getBlackBoxButton(aPanel).click();
   }
@@ -540,16 +542,61 @@ function toggleBlackBoxing(aPanel, aSour
   const blackBoxChanged = waitForThreadEvents(aPanel, "blackboxchange");
 
   if (aSource) {
     aPanel.panelWin.DebuggerView.Sources.selectedValue = aSource;
     ensureSourceIs(aPanel, aSource, true).then(clickBlackBoxButton);
   } else {
     clickBlackBoxButton();
   }
+
   return blackBoxChanged;
 }
 
 function selectSourceAndGetBlackBoxButton(aPanel, aSource) {
+  function returnBlackboxButton() {
+    return getBlackBoxButton(aPanel);
+  }
+
   aPanel.panelWin.DebuggerView.Sources.selectedValue = aSource;
-  return ensureSourceIs(aPanel, aSource, true)
-    .then(getBlackBoxButton.bind(null, aPanel));
+  return ensureSourceIs(aPanel, aSource, true).then(returnBlackboxButton);
+}
+
+// Variables view inspection popup helpers
+
+function openVarPopup(aPanel, aCoords, aWaitForFetchedProperties) {
+  let events = aPanel.panelWin.EVENTS;
+  let editor = aPanel.panelWin.DebuggerView.editor;
+  let bubble = aPanel.panelWin.DebuggerView.VariableBubble;
+  let tooltip = bubble._tooltip.panel;
+
+  let popupShown = once(tooltip, "popupshown");
+  let fetchedProperties = aWaitForFetchedProperties
+    ? waitForDebuggerEvents(aPanel, events.FETCHED_BUBBLE_PROPERTIES)
+    : promise.resolve(null);
+
+  let { left, top } = editor.getCoordsFromPosition(aCoords);
+  bubble._findIdentifier(left, top);
+  return promise.all([popupShown, fetchedProperties]).then(waitForTick);
 }
+
+function hideVarPopup(aPanel) {
+  let bubble = aPanel.panelWin.DebuggerView.VariableBubble;
+  let tooltip = bubble._tooltip.panel;
+
+  let popupHiding = once(tooltip, "popuphiding");
+  bubble.hideContents();
+  return popupHiding.then(waitForTick);
+}
+
+function hideVarPopupByScrollingEditor(aPanel) {
+  let editor = aPanel.panelWin.DebuggerView.editor;
+  let bubble = aPanel.panelWin.DebuggerView.VariableBubble;
+  let tooltip = bubble._tooltip.panel;
+
+  let popupHiding = once(tooltip, "popuphiding");
+  editor.setFirstVisibleLine(0);
+  return popupHiding.then(waitForTick);
+}
+
+function reopenVarPopup(...aArgs) {
+  return hideVarPopup.apply(this, aArgs).then(() => openVarPopup.apply(this, aArgs));
+}