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 785511 679084c3a88c283a8d5494f3d9e998a9a399b7fc
parent 784524 0e45c13b34e815cb42a9f08bb44142d1a81e186e
child 785512 2aedc53d71d872b2248336ec14bf19d1cbc222b8
child 785513 c7ef2aafcd46f10398e57def666c35d899c0a4ab
child 785521 1eeb2128a0981b852ddc6e655b5e0d17870306ff
push id107237
push userbmo:hskupin@gmail.com
push dateFri, 20 Apr 2018 08:50:59 +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