Closed Bug 1890091 Opened 6 months ago Closed 3 months ago

Avoid raising errors in "session.end" and "browser.close" when no Marionette client is connected

Categories

(Remote Protocol :: WebDriver BiDi, defect, P2)

Firefox 124
defect
Points:
3

Tracking

(firefox129 fixed)

RESOLVED FIXED
129 Branch
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."
);
}
}

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.

Component: Untriaged → Networking: WebSockets
Product: Firefox → Core
Component: Networking: WebSockets → WebDriver BiDi
Product: Core → Remote Protocol

Checking the HTTP flag of the session might be used here, which is bug 1884090.

Severity: -- → S3
Status: UNCONFIRMED → NEW
Depends on: 1884090
Ever confirmed: true
Priority: -- → P2
Whiteboard: [webdriver:backlog]

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.

Flags: needinfo?(siddaraju.gb)

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: nobody → hskupin
Status: NEW → ASSIGNED
Flags: needinfo?(siddaraju.gb)
Summary: session.end throws an error 'unsupported operation' error with reason 'Ending session which was started with Webdriver classic is not supported, use Webdriver classic delete command instead.' when marionette is also enabled → Avoid raising errors in "session.end" and "browser.close" when no Marionette client is connected
Whiteboard: [webdriver:backlog] → [webdriver:m12]

As discussed with Julian this fix is worth 3 points.

Points: --- → 3
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bc5e7e7d73e2 [webdriver-bidi] Allow "session.end" and "browser.close" with no Marionette client connected. r=webdriver-reviewers,jdescottes https://hg.mozilla.org/integration/autoland/rev/e6d45cde32e8 [wdspec] Add tests for "session.end" and "browser.close" with Marionette enabled. r=webdriver-reviewers,jdescottes
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/47008 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m12] → [webdriver:m12], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch
Upstream PR was closed without merging
Upstream PR merged by moz-wptsync-bot
Whiteboard: [webdriver:m12], [wptsync upstream] → [webdriver:m12][wptsync upstream][webdriver:relnote]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: