diff --git a/testing/marionette/driver.js b/testing/marionette/driver.js index 1029895cda29..8a044210de03 100644 --- a/testing/marionette/driver.js +++ b/testing/marionette/driver.js @@ -2171,12 +2171,12 @@ GeckoDriver.prototype.findElements = async function(cmd, resp) { * @throws {UnexpectedAlertOpenError} * A modal dialog is open, blocking this operation. */ -GeckoDriver.prototype.getActiveElement = async function(cmd, resp) { +GeckoDriver.prototype.getActiveElement = async function() { assert.content(this.context); assert.window(this.getCurrentWindow()); this._assertAndDismissModal(); - resp.body.value = await this.listener.getActiveElement(); + return this.listener.getActiveElement(); }; /** diff --git a/testing/marionette/server.js b/testing/marionette/server.js index 118748be8e5d..8a71c0fcd03e 100644 --- a/testing/marionette/server.js +++ b/testing/marionette/server.js @@ -18,6 +18,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("chrome://marionette/content/assert.js"); const {GeckoDriver} = Cu.import("chrome://marionette/content/driver.js", {}); +const {WebElement} = Cu.import("chrome://marionette/content/element.js", {}); const { error, UnknownCommandError, @@ -27,8 +28,7 @@ const { Message, Response, } = Cu.import("chrome://marionette/content/message.js", {}); -const {DebuggerTransport} = - Cu.import("chrome://marionette/content/transport.js", {}); +const {DebuggerTransport} = Cu.import("chrome://marionette/content/transport.js", {}); XPCOMUtils.defineLazyServiceGetter( this, "env", "@mozilla.org/process/environment;1", "nsIEnvironment"); @@ -560,7 +560,7 @@ server.TCPConnection = class { let rv = await fn.bind(this.driver)(cmd, resp); if (typeof rv != "undefined") { - if (typeof rv != "object") { + if (rv instanceof WebElement || typeof rv != "object") { resp.body = {value: rv}; } else { resp.body = rv;