bug 1499057: webdriver: remove known web element cache; r=whimboo
☠☠ backed out by 29c0fc82e879 ☠ ☠
authorAndreas Tolfsen <ato@sny.no>
Wed, 17 Oct 2018 12:06:53 +0000
changeset 500119 5df04b130a16afcaa917204055b8227f1ef0f411
parent 500118 177dda6727faf35ed3ed5dd4bf92199cc441b270
child 500120 a53e0884fcb170c2cde943ba20aa7fc5ef083e42
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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 1499057: webdriver: remove known web element cache; r=whimboo The known web element cache in the WebDriver test client, or webdriver.Session._element_cache, is used only to avoid constructing new webdriver.Element instances of the same web element and serves no practical purpose beyond that Since this client is intended for testing purposes, we would like to be able to construct duplicate webdriver.Element instances, so that e.g. fake elements can be constructed and send to the remote end. Differential Revision: https://phabricator.services.mozilla.com/D8855
--- a/testing/web-platform/tests/tools/webdriver/webdriver/client.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/client.py
@@ -371,17 +371,16 @@ class Session(object):
         self.transport = transport.HTTPWireProtocol(
             host, port, url_prefix, timeout=timeout)
         self.requested_capabilities = capabilities
         self.capabilities = None
         self.session_id = None
         self.timeouts = None
         self.window = None
         self.find = None
-        self._element_cache = {}
         self.extension = None
         self.extension_cls = extension
         self.timeouts = Timeouts(self)
         self.window = Window(self)
         self.find = Find(self)
         self.alert = UserPrompt(self)
         self.actions = Actions(self)
@@ -664,32 +663,26 @@ class Element(object):
         :param id: Web element UUID which must be unique across
             all browsing contexts.
         :param session: Current ``webdriver.Session``.
         self.id = id
         self.session = session
-        if id in self.session._element_cache:
-            raise ValueError("Element already in cache: %s" % id)
-        self.session._element_cache[self.id] = self
     def __repr__(self):
         return "<%s %s>" % (self.__class__.__name__, self.id)
     def __eq__(self, other):
         return (isinstance(other, Element) and self.id == other.id and
                 self.session == other.session)
     def from_json(cls, json, session):
         uuid = json[Element.identifier]
-        if uuid in session._element_cache:
-            return session._element_cache[uuid]
         return cls(uuid, session)
     def send_element_command(self, method, uri, body=None):
         url = "element/%s/%s" % (self.id, uri)
         return self.session.send_session_command(method, url, body)
     def find_element(self, strategy, selector):