Bug 176508

Summary: WebDriver: ensure we close all windows handles when closing the session
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebDriverAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch bburg: review+

Carlos Garcia Campos
Reported 2017-09-07 05:22:03 PDT
The spec says that when closing the session all top level browsing contexts should be closed. We are currently checking if we have an active top level browsing context and then we try to close it before trying with the rest. It can happen that we are in an inconsistent state, for example if the current top level browsing context has been closed by JavaScript or another action and the user didn't switch to another one before closing the session. In such case, closing the session will fail with NoSuchwindow and any other window open will not be closed. It's safer to always as for all window handles and close them, which is what the spec says too.
Attachments
Patch (4.39 KB, patch)
2017-09-07 05:26 PDT, Carlos Garcia Campos
bburg: review+
Carlos Garcia Campos
Comment 1 2017-09-07 05:26:02 PDT
Carlos Garcia Campos
Comment 2 2017-09-07 22:35:50 PDT
Build failure in EWS has nothing to do with this patch, it failed to build the dependencies.
Blaze Burg
Comment 3 2017-09-08 12:46:00 PDT
Comment on attachment 320110 [details] Patch r=me Couldn't this still race with JS that closes or navigations a window somehow?
Carlos Garcia Campos
Comment 4 2017-09-09 00:02:32 PDT
(In reply to Brian Burg from comment #3) > Comment on attachment 320110 [details] > Patch > > r=me Thanks! > Couldn't this still race with JS that closes or navigations a window somehow? Yes, I think it's quite unlikely that something happens after the quit command (the problem in this case was a window closed before the quit command), and we are getting the window list again after closing every window. But yes, it could still happen. I think we could simply ignore NoSuchWindow errors when closing the session, if we try to close a window and the window no longer exists, there's no reason to fail.
Carlos Garcia Campos
Comment 5 2017-09-09 00:15:06 PDT
Radar WebKit Bug Importer
Comment 6 2017-09-27 12:48:37 PDT
Note You need to log in before you can comment on or make changes to this bug.