Bug 952277 - DOMNodes can be highlighted and selected from the debugger - Debugger test; r=vporof
authorPatrick Brosset <pbrosset@mozilla.com>
Sat, 01 Feb 2014 10:24:47 +0100
changeset 182461 c63c7b1d253d4c872d3fc770e45060d490101426
parent 182460 790594df4527ceb7ba6a4d0b9ece18df9ee43698
child 182462 41ac71fd705e126e1e1f4c2323db8245bf0be4db
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvporof
bugs952277
milestone29.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 952277 - DOMNodes can be highlighted and selected from the debugger - Debugger test; r=vporof
browser/devtools/debugger/test/browser.ini
browser/devtools/debugger/test/browser_dbg_variables-view-popup-13.js
browser/devtools/debugger/test/doc_domnode-variables.html
--- a/browser/devtools/debugger/test/browser.ini
+++ b/browser/devtools/debugger/test/browser.ini
@@ -31,16 +31,17 @@ support-files =
   doc_auto-pretty-print-01.html
   doc_auto-pretty-print-02.html
   doc_binary_search.html
   doc_blackboxing.html
   doc_closures.html
   doc_cmd-break.html
   doc_cmd-dbg.html
   doc_conditional-breakpoints.html
+  doc_domnode-variables.html
   doc_editor-mode.html
   doc_empty-tab-01.html
   doc_empty-tab-02.html
   doc_event-listeners.html
   doc_event-listeners-02.html
   doc_frame-parameters.html
   doc_function-display-name.html
   doc_function-search.html
@@ -242,16 +243,17 @@ support-files =
 [browser_dbg_variables-view-popup-05.js]
 [browser_dbg_variables-view-popup-06.js]
 [browser_dbg_variables-view-popup-07.js]
 [browser_dbg_variables-view-popup-08.js]
 [browser_dbg_variables-view-popup-09.js]
 [browser_dbg_variables-view-popup-10.js]
 [browser_dbg_variables-view-popup-11.js]
 [browser_dbg_variables-view-popup-12.js]
+[browser_dbg_variables-view-popup-13.js]
 [browser_dbg_variables-view-reexpand-01.js]
 [browser_dbg_variables-view-reexpand-02.js]
 [browser_dbg_variables-view-webidl.js]
 [browser_dbg_watch-expressions-01.js]
 [browser_dbg_watch-expressions-02.js]
 [browser_dbg_chrome-create.js]
 skip-if = os == "linux" # Bug 847558
 [browser_dbg_on-pause-raise.js]
new file mode 100644
--- /dev/null
+++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-13.js
@@ -0,0 +1,62 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Tests that the variable inspection popup has inspector links for DOMNode
+ * properties and that the popup closes when the link is clicked
+ */
+
+const TAB_URL = EXAMPLE_URL + "doc_domnode-variables.html";
+
+function test() {
+  Task.spawn(function() {
+    let [tab, debuggee, panel] = yield initDebugger(TAB_URL);
+    let win = panel.panelWin;
+    let bubble = win.DebuggerView.VariableBubble;
+    let tooltip = bubble._tooltip.panel;
+    let toolbox = gDevTools.getToolbox(panel.target);
+
+    function getDomNodeInTooltip(propertyName) {
+      let domNodeProperties = tooltip.querySelectorAll(".token-domnode");
+      for (let prop of domNodeProperties) {
+        let propName = prop.parentNode.querySelector(".name");
+        if (propName.getAttribute("value") === propertyName) {
+          ok(true, "DOMNode " + propertyName + " was found in the tooltip");
+          return prop;
+        }
+      }
+      ok(false, "DOMNode " + propertyName + " wasn't found in the tooltip");
+    }
+
+    // Allow this generator function to yield first.
+    executeSoon(() => debuggee.start());
+    yield waitForSourceAndCaretAndScopes(panel, ".html", 19);
+
+    // Inspect the div DOM variable.
+    yield openVarPopup(panel, { line: 17, ch: 38 }, true);
+    let property = getDomNodeInTooltip("firstElementChild");
+
+    // Simulate mouseover on the property value
+    let highlighted = once(toolbox, "node-highlight");
+    EventUtils.sendMouseEvent({ type: "mouseover" }, property,
+      property.ownerDocument.defaultView);
+    yield highlighted;
+    ok(true, "The node-highlight event was fired on hover of the DOMNode");
+
+    // Simulate a click on the "select in inspector" button
+    let button = property.parentNode.querySelector(".variables-view-open-inspector");
+    ok(button, "The select-in-inspector button is present");
+    let inspectorSelected = once(toolbox, "inspector-selected");
+    EventUtils.sendMouseEvent({ type: "mousedown" }, button,
+      button.ownerDocument.defaultView);
+    yield inspectorSelected;
+    ok(true, "The inspector got selected when clicked on the select-in-inspector");
+
+    // Make sure the inspector's initialization is finalized before ending the test
+    // Listening to the event *after* triggering the switch to the inspector isn't
+    // a problem as the inspector is asynchronously loaded.
+    yield once(toolbox.getPanel("inspector"), "inspector-updated");
+
+    yield resumeDebuggerThenCloseAndFinish(panel);
+  });
+}
new file mode 100644
--- /dev/null
+++ b/browser/devtools/debugger/test/doc_domnode-variables.html
@@ -0,0 +1,24 @@
+<!-- Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!doctype html>
+
+<html>
+  <head>
+    <meta charset="utf-8"/>
+    <title>Debugger test page</title>
+  </head>
+
+  <body>
+    <div>Look at this DIV! Just look at it!</div>
+
+    <script type="text/javascript">
+      function start() {
+        var theDiv = document.querySelector("div");
+        var theBody = document.body;
+        var manyDomNodes = [theDiv, theBody];
+        debugger;
+      }
+    </script>
+  </body>
+
+</html>