Bug 1387678 - Check if element is passed in is actually an element; r?ato draft
authorDavid Burns <dburns@mozilla.com>
Wed, 09 May 2018 09:19:28 +0100
changeset 798698 d27b61a12cc507a5309e8d65b131452072c44471
parent 798697 3232cba6214275ec5e8fe602e357e36c62b54c80
child 798699 b2112fdcebeb9d4e555171900c9eeb559a52af03
push id110828
push userbmo:dburns@mozilla.com
push dateWed, 23 May 2018 10:39:43 +0000
reviewersato
bugs1387678
milestone62.0a1
Bug 1387678 - Check if element is passed in is actually an element; r?ato When we traverse up a shadow DOM we pass in null as an indicator to move upwards. We now check that it is really an element and if not assume that it is null and move up the tree MozReview-Commit-ID: AK9eOLFDAgB
testing/marionette/listener.js
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -1326,17 +1326,17 @@ async function sendKeysToElement(el, val
 
 /** Clear the text of an element. */
 function clearElement(el) {
   interaction.clearElement(el);
 }
 
 /** Switch the current context to the specified host's Shadow DOM. */
 function switchToShadowRoot(el) {
-  if (!el) {
+  if (!element.isElement(el)) {
     // If no host element is passed, attempt to find a parent shadow
     // root or, if none found, unset the current shadow root
     if (curContainer.shadowRoot) {
       let parent;
       try {
         parent = curContainer.shadowRoot.host;
       } catch (e) {
         // There is a chance that host element is dead and we are trying to