Delete session on last window #64
Delete session on last window #64
Conversation
cc @whimboo |
No functional changes.
The set_delete_session setter and delete_session getter is a confusing API, so we can expose the delete_session boolean field directly.
Reviewed 1 of 1 files at r1, 1 of 1 files at r2, 1 of 1 files at r3, 1 of 1 files at r4, 1 of 1 files at r5. src/error.rs, line 108 at r4 (raw file):
I'm not really convinced this API change is worth the breakage. I mean it's probably better, but not lots better. src/server.rs, line 74 at r5 (raw file):
Don't use unwrap here. Either change the code to return an error in this case, or perhaps preferably, change the response type to ensure that we only have an array earlier. Comments from Reviewable |
Review status: all files reviewed at latest revision, 2 unresolved discussions. src/error.rs, line 108 at r4 (raw file): Previously, jgraham wrote…
Sure, would you be more comfortable with this change if I drop this specific commit? Comments from Reviewable |
Review status: all files reviewed at latest revision, 2 unresolved discussions. src/server.rs, line 74 at r5 (raw file): Previously, jgraham wrote…
I can do something like this to make sure it always works? let empty = vec![];
let windows = value.as_array().unwrap_or(empty.as_ref()); Comments from Reviewable |
Review status: all files reviewed at latest revision, 2 unresolved discussions. src/error.rs, line 108 at r4 (raw file): Previously, andreastt (Andreas Tolfsen) wrote…
Well I guess now I think of it adding an extra response type will probably also break consumers, so I guess I'm fine with this. Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. src/server.rs, line 74 at r5 (raw file): Previously, andreastt (Andreas Tolfsen) wrote…
Well you can, but that would hide problems. Can't we make a new Comments from Reviewable |
The response type is intended to be used for matching when encountering a response from closing the window. On closing the last window, or when the returned array is empty, the session should be deleted.
The WebDriver standard says that closing the last window should end the session. This looks at the incoming response of closing a window, and if the returned window handle array is empty, it deletes the session. This will implicitly call the WebDriverHandler implementation's delete_session function too.
Review status: 1 of 3 files reviewed at latest revision, 1 unresolved discussion. src/server.rs, line 74 at r5 (raw file): Previously, jgraham wrote…
That’s a great idea! I’ve made it so. Comments from Reviewable |
Review status: 1 of 3 files reviewed at latest revision, 1 unresolved discussion. src/server.rs, line 74 at r5 (raw file): Previously, andreastt (Andreas Tolfsen) wrote…
Done. Comments from Reviewable |
Reviewed 1 of 2 files at r6, 1 of 1 files at r7. Comments from Reviewable |
This implements step 4 of the Close Window steps that closes the session.
When the window handle array sent back from the
CloseWindow
command is empty, delete the session.It also changes the
WebDriverError
’s API slightly by publishing thedelete_session
field instead of using the hard-to-understandset_delete_session
anddelete_session
getter/setters.This change is