Bug 1282331 - Refactor GetActiveFrame to return WebElement draft
authorNelson J Morais <njmorais@gmail.com>
Tue, 12 Jul 2016 22:56:34 +0100
changeset 387849 c9d3bd0ed2aa90019efe878c7d9a2660e040de10
parent 386010 679118259e91f40d4a8f968f03ec4cff066cdb5b
child 525463 a787cc2fbd66c1038128150a7b3d3ae88250d59f
push id23084
push userbmo:njmorais@gmail.com
push dateThu, 14 Jul 2016 22:11:58 +0000
bugs1282331
milestone50.0a1
Bug 1282331 - Refactor GetActiveFrame to return WebElement 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();
 };