Backed out changeset 52e8296f4d36 (bug 1164195) as requested by nchevobbe for missing the reviewer information.
authorBrindusan Cristian <cbrindusan@mozilla.com>
Wed, 13 Mar 2019 09:49:45 +0200
changeset 521664 c4a4baf50679
parent 521663 52e8296f4d36
child 521665 7f3111601872
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1164195
milestone67.0a1
backs out52e8296f4d36
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
Backed out changeset 52e8296f4d36 (bug 1164195) as requested by nchevobbe for missing the reviewer information.
devtools/client/webconsole/test/mochitest/browser_jsterm_helper_dollar_x.js
devtools/server/actors/webconsole/utils.js
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_helper_dollar_x.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_helper_dollar_x.js
@@ -32,60 +32,9 @@ async function performTests() {
   jsterm.execute("$x('.//li')");
   let message = await onMessage;
   ok(message, "`$x` worked");
 
   onMessage = waitForMessage(hud, "<li>");
   jsterm.execute("$x('.//li', document.body)[0]");
   message = await onMessage;
   ok(message, "`$x()` result can be used right away");
-
-  onMessage = waitForMessage(hud, "2");
-  jsterm.execute("$x('count(.//li)', document.body, XPathResult.NUMBER_TYPE)");
-  message = await onMessage;
-  ok(message, "$x works as expected with XPathResult.NUMBER_TYPE");
-
-  onMessage = waitForMessage(hud, "First");
-  jsterm.execute("$x('.//li', document.body, XPathResult.STRING_TYPE)");
-  message = await onMessage;
-  ok(message, "$x works as expected with XPathResult.STRING_TYPE");
-
-  onMessage = waitForMessage(hud, "true");
-  jsterm.execute("$x('//li[not(@foo)]', document.body, XPathResult.BOOLEAN_TYPE)");
-  message = await onMessage;
-  ok(message, "$x works as expected with XPathResult.BOOLEAN_TYPE");
-
-  onMessage = waitForMessage(hud, "Array [ li, li ]");
-  jsterm
-  .execute("$x('.//li', document.body, XPathResult.UNORDERED_NODE_ITERATOR_TYPE)");
-  message = await onMessage;
-  ok(message, "$x works as expected with XPathResult.UNORDERED_NODE_ITERATOR_TYPE");
-
-  onMessage = waitForMessage(hud, "Array [ li, li ]");
-  jsterm
-  .execute("$x('.//li', document.body, XPathResult.ORDERED_NODE_ITERATOR_TYPE)");
-  message = await onMessage;
-  ok(message, "$x works as expected with XPathResult.ORDERED_NODE_ITERATOR_TYPE");
-
-  onMessage = waitForMessage(hud, "<li>");
-  jsterm
-  .execute("$x('.//li', document.body, XPathResult.ANY_UNORDERED_NODE_TYPE)");
-  message = await onMessage;
-  ok(message, "$x works as expected with XPathResult.ANY_UNORDERED_NODE_TYPE");
-
-  onMessage = waitForMessage(hud, "<li>");
-  jsterm
-  .execute("$x('.//li', document.body, XPathResult.FIRST_ORDERED_NODE_TYPE)");
-  message = await onMessage;
-  ok(message, "$x works as expected with XPathResult.FIRST_ORDERED_NODE_TYPE");
-
-  onMessage = waitForMessage(hud, "Array [ li, li ]");
-  jsterm
-  .execute("$x('.//li', document.body, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE)");
-  message = await onMessage;
-  ok(message, "$x works as expected with XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE");
-
-  onMessage = waitForMessage(hud, "Array [ li, li ]");
-  jsterm
-  .execute("$x('.//li', document.body, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE)");
-  message = await onMessage;
-  ok(message, "$x works as expected with XPathResult.ORDERED_NODE_SNAPSHOT_TYPE");
 }
--- a/devtools/server/actors/webconsole/utils.js
+++ b/devtools/server/actors/webconsole/utils.js
@@ -357,54 +357,26 @@ WebConsoleCommands._registerOriginal("$_
  * Runs an xPath query and returns all matched nodes.
  *
  * @param string xPath
  *        xPath search query to execute.
  * @param [optional] Node context
  *        Context to run the xPath query on. Uses window.document if not set.
  * @return array of Node
  */
-WebConsoleCommands._registerOriginal("$x", function(
-  owner,
-  xPath,
-  context,
-  resultType = owner.window.XPathResult.ANY_TYPE) {
+WebConsoleCommands._registerOriginal("$x", function(owner, xPath, context) {
   const nodes = new owner.window.Array();
 
   // Not waiving Xrays, since we want the original Document.evaluate function,
   // instead of anything that's been redefined.
   const doc = owner.window.document;
   context = context || doc;
 
   const results = doc.evaluate(xPath, context, null,
-                             resultType, null);
-  if (results.resultType === owner.window.XPathResult.NUMBER_TYPE) {
-    return results.numberValue;
-  }
-  if (results.resultType === owner.window.XPathResult.STRING_TYPE) {
-    return results.stringValue;
-  }
-  if (results.resultType === owner.window.XPathResult.BOOLEAN_TYPE) {
-    return results.booleanValue;
-  }
-  if
-  (results.resultType === owner.window.XPathResult.ANY_UNORDERED_NODE_TYPE ||
-    results.resultType === owner.window.XPathResult.FIRST_ORDERED_NODE_TYPE) {
-    return results.singleNodeValue;
-  }
-  if
-  (results.resultType === owner.window.XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE ||
-    results.resultType === owner.window.XPathResult.ORDERED_NODE_SNAPSHOT_TYPE
-) {
-    for (let i = 0; i < results.snapshotLength; i++) {
-      nodes.push(results.snapshotItem(i));
-    }
-    return nodes;
-  }
-
+                             owner.window.XPathResult.ANY_TYPE, null);
   let node;
   while ((node = results.iterateNext())) {
     nodes.push(node);
   }
 
   return nodes;
 });