Bug 1455282 - [wdclient] End session if no more windows are open. draft
authorHenrik Skupin <mail@hskupin.info>
Thu, 19 Apr 2018 22:40:07 +0200
changeset 785590 fd06018fb60ab97eae946ae767089dbb7a6105dd
parent 785586 cc0d7de218cb0c260c8ba0cf6637845ad2222f49
child 785591 296a5a82bb1a0b55a04b030ef3bf7d0ece7194b3
child 786811 84803e0354ef58cc5005cff97a2b9b43eb29b295
push id107260
push userbmo:hskupin@gmail.com
push dateFri, 20 Apr 2018 11:37:46 +0000
bugs1455282
milestone61.0a1
Bug 1455282 - [wdclient] End session if no more windows are open. After closing the last top-level browsing context, the session will be closed too. MozReview-Commit-ID: CVsJpHO34BM
testing/web-platform/tests/tools/webdriver/webdriver/client.py
--- a/testing/web-platform/tests/tools/webdriver/webdriver/client.py
+++ b/testing/web-platform/tests/tools/webdriver/webdriver/client.py
@@ -531,17 +531,22 @@ class Session(object):
         else:
             url = "frame"
             body = {"id": frame}
 
         return self.send_session_command("POST", url, body)
 
     @command
     def close(self):
-        return self.send_session_command("DELETE", "window")
+        handles = self.send_session_command("DELETE", "window")
+        if len(handles) == 0:
+            # With no more open top-level browsing contexts, the session is closed.
+            self.session_id = None
+
+        return handles
 
     @property
     @command
     def handles(self):
         return self.send_session_command("GET", "window/handles")
 
     @property
     @command