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 801168 a34d767de6adf1810bbaba19f4024c83eee6e61d
parent 801167 c208092f50d11bb76a693015e57869fc26487ce4
child 801169 68a7c2019a9cce44478be5ccbf7469de84930295
push id111602
push userbmo:dburns@mozilla.com
push dateTue, 29 May 2018 22:11:56 +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
@@ -1322,17 +1322,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