From 179b8ccc6bae49ee22bfa882389b3ec231c19174 Mon Sep 17 00:00:00 2001 From: Andreas Tolfsen Date: Thu, 5 Oct 2017 17:55:52 +0100 Subject: [PATCH] Bug 1400256 - Recognise web element references in evaluate.toJSON. r=whimboo MozReview-Commit-ID: BvKHGzsF0ie --HG-- extra : rebase_source : f3e66b5173534193f357593e0d292199f4efe764 --- testing/marionette/evaluate.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/testing/marionette/evaluate.js b/testing/marionette/evaluate.js index 53ace02f55ba..dfba32d2c1b3 100644 --- a/testing/marionette/evaluate.js +++ b/testing/marionette/evaluate.js @@ -276,10 +276,14 @@ evaluate.toJSON = function(obj, seenEls) { } else if (element.isCollection(obj)) { return [...obj].map(el => evaluate.toJSON(el, seenEls)); + // WebElement + } else if (WebElement.isReference(obj)) { + return obj; + // Element, SVGElement, XULElement } else if (element.isElement(obj)) { - let uuid = seenEls.add(obj); - return element.makeWebElement(uuid); + let webEl = seenEls.add(obj); + return webEl.toJSON(); // custom JSON representation } else if (typeof obj.toJSON == "function") {