Bug 1152682: Correct invalid selector errors in elements.js
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 20 Apr 2015 13:45:59 +0100
changeset 240415 9cfeed1582a3545bc29ad4f4455636363507a7a0
parent 240414 695f93953c01e3bd65a53b1c13d0b817a540e74f
child 240416 d86eef3f31ee3a10372055b37f78e6a57a89cd45
push id28636
push userkwierso@gmail.com
push dateThu, 23 Apr 2015 00:16:12 +0000
treeherdermozilla-central@a5af73b32ac8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1152682
milestone40.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 1152682: Correct invalid selector errors in elements.js r=jgriffin
testing/marionette/elements.js
--- a/testing/marionette/elements.js
+++ b/testing/marionette/elements.js
@@ -435,17 +435,17 @@ ElementManager.prototype = {
    * @return nsIDOMElement or list of nsIDOMElements
    *        Returns the element(s) by calling the on_success function.
    */
   find: function EM_find(win, values, searchTimeout, all, on_success, on_error, command_id) {
     let startTime = values.time ? values.time : new Date().getTime();
     let startNode = (values.element != undefined) ?
                     this.getKnownElement(values.element, win) : win.document;
     if (this.elementStrategies.indexOf(values.using) < 0) {
-      throw new InvalidSelectorError(`No such strategy: ${values.using}`);
+      throw new InvalidSelectorError("No such strategy: " + values.using);
     }
     let found = all ? this.findElements(values.using, values.value, win.document, startNode) :
                       this.findElement(values.using, values.value, win.document, startNode);
     let type = Object.prototype.toString.call(found);
     let isArrayLike = ((type == '[object Array]') || (type == '[object HTMLCollection]') || (type == '[object NodeList]'));
     if (found == null || (isArrayLike && found.length <= 0)) {
       if (!searchTimeout || new Date().getTime() - startTime > searchTimeout) {
         if (all) {
@@ -586,17 +586,17 @@ ElementManager.prototype = {
           element = element[0];
         }
         break;
       case ANON_ATTRIBUTE:
         let attr = Object.keys(value)[0];
         element = rootNode.getAnonymousElementByAttribute(startNode, attr, value[attr]);
         break;
       default:
-        throw new WebDriverError("No such strategy");
+        throw new InvalidSelectorError("No such strategy: " + using);
     }
     return element;
   },
 
   /**
    * Helper method to find. Finds all element using find's criteria
    *
    * @param string using
@@ -653,13 +653,13 @@ ElementManager.prototype = {
       case ANON_ATTRIBUTE:
         let attr = Object.keys(value)[0];
         let el = rootNode.getAnonymousElementByAttribute(startNode, attr, value[attr]);
         if (el != null) {
           elements = [el];
         }
         break;
       default:
-        throw new WebDriverError("No such strategy");
+        throw new InvalidSelectorError("No such strategy: " + using);
     }
     return elements;
   },
 }