Avoid raising errors in "session.end" and "browser.close" when no Marionette client is connected
Categories
(Remote Protocol :: WebDriver BiDi, defect, P2)
Tracking
(firefox129 fixed)
Tracking | Status | |
---|---|---|
firefox129 | --- | fixed |
People
(Reporter: siddaraju.gb, Assigned: whimboo)
References
Details
(Whiteboard: [webdriver:m12][wptsync upstream][webdriver:relnote])
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Steps to reproduce:
- Launch Firefox with marionette enabled
[./firefox --marionette] - Create a webdriver BiDi Socket
[webSocketHandleBiDi = new WebSocket("ws://localhost:"+ webSocketPortBiDi +
"/session")] - Create a new Session
send({
"method": "session.new",
"params": { "capabilities": {"webSocketUrl": "true", "browserName": "firefox"} }
}); - Then try to close the session
send({
"method": "session.end",
"params": {}
});
Actual results:
when i try to end bidi Session, i am getting 'unsupported operation' error with reason 'Ending session which was started with Webdriver classic is not supported, use Webdriver classic delete command instead.'
Error Details:
message { target: WebSocket, isTrusted: true, data: '{"type":"error","id":4,"error":"unsupported operation","message":"Ending session which was started with Webdriver classic is not supported, use Webdriver classic delete command instead.","stacktrace":"RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8\nWebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:192:5\nUnsupportedOperationError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:832:5\nend@chrome://remote/content/webdriver-bidi/modules/root/session.sys.mjs:56:13\nhandleCommand@chrome://remote/content/shared/messagehandler/MessageHandler.sys.mjs:255:33\nexecute@chrome://remote/content/shared/webdriver/Session.sys.mjs:274:32\nonPacket@chrome://remote/content/webdriver-bidi/WebDriverBiDiConnection.sys.mjs:211:37\nonMessage@chrome://remote/content/server/WebSocketTransport.sys.mjs:127:18\nhandleEvent@chrome://remote/content/server/WebSocketTransport.sys.mjs:109:14\n"}',
Expected results:
Session should have closed successfully.
This error is thrown due to a check in 'chrome\remote\content\webdriver-bidi\modules\root\session.sys.mjs' which checks for marionette is running or not
async end() {
if (lazy.Marionette.running) {
throw new lazy.error.UnsupportedOperationError(
"Ending session which was started with Webdriver classic is not supported, use Webdriver classic delete command instead."
);
}
}
Comment 1•6 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Networking: WebSockets' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Updated•6 months ago
|
Assignee | ||
Comment 2•6 months ago
|
||
Checking the HTTP flag of the session might be used here, which is bug 1884090.
Assignee | ||
Comment 3•3 months ago
|
||
With the http and bidi flags, we would be able to determine if the current session has a client connected for the classic protocol. This way, if no client is connected but Marionette is enabled, it would not trigger this error.
Siddaraju, would you maybe interested to contribute to this project? I'm happy to help in whatever question might come up.
Assignee | ||
Comment 4•3 months ago
|
||
This behavior is particularly annoying when testing with the BiDi client and having Marionette enabled. Therefore, I decided to address it. Adding Mozilla-specific BiDi tests for this was a bit more complicated, as it required significant refactoring.
Assignee | ||
Comment 5•3 months ago
|
||
Assignee | ||
Comment 6•3 months ago
|
||
Assignee | ||
Comment 7•3 months ago
|
||
As discussed with Julian this fix is worth 3 points.
Comment 10•3 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/bc5e7e7d73e2
https://hg.mozilla.org/mozilla-central/rev/e6d45cde32e8
Assignee | ||
Updated•2 months ago
|
Description
•