Bug 1385873 - Throw TypeError when passing XUL element to interaction.selectOption. r=automatedtester draft
authorAndreas Tolfsen <ato@sny.no>
Mon, 31 Jul 2017 14:06:07 +0100
changeset 618471 2e9ccc68221718f5bdb7e82774ad16417f953a76
parent 618470 aefe2f061329eda5233132b26f8eded492374d39
child 618472 ba1a146e2026bc3752386bc7af3eac1be4a71df5
push id71347
push userbmo:ato@sny.no
push dateMon, 31 Jul 2017 14:56:01 +0000
reviewersautomatedtester
bugs1385873
milestone56.0a1
Bug 1385873 - Throw TypeError when passing XUL element to interaction.selectOption. r=automatedtester Marionette throws a TypeError when the element is not an <option>, and we should use the same error type when a XUL element is passed. MozReview-Commit-ID: 3p3wPcW621f
testing/marionette/interaction.js
--- a/testing/marionette/interaction.js
+++ b/testing/marionette/interaction.js
@@ -277,17 +277,17 @@ function* seleniumClickElement(el, a11y)
  *     If <var>el</var> is a XUL element or not an <tt>&lt;option&gt;</tt>
  *     element.
  * @throws {Error}
  *     If unable to find <var>el</var>'s parent <tt>&lt;select&gt;</tt>
  *     element.
  */
 interaction.selectOption = function(el) {
   if (element.isXULElement(el)) {
-    throw new Error("XUL dropdowns not supported");
+    throw new TypeError("XUL dropdowns not supported");
   }
   if (el.localName != "option") {
     throw new TypeError(pprint`Expected <option> element, got ${el}`);
   }
 
   let containerEl = element.getContainer(el);
 
   event.mouseover(containerEl);