Bug 1282331 - Refactor GetActiveFrame to return WebElement r=automatedtester
authorNelson J Morais <njmorais@gmail.com>
Tue, 12 Jul 2016 22:56:34 +0100
changeset 330467 57fe98edfc3de29eb4a1336e5fd23073839d9667
parent 330466 4879682a027dfc7e77c66b6e81be9e73f0fa8e97
child 330468 102f746a6474f266c6ac3762c03d2f0d4ff32479
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1282331
milestone50.0a1
Bug 1282331 - Refactor GetActiveFrame to return WebElement r=automatedtester MozReview-Commit-ID: 6LiBOXSEPtz
testing/marionette/client/marionette_driver/marionette.py
testing/marionette/driver.js
--- a/testing/marionette/client/marionette_driver/marionette.py
+++ b/testing/marionette/client/marionette_driver/marionette.py
@@ -1305,20 +1305,17 @@ class Marionette(object):
         :param window_id: The id or name of the window to switch to.
         """
         self._send_message("switchToWindow", {"name": window_id})
         self.window = window_id
 
     def get_active_frame(self):
         """Returns an HTMLElement representing the frame Marionette is
         currently acting on."""
-        element = self._send_message("getActiveFrame", key="value")
-        if element:
-            return HTMLElement(self, element)
-        return None
+        return self._send_message("getActiveFrame", key="value")
 
     def switch_to_default_content(self):
         """Switch the current context to page's default content."""
         return self.switch_to_frame()
 
     def switch_to_parent_frame(self):
         """
            Switch to the Parent Frame
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -1350,23 +1350,29 @@ GeckoDriver.prototype.switchToWindow = f
 };
 
 GeckoDriver.prototype.getActiveFrame = function(cmd, resp) {
   switch (this.context) {
     case Context.CHROME:
       // no frame means top-level
       resp.body.value = null;
       if (this.curFrame) {
-        resp.body.value = this.curBrowser.seenEls
+        let elRef = this.curBrowser.seenEls
             .add(this.curFrame.frameElement);
+        let el = element.makeWebElement(elRef);
+        resp.body.value = el;
       }
       break;
 
     case Context.CONTENT:
-      resp.body.value = this.currentFrameElement;
+      resp.body.value = null;
+      if (this.currentFrameElement !== null) {
+        let el = element.makeWebElement(this.currentFrameElement);
+        resp.body.value = el;
+      }
       break;
   }
 };
 
 GeckoDriver.prototype.switchToParentFrame = function*(cmd, resp) {
   let res = yield this.listener.switchToParentFrame();
 };