Bug 1111264 - Simplify check for disabled in isElementEnabled. r=dburns
authorAndreas Tolfsen <ato@mozilla.com>
Sat, 13 Dec 2014 20:44:42 +0000
changeset 220200 25af7d428a320ec8287ab56e78ac0ec7c634e221
parent 220199 13d74279980e41a51ffa0a4d25e0b55e0a4dcc46
child 220201 dd8d4b26a2a6de63fed42f5667de460888168abf
push id10457
push userryanvm@gmail.com
push dateThu, 18 Dec 2014 01:54:25 +0000
treeherderfx-team@0e441ff66c5e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdburns
bugs1111264
milestone37.0a1
Bug 1111264 - Simplify check for disabled in isElementEnabled. r=dburns
testing/marionette/marionette-server.js
--- a/testing/marionette/marionette-server.js
+++ b/testing/marionette/marionette-server.js
@@ -2092,38 +2092,30 @@ MarionetteServerConnection.prototype = {
 
   /**
    * Check if element is enabled
    *
    * @param object aRequest
    *        'id' member holds the reference id to
    *        the element that will be checked
    */
-  isElementEnabled: function MDA_isElementEnabled(aRequest) {
+  isElementEnabled: function(aRequest) {
     let command_id = this.command_id = this.getCommandId();
+    let id = aRequest.parameters.id;
     if (this.context == "chrome") {
       try {
-        //Selenium atom doesn't quite work here
-        let el = this.curBrowser.elementManager.getKnownElement(
-            aRequest.parameters.id, this.getCurrentWindow());
-        if (el.disabled != undefined) {
-          this.sendResponse(!!!el.disabled, command_id);
-        }
-        else {
-        this.sendResponse(true, command_id);
-        }
-      }
-      catch (e) {
+        // Selenium atom doesn't quite work here
+        let win = this.getCurrentWindow();
+        let el = this.curBrowser.elementManager.getKnownElement(id, win);
+        this.sendResponse(!!!el.disabled, command_id);
+      } catch (e) {
         this.sendError(e.message, e.code, e.stack, command_id);
       }
-    }
-    else {
-      this.sendAsync("isElementEnabled",
-                     { id:aRequest.parameters.id },
-                     command_id);
+    } else {
+      this.sendAsync("isElementEnabled", {id: id}, command_id);
     }
   },
 
   /**
    * Check if element is selected
    *
    * @param object aRequest
    *        'id' member holds the reference id to