Bug 1274274 - Rename element manager; r=automatedtester
authorAndreas Tolfsen <ato@mozilla.com>
Fri, 20 May 2016 16:49:19 +0100
changeset 337937 dc85479726f9a1ad5cfbbc873b0168bedbd839f6
parent 337936 dd338221d47080318113d6a908ac7651d11b5ce3
child 337938 74c4d72ac0dee69aea077a1615d50cf70b84ec21
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1274274
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1274274 - Rename element manager; r=automatedtester Renames instances of `elementManager' to `seenEls' for brevity. Also the word "manager" does not really explain what purpose it fulfills. MozReview-Commit-ID: 4EUN9utPoZS
testing/marionette/action.js
testing/marionette/browser.js
testing/marionette/driver.js
testing/marionette/listener.js
--- a/testing/marionette/action.js
+++ b/testing/marionette/action.js
@@ -44,28 +44,28 @@ action.Chain = function(checkForInterrup
   // determines if we create touch events
   this.inputSource = null;
 };
 
 action.Chain.prototype.dispatchActions = function(
     args,
     touchId,
     container,
-    elementManager,
+    seenEls,
     touchProvider) {
   // Some touch events code in the listener needs to do ipc, so we can't
   // share this code across chrome/content.
   if (touchProvider) {
     this.touchProvider = touchProvider;
   }
 
-  this.elementManager = elementManager;
+  this.seenEls = seenEls;
   this.container = container;
   let commandArray = element.fromJson(
-      args, elementManager, container.frame, container.shadowRoot);
+      args, seenEls, container.frame, container.shadowRoot);
 
   if (touchId == null) {
     touchId = this.nextTouchId++;
   }
 
   if (!container.frame.document.createTouch) {
     this.mouseEventsOnly = true;
   }
@@ -137,17 +137,17 @@ action.Chain.prototype.emitMouseEvent = 
   }
 };
 
 /**
  * Reset any persisted values after a command completes.
  */
 action.Chain.prototype.resetValues = function() {
   this.container = null;
-  this.elementManager = null;
+  this.seenEls = null;
   this.touchProvider = null;
   this.mouseEventsOnly = false;
 };
 
 /**
  * Emit events for each action in the provided chain.
  *
  * To emit touch events for each finger, one might send a [["press", id],
@@ -195,17 +195,17 @@ action.Chain.prototype.actions = functio
       break;
 
     case "keyUp":
       event.sendKeyUp(pack[1], keyModifiers, this.container.frame);
       this.actions(chain, touchId, i, keyModifiers, cb);
       break;
 
     case "click":
-      el = this.elementManager.get(pack[1], this.container);
+      el = this.seenEls.get(pack[1], this.container);
       let button = pack[2];
       let clickCount = pack[3];
       c = element.coordinates(el);
       this.mouseTap(el.ownerDocument, c.x, c.y, button, clickCount, keyModifiers);
       if (button == 2) {
         this.emitMouseEvent(el.ownerDocument, "contextmenu", c.x, c.y,
             button, clickCount, keyModifiers);
       }
@@ -226,17 +226,17 @@ action.Chain.prototype.actions = functio
             "Invalid Command: press cannot follow an active touch event");
       }
 
       // look ahead to check if we're scrolling,
       // needed for APZ touch dispatching
       if ((i != chain.length) && (chain[i][0].indexOf('move') !== -1)) {
         this.scrolling = true;
       }
-      el = this.elementManager.get(pack[1], this.container);
+      el = this.seenEls.get(pack[1], this.container);
       c = element.coordinates(el, pack[2], pack[3]);
       touchId = this.generateEvents("press", c.x, c.y, null, el, keyModifiers);
       this.actions(chain, touchId, i, keyModifiers, cb);
       break;
 
     case "release":
       this.generateEvents(
           "release",
@@ -245,17 +245,17 @@ action.Chain.prototype.actions = functio
           touchId,
           null,
           keyModifiers);
       this.actions(chain, null, i, keyModifiers, cb);
       this.scrolling =  false;
       break;
 
     case "move":
-      el = this.elementManager.get(pack[1], this.container);
+      el = this.seenEls.get(pack[1], this.container);
       c = element.coordinates(el);
       this.generateEvents("move", c.x, c.y, touchId, null, keyModifiers);
       this.actions(chain, touchId, i, keyModifiers, cb);
       break;
 
     case "moveByOffset":
       this.generateEvents(
           "move",
--- a/testing/marionette/browser.js
+++ b/testing/marionette/browser.js
@@ -37,17 +37,17 @@ browser.Context = class {
     this.window = win;
     this.driver = driver;
     this.knownFrames = [];
     this.startPage = "about:blank";
     // used in B2G to identify the homescreen content page
     this.mainContentId = null;
     // used to set curFrameId upon new session
     this.newSession = true;
-    this.elementManager = new element.Store();
+    this.seenEls = new element.Store();
     this.setBrowser(win);
 
     // A reference to the tab corresponding to the current window handle, if any.
     this.tab = null;
     this.pendingCommands = [];
 
     // we should have one FM per BO so that we can handle modals in each Browser
     this.frameManager = new frame.Manager(driver);
--- a/testing/marionette/driver.js
+++ b/testing/marionette/driver.js
@@ -874,19 +874,19 @@ GeckoDriver.prototype.execute_ = functio
       let sb = this.sandboxes.get(opts.sandboxName, opts.newSandbox);
       if (opts.sandboxName) {
         sb = sandbox.augment(sb, new logging.Adapter(this.marionetteLog));
         sb = sandbox.augment(sb, {global: sb});
       }
 
       opts.timeout = timeout;
       script = this.importedScripts.for(Context.CHROME).concat(script);
-      let wargs = element.fromJson(args, this.curBrowser.elementManager, sb.window);
+      let wargs = element.fromJson(args, this.curBrowser.seenEls, sb.window);
       let evaluatePromise = evaluate.sandbox(sb, script, wargs, opts);
-      return evaluatePromise.then(res => element.toJson(res, this.curBrowser.elementManager));
+      return evaluatePromise.then(res => element.toJson(res, this.curBrowser.seenEls));
   }
 };
 
 /**
  * Execute pure JavaScript.  Used to execute simpletest harness tests,
  * which are like mochitests only injected using Marionette.
  *
  * Scripts are expected to call the {@code finish} global when done.
@@ -899,31 +899,31 @@ GeckoDriver.prototype.executeJSScript = 
     filename: cmd.parameters.filename,
     line: cmd.parameters.line,
     async: cmd.parameters.async,
   };
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
-      let wargs = element.fromJson(args, this.curBrowser.elementManager, win);
+      let wargs = element.fromJson(args, this.curBrowser.seenEls, win);
       let harness = new simpletest.Harness(
           win,
           Context.CHROME,
           this.marionetteLog,
           scriptTimeout,
           function() {},
           this.testName);
 
       let sb = sandbox.createSimpleTest(win, harness);
       // TODO(ato): Not sure this is needed:
       sb = sandbox.augment(sb, new logging.Adapter(this.marionetteLog));
 
       let res = yield evaluate.sandbox(sb, script, wargs, opts);
-      resp.body.value = element.toJson(res, this.curBrowser.elementManager);
+      resp.body.value = element.toJson(res, this.curBrowser.seenEls);
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.executeSimpleTest(script, args, scriptTimeout, opts);
       break;
   }
 };
 
@@ -1350,17 +1350,17 @@ 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.elementManager
+        resp.body.value = this.curBrowser.seenEls
             .add(this.curFrame.frameElement);
       }
       break;
 
     case Context.CONTENT:
       resp.body.value = this.currentFrameElement;
       break;
   }
@@ -1409,17 +1409,17 @@ GeckoDriver.prototype.switchToFrame = fu
       }
       checkTimer.initWithCallback(checkLoad.bind(this), 100, Ci.nsITimer.TYPE_ONE_SHOT);
       return;
     }
 
     // by element
     if (this.curBrowser.seenEls.has(element)) {
       // HTMLIFrameElement
-      let wantedFrame = this.curBrowser.elementManager.get(element, {frame: curWindow});
+      let wantedFrame = this.curBrowser.seenEls.get(element, {frame: curWindow});
       // Deal with an embedded xul:browser case
       if (wantedFrame.tagName == "xul:browser" || wantedFrame.tagName == "browser") {
         curWindow = wantedFrame.contentWindow;
         this.curFrame = curWindow;
         if (focus) {
           this.curFrame.focus();
         }
         checkTimer.initWithCallback(checkLoad.bind(this), 100, Ci.nsITimer.TYPE_ONE_SHOT);
@@ -1608,19 +1608,18 @@ GeckoDriver.prototype.actionChain = func
       if (this.appName != "Firefox") {
         // be conservative until this has a use case and is established
         // to work as expected on b2g/fennec
         throw new WebDriverError(
             "Command 'actionChain' is not available in chrome context");
       }
 
       let win = this.getCurrentWindow();
-      let elm = this.curBrowser.elementManager;
       resp.body.value = yield this.actions.dispatchActions(
-          chain, nextId, {frame: win}, elm);
+          chain, nextId, {frame: win}, this.curBrowser.seenEls);
       break;
 
     case Context.CONTENT:
       this.addFrameCloseListener("action chain");
       resp.body.value = yield this.listener.actionChain(chain, nextId);
       break;
   }
 };
@@ -1665,20 +1664,20 @@ GeckoDriver.prototype.findElement = func
   switch (this.context) {
     case Context.CHROME:
       if (!SUPPORTED_STRATEGIES.has(strategy)) {
         throw new InvalidSelectorError(`Strategy not supported: ${strategy}`);
       }
 
       let container = {frame: this.getCurrentWindow()};
       if (opts.startNode) {
-        opts.startNode = this.curBrowser.elementManager.get(opts.startNode, container);
+        opts.startNode = this.curBrowser.seenEls.get(opts.startNode, container);
       }
       let el = yield element.find(container, strategy, expr, opts);
-      let elRef = this.curBrowser.elementManager.add(el);
+      let elRef = this.curBrowser.seenEls.add(el);
       let webEl = element.makeWebElement(elRef);
 
       resp.body.value = webEl;
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.findElementContent(
           strategy,
@@ -1708,21 +1707,21 @@ GeckoDriver.prototype.findElements = fun
   switch (this.context) {
     case Context.CHROME:
       if (!SUPPORTED_STRATEGIES.has(strategy)) {
         throw new InvalidSelectorError(`Strategy not supported: ${strategy}`);
       }
 
       let container = {frame: this.getCurrentWindow()};
       if (opts.startNode) {
-        opts.startNode = this.curBrowser.elementManager.get(opts.startNode, container);
+        opts.startNode = this.curBrowser.seenEls.get(opts.startNode, container);
       }
       let els = yield element.find(container, strategy, expr, opts);
 
-      let elRefs = this.curBrowser.elementManager.addAll(els);
+      let elRefs = this.curBrowser.seenEls.addAll(els);
       let webEls = elRefs.map(element.makeWebElement);
       resp.body = webEls;
       break;
 
     case Context.CONTENT:
       resp.body = yield this.listener.findElementsContent(
           cmd.parameters.using,
           cmd.parameters.value,
@@ -1743,17 +1742,17 @@ GeckoDriver.prototype.getActiveElement =
  *     Reference ID to the element that will be clicked.
  */
 GeckoDriver.prototype.clickElement = function*(cmd, resp) {
   let id = cmd.parameters.id;
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       yield interaction.clickElement(
           el, this.sessionCapabilities.raisesAccessibilityExceptions);
       break;
 
     case Context.CONTENT:
       // We need to protect against the click causing an OOP frame to close.
       // This fires the mozbrowserclose event when it closes so we need to
       // listen for it and then just send an error back. The person making the
@@ -1776,17 +1775,17 @@ GeckoDriver.prototype.clickElement = fun
  *     Value of the attribute.
  */
 GeckoDriver.prototype.getElementAttribute = function*(cmd, resp) {
   let {id, name} = cmd.parameters;
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       resp.body.value = atom.getElementAttribute(el, name, this.getCurrentWindow());
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.getElementAttribute(id, name);
       break;
   }
 };
@@ -1823,17 +1822,17 @@ GeckoDriver.prototype.getElementProperty
  */
 GeckoDriver.prototype.getElementText = function*(cmd, resp) {
   let id = cmd.parameters.id;
 
   switch (this.context) {
     case Context.CHROME:
       // for chrome, we look at text nodes, and any node with a "label" field
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       let lines = [];
       this.getVisibleText(el, lines);
       resp.body.value = lines.join("\n");
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.getElementText(id);
       break;
@@ -1847,17 +1846,17 @@ GeckoDriver.prototype.getElementText = f
  *     Reference ID to the element that will be inspected.
  */
 GeckoDriver.prototype.getElementTagName = function*(cmd, resp) {
   let id = cmd.parameters.id;
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       resp.body.value = el.tagName.toLowerCase();
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.getElementTagName(id);
       break;
   }
 };
@@ -1869,17 +1868,17 @@ GeckoDriver.prototype.getElementTagName 
  *     Reference ID to the element that will be inspected.
  */
 GeckoDriver.prototype.isElementDisplayed = function*(cmd, resp) {
   let id = cmd.parameters.id;
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       resp.body.value = yield interaction.isElementDisplayed(
           el, this.sessionCapabilities.raisesAccessibilityExceptions);
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.isElementDisplayed(id);
       break;
   }
@@ -1894,17 +1893,17 @@ GeckoDriver.prototype.isElementDisplayed
  *     CSS rule that is being requested.
  */
 GeckoDriver.prototype.getElementValueOfCssProperty = function*(cmd, resp) {
   let {id, propertyName: prop} = cmd.parameters;
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       let sty = win.document.defaultView.getComputedStyle(el, null);
       resp.body.value = sty.getPropertyValue(prop);
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.getElementValueOfCssProperty(id, prop);
       break;
   }
@@ -1918,17 +1917,17 @@ GeckoDriver.prototype.getElementValueOfC
  */
 GeckoDriver.prototype.isElementEnabled = function*(cmd, resp) {
   let id = cmd.parameters.id;
 
   switch (this.context) {
     case Context.CHROME:
       // Selenium atom doesn't quite work here
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       resp.body.value = yield interaction.isElementEnabled(
           el, this.sessionCapabilities.raisesAccessibilityExceptions);
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.isElementEnabled(id);
       break;
   }
@@ -1942,34 +1941,34 @@ GeckoDriver.prototype.isElementEnabled =
  */
 GeckoDriver.prototype.isElementSelected = function*(cmd, resp) {
   let id = cmd.parameters.id;
 
   switch (this.context) {
     case Context.CHROME:
       // Selenium atom doesn't quite work here
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       resp.body.value = yield interaction.isElementSelected(
           el, this.sessionCapabilities.raisesAccessibilityExceptions);
       break;
 
     case Context.CONTENT:
       resp.body.value = yield this.listener.isElementSelected(id);
       break;
   }
 };
 
 GeckoDriver.prototype.getElementRect = function*(cmd, resp) {
   let id = cmd.parameters.id;
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       let rect = el.getBoundingClientRect();
       resp.body = {
         x: rect.x + win.pageXOffset,
         y: rect.y + win.pageYOffset,
         width: rect.width,
         height: rect.height
       };
       break;
@@ -1993,17 +1992,17 @@ GeckoDriver.prototype.sendKeysToElement 
 
   if (!value) {
     throw new InvalidArgumentError(`Expected character sequence: ${value}`);
   }
 
   switch (this.context) {
     case Context.CHROME:
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       yield interaction.sendKeysToElement(
           el, value, true, this.sessionCapabilities.raisesAccessibilityExceptions);
       break;
 
     case Context.CONTENT:
       let err;
       let listener = function(msg) {
         this.mm.removeMessageListener("Marionette:setElementValue", listener);
@@ -2053,17 +2052,17 @@ GeckoDriver.prototype.setTestName = func
  */
 GeckoDriver.prototype.clearElement = function*(cmd, resp) {
   let id = cmd.parameters.id;
 
   switch (this.context) {
     case Context.CHROME:
       // the selenium atom doesn't work here
       let win = this.getCurrentWindow();
-      let el = this.curBrowser.elementManager.get(id, {frame: win});
+      let el = this.curBrowser.seenEls.get(id, {frame: win});
       if (el.nodeName == "textbox") {
         el.value = "";
       } else if (el.nodeName == "checkbox") {
         el.checked = false;
       }
       break;
 
     case Context.CONTENT:
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -37,17 +37,17 @@ var isB2G = false;
 var marionetteTestName;
 var winUtil = content.QueryInterface(Ci.nsIInterfaceRequestor)
     .getInterface(Ci.nsIDOMWindowUtils);
 var listenerId = null; // unique ID of this listener
 var curContainer = { frame: content, shadowRoot: null };
 var isRemoteBrowser = () => curContainer.frame.contentWindow !== null;
 var previousContainer = null;
 
-var elementManager = new element.Store();
+var seenEls = new element.Store();
 var SUPPORTED_STRATEGIES = new Set([
   element.Strategy.ClassName,
   element.Strategy.Selector,
   element.Strategy.ID,
   element.Strategy.Name,
   element.Strategy.LinkText,
   element.Strategy.PartialLinkText,
   element.Strategy.TagName,
@@ -402,17 +402,17 @@ function deleteSession(msg) {
   removeMessageListenerId("Marionette:getScreenshotHash", getScreenshotHashFn);
   removeMessageListenerId("Marionette:addCookie", addCookieFn);
   removeMessageListenerId("Marionette:getCookies", getCookiesFn);
   removeMessageListenerId("Marionette:deleteAllCookies", deleteAllCookiesFn);
   removeMessageListenerId("Marionette:deleteCookie", deleteCookieFn);
   if (isB2G) {
     content.removeEventListener("mozbrowsershowmodalprompt", modalHandler, false);
   }
-  elementManager.reset();
+  seenEls.reset();
   // reset container frame to the top-most frame
   curContainer = { frame: content, shadowRoot: null };
   curContainer.frame.focus();
   actions.touchIds = {};
 }
 
 /**
  * Send asynchronous reply to chrome.
@@ -521,41 +521,41 @@ function checkForInterrupted() {
 }
 
 function* execute(script, args, timeout, opts) {
   opts.timeout = timeout;
   script = importedScripts.for("content").concat(script);
 
   let sb = sandbox.createMutable(curContainer.frame);
   let wargs = element.fromJson(
-      args, elementManager, curContainer.frame, curContainer.shadowRoot);
+      args, seenEls, curContainer.frame, curContainer.shadowRoot);
   let res = yield evaluate.sandbox(sb, script, wargs, opts);
 
-  return element.toJson(res, elementManager);
+  return element.toJson(res, seenEls);
 }
 
 function* executeInSandbox(script, args, timeout, opts) {
   opts.timeout = timeout;
   script = importedScripts.for("content").concat(script);
 
   let sb = sandboxes.get(opts.sandboxName, opts.newSandbox);
   if (opts.sandboxName) {
     sb = sandbox.augment(sb, {global: sb});
     sb = sandbox.augment(sb, new logging.Adapter(contentLog));
   }
 
   let wargs = element.fromJson(
-      args, elementManager, curContainer.frame, curContainer.shadowRoot);
+      args, seenEls, curContainer.frame, curContainer.shadowRoot);
   let evaluatePromise = evaluate.sandbox(sb, script, wargs, opts);
 
   let res = yield evaluatePromise;
   sendSyncMessage(
       "Marionette:shareData",
-      {log: element.toJson(contentLog.get(), elementManager)});
-  return element.toJson(res, elementManager);
+      {log: element.toJson(contentLog.get(), seenEls)});
+  return element.toJson(res, seenEls);
 }
 
 function* executeSimpleTest(script, args, timeout, opts) {
   opts.timeout = timeout;
   let win = curContainer.frame;
   script = importedScripts.for("content").concat(script);
 
   let harness = new simpletest.Harness(
@@ -564,24 +564,24 @@ function* executeSimpleTest(script, args
       contentLog,
       timeout,
       marionetteTestName);
   let sb = sandbox.createSimpleTest(curContainer.frame, harness);
   // TODO(ato): Not sure this is needed:
   sb = sandbox.augment(sb, new logging.Adapter(contentLog));
 
   let wargs = element.fromJson(
-      args, elementManager, curContainer.frame, curContainer.shadowRoot);
+      args, seenEls, curContainer.frame, curContainer.shadowRoot);
   let evaluatePromise = evaluate.sandbox(sb, script, wargs, opts);
 
   let res = yield evaluatePromise;
   sendSyncMessage(
       "Marionette:shareData",
-      {log: element.toJson(contentLog.get(), elementManager)});
-  return element.toJson(res, elementManager);
+      {log: element.toJson(contentLog.get(), seenEls)});
+  return element.toJson(res, seenEls);
 }
 
 /**
  * Sets the test name, used in logging messages.
  */
 function setTestName(msg) {
   marionetteTestName = msg.json.value;
   sendOk(msg.json.command_id);
@@ -635,29 +635,29 @@ function emitTouchEvent(type, touch) {
       }
     }
     // we get here if we're not in asyncPacZoomEnabled land, or if we're the main process
     /*
     Disabled per bug 888303
     contentLog.log(loggingInfo, "TRACE");
     sendSyncMessage(
         "Marionette:shareData",
-        {log: element.toJson(contentLog.get(), elementManager)});
+        {log: element.toJson(contentLog.get(), seenEls)});
     contentLog.clear();
     */
     let domWindowUtils = curContainer.frame.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
     domWindowUtils.sendTouchEvent(type, [touch.identifier], [touch.clientX], [touch.clientY], [touch.radiusX], [touch.radiusY], [touch.rotationAngle], [touch.force], 1, 0);
   }
 }
 
 /**
  * Function that perform a single tap
  */
 function singleTap(id, corx, cory) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   // after this block, the element will be scrolled into view
   let visible = element.isVisible(el, corx, cory);
   if (!visible) {
     throw new ElementNotVisibleError("Element is not currently visible and may not be manipulated");
   }
 
   let a11y = accessibility.get(capabilities.raisesAccessibilityExceptions);
   return a11y.getAccessible(el, true).then(acc => {
@@ -697,17 +697,17 @@ function actionChain(chain, touchId) {
   let touchProvider = {};
   touchProvider.createATouch = createATouch;
   touchProvider.emitTouchEvent = emitTouchEvent;
 
   return actions.dispatchActions(
       chain,
       touchId,
       curContainer,
-      elementManager,
+      seenEls,
       touchProvider);
 }
 
 /**
  * Function to emit touch events which allow multi touch on the screen
  * @param type represents the type of event, touch represents the current touch,touches are all pending touches
  */
 function emitMultiEvents(type, touch, touches) {
@@ -772,34 +772,34 @@ function setDispatch(batches, touches, b
   batchIndex++;
   for (let i = 0; i < batch.length; i++) {
     pack = batch[i];
     touchId = pack[0];
     command = pack[1];
 
     switch (command) {
       case "press":
-        el = elementManager.get(pack[2], curContainer);
+        el = seenEls.get(pack[2], curContainer);
         c = element.coordinates(el, pack[3], pack[4]);
         touch = createATouch(el, c.x, c.y, touchId);
         multiLast[touchId] = touch;
         touches.push(touch);
         emitMultiEvents("touchstart", touch, touches);
         break;
 
       case "release":
         touch = multiLast[touchId];
         // the index of the previous touch for the finger may change in the touches array
         touchIndex = touches.indexOf(touch);
         touches.splice(touchIndex, 1);
         emitMultiEvents("touchend", touch, touches);
         break;
 
       case "move":
-        el = elementManager.get(pack[2], curContainer);
+        el = seenEls.get(pack[2], curContainer);
         c = element.coordinates(el);
         touch = createATouch(multiLast[touchId].target, c.x, c.y, touchId);
         touchIndex = touches.indexOf(lastTouch);
         touches[touchIndex] = touch;
         multiLast[touchId] = touch;
         emitMultiEvents("touchmove", touch, touches);
         break;
 
@@ -846,17 +846,17 @@ function setDispatch(batches, touches, b
  * Start multi-action.
  *
  * @param {Number} maxLen
  *     Longest action chain for one finger.
  */
 function multiAction(args, maxLen) {
   // unwrap the original nested array
   let commandArray = element.fromJson(
-      args, elementManager, curContainer.frame, curContainer.shadowRoot);
+      args, seenEls, curContainer.frame, curContainer.shadowRoot);
   let concurrentEvent = [];
   let temp;
   for (let i = 0; i < maxLen; i++) {
     let row = [];
     for (let j = 0; j < commandArray.length; j++) {
       if (typeof commandArray[j][i] != "undefined") {
         // add finger id to the front of each action, i.e. [finger_id, action, element]
         temp = commandArray[j][i];
@@ -1032,128 +1032,128 @@ function refresh(msg) {
  */
 function* findElementContent(strategy, selector, opts = {}) {
   if (!SUPPORTED_STRATEGIES.has(strategy)) {
     throw new InvalidSelectorError("Strategy not supported: " + strategy);
   }
 
   opts.all = false;
   if (opts.startNode) {
-    opts.startNode = elementManager.get(opts.startNode, curContainer);
+    opts.startNode = seenEls.get(opts.startNode, curContainer);
   }
 
   let el = yield element.find(curContainer, strategy, selector, opts);
-  let elRef = elementManager.add(el);
+  let elRef = seenEls.add(el);
   let webEl = element.makeWebElement(elRef);
   return webEl;
 }
 
 /**
  * Find elements in the current browsing context's document using the
  * given search strategy.
  */
 function* findElementsContent(strategy, selector, opts = {}) {
   if (!SUPPORTED_STRATEGIES.has(strategy)) {
     throw new InvalidSelectorError("Strategy not supported: " + strategy);
   }
 
   opts.all = true;
   if (opts.startNode) {
-    opts.startNode = elementManager.get(opts.startNode, curContainer);
+    opts.startNode = seenEls.get(opts.startNode, curContainer);
   }
 
   let els = yield element.find(curContainer, strategy, selector, opts);
-  let elRefs = elementManager.addAll(els);
+  let elRefs = seenEls.addAll(els);
   let webEls = elRefs.map(element.makeWebElement);
   return webEls;
 }
 
 /**
  * Find and return the active element on the page.
  *
  * @return {WebElement}
  *     Reference to web element.
  */
 function getActiveElement() {
   let el = curContainer.frame.document.activeElement;
-  let elRef = elementManager.add(el);
+  let elRef = seenEls.add(el);
   // TODO(ato): This incorrectly returns
   // the element's associated UUID as a string
   // instead of a web element.
   return elRef;
 }
 
 /**
  * Send click event to element.
  *
  * @param {WebElement} id
  *     Reference to the web element to click.
  */
 function clickElement(id) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   return interaction.clickElement(
       el,
       !!capabilities.raisesAccessibilityExceptions,
       capabilities.specificationLevel >= 1);
 }
 
 function getElementAttribute(id, name) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   if (element.isBooleanAttribute(el, name)) {
     if (el.hasAttribute(name)) {
       return "true";
     } else {
       return null;
     }
   } else {
     return el.getAttribute(name);
   }
 }
 
 function getElementProperty(id, name) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   return el[name];
 }
 
 /**
  * Get the text of this element. This includes text from child elements.
  *
  * @param {WebElement} id
  *     Reference to web element.
  *
  * @return {string}
  *     Text of element.
  */
 function getElementText(id) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   return atom.getElementText(el, curContainer.frame);
 }
 
 /**
  * Get the tag name of an element.
  *
  * @param {WebElement} id
  *     Reference to web element.
  *
  * @return {string}
  *     Tag name of element.
  */
 function getElementTagName(id) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   return el.tagName.toLowerCase();
 }
 
 /**
  * Determine the element displayedness of the given web element.
  *
  * Also performs additional accessibility checks if enabled by session
  * capability.
  */
 function isElementDisplayed(id) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   return interaction.isElementDisplayed(
       el, capabilities.raisesAccessibilityExceptions);
 }
 
 /**
  * Retrieves the computed value of the given CSS property of the given
  * web element.
  *
@@ -1161,32 +1161,32 @@ function isElementDisplayed(id) {
  *     Web element reference.
  * @param {String} prop
  *     The CSS property to get.
  *
  * @return {String}
  *     Effective value of the requested CSS property.
  */
 function getElementValueOfCssProperty(id, prop) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   let st = curContainer.frame.document.defaultView.getComputedStyle(el, null);
   return st.getPropertyValue(prop);
 }
 
 /**
  * Get the position and dimensions of the element.
  *
  * @param {WebElement} id
  *     Reference to web element.
  *
  * @return {Object.<string, number>}
  *     The x, y, width, and height properties of the element.
  */
 function getElementRect(id) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   let clientRect = el.getBoundingClientRect();
   return {
     x: clientRect.x + curContainer.frame.pageXOffset,
     y: clientRect.y  + curContainer.frame.pageYOffset,
     width: clientRect.width,
     height: clientRect.height
   };
 }
@@ -1196,41 +1196,41 @@ function getElementRect(id) {
  *
  * @param {WebElement} id
  *     Reference to web element.
  *
  * @return {boolean}
  *     True if enabled, false otherwise.
  */
 function isElementEnabled(id) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   return interaction.isElementEnabled(
       el, capabilities.raisesAccessibilityExceptions);
 }
 
 /**
  * Determines if the referenced element is selected or not.
  *
  * This operation only makes sense on input elements of the Checkbox-
  * and Radio Button states, or option elements.
  */
 function isElementSelected(id) {
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
   return interaction.isElementSelected(
       el, capabilities.raisesAccessibilityExceptions);
 }
 
 /**
  * Send keys to element
  */
 function sendKeysToElement(msg) {
   let command_id = msg.json.command_id;
   let val = msg.json.value;
   let id = msg.json.id;
-  let el = elementManager.get(id, curContainer);
+  let el = seenEls.get(id, curContainer);
 
   if (el.type == "file") {
     let p = val.join("");
         fileInputElement = el;
         // In e10s, we can only construct File objects in the parent process,
         // so pass the filename to driver.js, which in turn passes them back
         // to this frame script in receiveFiles.
         sendSyncMessage("Marionette:getFiles",
@@ -1243,17 +1243,17 @@ function sendKeysToElement(msg) {
   }
 }
 
 /**
  * Clear the text of an element.
  */
 function clearElement(id) {
   try {
-    let el = elementManager.get(id, curContainer);
+    let el = seenEls.get(id, curContainer);
     if (el.type == "file") {
       el.value = null;
     } else {
       atom.clearElement(el, curContainer.frame);
     }
   } catch (e) {
     // Bug 964738: Newer atoms contain status codes which makes wrapping
     // this in an error prototype that has a status property unnecessary
@@ -1288,34 +1288,35 @@ function switchToShadowRoot(id) {
         parent = parent.parentNode;
       }
       curContainer.shadowRoot = parent;
     }
     return;
   }
 
   let foundShadowRoot;
-  let hostEl = elementManager.get(id, curContainer);
+  let hostEl = seenEls.get(id, curContainer);
   foundShadowRoot = hostEl.shadowRoot;
   if (!foundShadowRoot) {
     throw new NoSuchElementError('Unable to locate shadow root: ' + id);
   }
   curContainer.shadowRoot = foundShadowRoot;
 }
 
 /**
  * Switch to the parent frame of the current Frame. If the frame is the top most
  * is the current frame then no action will happen.
  */
  function switchToParentFrame(msg) {
    let command_id = msg.json.command_id;
    curContainer.frame = curContainer.frame.parent;
-   let parentElement = elementManager.add(curContainer.frame);
+   let parentElement = seenEls.add(curContainer.frame);
 
-   sendSyncMessage("Marionette:switchedToFrame", { frameValue: parentElement });
+   sendSyncMessage(
+       "Marionette:switchedToFrame", {frameValue: parentElement});
 
    sendOk(msg.json.command_id);
  }
 
 /**
  * Switch to frame given either the server-assigned element id,
  * its index in window.frames, or the iframe's name or id.
  */
@@ -1360,20 +1361,20 @@ function switchToFrame(msg) {
       curContainer.frame.focus();
     }
 
     checkTimer.initWithCallback(checkLoad, 100, Ci.nsITimer.TYPE_ONE_SHOT);
     return;
   }
 
   let id = msg.json.element;
-  if (elementManager.has(id)) {
+  if (seenEls.has(id)) {
     let wantedFrame;
     try {
-      wantedFrame = elementManager.get(id, curContainer);
+      wantedFrame = seenEls.get(id, curContainer);
     } catch (e) {
       sendError(e, command_id);
     }
 
     if (frames.length > 0) {
       for (let i = 0; i < frames.length; i++) {
         // use XPCNativeWrapper to compare elements; see bug 834266
         if (XPCNativeWrapper(frames[i].frameElement) == XPCNativeWrapper(wantedFrame)) {
@@ -1398,17 +1399,17 @@ function switchToFrame(msg) {
   }
 
   if (foundFrame === null) {
     if (typeof(msg.json.id) === 'number') {
       try {
         foundFrame = frames[msg.json.id].frameElement;
         if (foundFrame !== null) {
           curContainer.frame = foundFrame;
-          foundFrame = elementManager.add(curContainer.frame);
+          foundFrame = seenEls.add(curContainer.frame);
         }
         else {
           // If foundFrame is null at this point then we have the top level browsing
           // context so should treat it accordingly.
           sendSyncMessage("Marionette:switchedToFrame", { frameValue: null});
           curContainer.frame = content;
           if(msg.json.focus == true) {
             curContainer.frame.focus();
@@ -1433,17 +1434,17 @@ function switchToFrame(msg) {
   if (foundFrame === null) {
     sendError(new NoSuchFrameError("Unable to locate frame: " + (msg.json.id || msg.json.element)), command_id);
     return true;
   }
 
   // send a synchronous message to let the server update the currently active
   // frame element (for getActiveFrame)
   let frameValue = element.toJson(
-      curContainer.frame.wrappedJSObject, elementManager)[element.Key];
+      curContainer.frame.wrappedJSObject, seenEls)[element.Key];
   sendSyncMessage("Marionette:switchedToFrame", {frameValue: frameValue});
 
   let rv = null;
   if (curContainer.frame.contentWindow === null) {
     // The frame we want to switch to is a remote/OOP frame;
     // notify our parent to handle the switch
     curContainer.frame = content;
     rv = {win: parWindow, frame: foundFrame};
@@ -1571,29 +1572,29 @@ function getScreenshotHash(id, full=true
 * @return {HTMLCanvasElement}
 *     The canvas element to be encoded or hashed.
 */
 function screenshot(id, full=true, highlights=[]) {
   let canvas;
 
   let highlightEls = [];
   for (let h of highlights) {
-    let el = elementManager.get(h, curContainer);
+    let el = seenEls.get(h, curContainer);
     highlightEls.push(el);
   }
 
   // viewport
   if (!id && !full) {
     canvas = capture.viewport(curContainer.frame.document, highlightEls);
 
   // element or full document element
   } else {
     let node;
     if (id) {
-      node = elementManager.get(id, curContainer);
+      node = seenEls.get(id, curContainer);
     } else {
       node = curContainer.frame.document.documentElement;
     }
 
     canvas = capture.element(node, highlightEls);
   }
 
   return canvas;