Bug 1271596 - Remove unused emulator command functions; r?automatedtester draft
authorAndreas Tolfsen <ato@mozilla.com>
Tue, 10 May 2016 11:50:57 +0100
changeset 365274 a73add99ceb556f9fa1d9bfcdb55171aa99b6d23
parent 365273 1579b9e2e50f3a27ad02d58cc9170c91e0973fec
child 520500 6fbe06eb71b1f858632d671b73f7a4aa87a6a013
push id17682
push userbmo:ato@mozilla.com
push dateTue, 10 May 2016 10:58:36 +0000
reviewersautomatedtester
bugs1271596, 1123506
milestone49.0a1
Bug 1271596 - Remove unused emulator command functions; r?automatedtester Bug 1123506 rewrote all the emulator handling in the listener, and a few of the emulator related functions in testing/marionette/listener.js are no longer needed. MozReview-Commit-ID: 1iTjuZwcOJf
testing/marionette/listener.js
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -273,17 +273,16 @@ function startListeners() {
   addMessageListenerId("Marionette:isElementSelected", isElementSelectedFn);
   addMessageListenerId("Marionette:sendKeysToElement", sendKeysToElement);
   addMessageListenerId("Marionette:clearElement", clearElementFn);
   addMessageListenerId("Marionette:switchToFrame", switchToFrame);
   addMessageListenerId("Marionette:switchToParentFrame", switchToParentFrame);
   addMessageListenerId("Marionette:switchToShadowRoot", switchToShadowRootFn);
   addMessageListenerId("Marionette:deleteSession", deleteSession);
   addMessageListenerId("Marionette:sleepSession", sleepSession);
-  addMessageListenerId("Marionette:emulatorCmdResult", emulatorCmdResult);
   addMessageListenerId("Marionette:getAppCacheStatus", getAppCacheStatus);
   addMessageListenerId("Marionette:setTestName", setTestName);
   addMessageListenerId("Marionette:takeScreenshot", takeScreenshotFn);
   addMessageListenerId("Marionette:getScreenshotHash", getScreenshotHashFn);
   addMessageListenerId("Marionette:addCookie", addCookieFn);
   addMessageListenerId("Marionette:getCookies", getCookiesFn);
   addMessageListenerId("Marionette:deleteAllCookies", deleteAllCookiesFn);
   addMessageListenerId("Marionette:deleteCookie", deleteCookieFn);
@@ -378,17 +377,16 @@ function deleteSession(msg) {
   removeMessageListenerId("Marionette:isElementSelected", isElementSelectedFn);
   removeMessageListenerId("Marionette:sendKeysToElement", sendKeysToElement);
   removeMessageListenerId("Marionette:clearElement", clearElementFn);
   removeMessageListenerId("Marionette:switchToFrame", switchToFrame);
   removeMessageListenerId("Marionette:switchToParentFrame", switchToParentFrame);
   removeMessageListenerId("Marionette:switchToShadowRoot", switchToShadowRootFn);
   removeMessageListenerId("Marionette:deleteSession", deleteSession);
   removeMessageListenerId("Marionette:sleepSession", sleepSession);
-  removeMessageListenerId("Marionette:emulatorCmdResult", emulatorCmdResult);
   removeMessageListenerId("Marionette:getAppCacheStatus", getAppCacheStatus);
   removeMessageListenerId("Marionette:setTestName", setTestName);
   removeMessageListenerId("Marionette:takeScreenshot", takeScreenshotFn);
   removeMessageListenerId("Marionette:getScreenshotHash", getScreenshotHashFn);
   removeMessageListenerId("Marionette:addCookie", addCookieFn);
   removeMessageListenerId("Marionette:getCookies", getCookiesFn);
   removeMessageListenerId("Marionette:deleteAllCookies", deleteAllCookiesFn);
   removeMessageListenerId("Marionette:deleteCookie", deleteCookieFn);
@@ -1465,64 +1463,16 @@ function deleteAllCookies() {
   }
 }
 
 function getAppCacheStatus(msg) {
   sendResponse(
       curContainer.frame.applicationCache.status, msg.json.command_id);
 }
 
-// emulator callbacks
-var _emu_cb_id = 0;
-var _emu_cbs = {};
-
-function runEmulatorCmd(cmd, callback) {
-  if (callback) {
-    _emu_cbs[_emu_cb_id] = callback;
-  }
-  sendAsyncMessage("Marionette:runEmulatorCmd",
-      {command: cmd, id: _emu_cb_id});
-  _emu_cb_id += 1;
-}
-
-function runEmulatorShell(args, callback) {
-  if (callback) {
-    _emu_cbs[_emu_cb_id] = callback;
-  }
-  sendAsyncMessage("Marionette:runEmulatorShell",
-      {arguments: args, id: _emu_cb_id});
-  _emu_cb_id += 1;
-}
-
-function emulatorCmdResult(msg) {
-  let {error, result, id} = msg.json;
-
-  if (error) {
-    let err = new JavaScriptError(error);
-    sendError(err, id);
-    return;
-  }
-
-  if (!sandboxes[sandboxName]) {
-    return;
-  }
-  let cb = _emu_cbs[id];
-  delete _emu_cbs[id];
-  if (!cb) {
-    return;
-  }
-
-  try {
-    cb(result);
-  } catch (e) {
-    let err = new JavaScriptError(e);
-    sendError(err, id);
-  }
-}
-
 /**
  * Perform a screen capture in content context.
  *
  * @param {UUID=} id
  *     Optional web element reference of an element to take a screenshot
  *     of.
  * @param {boolean=} full
  *     True to take a screenshot of the entire document element.  Is not