Closed Bug 1661390 Opened 5 years ago Closed 5 years ago

Use a UUID as session id for targets

Categories

(Remote Protocol :: CDP, defect, P1)

Firefox 82
defect

Tracking

(firefox82 fixed)

VERIFIED FIXED
82 Branch
Tracking Status
firefox82 --- fixed

People

(Reporter: ys, Assigned: whimboo)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36

Steps to reproduce:

Run firefox with "firefox --headless --remote-debugging-port"

Use Target.attachToTarget method to create a page.

Actual results:

The returned sessionId is an integer type

Expected results:

The sessionId should be string according to the protocol definition from here: https://chromedevtools.github.io/devtools-protocol/tot/Target/#type-SessionID

Hi Ys,

Thanks for your report and for attaching a link with more information regarding issue.

I'll add this ticket to the Widget: cocoa product in the hope someone from their team can take a look.

Regards,
Virginia

Component: Untriaged → Widget: Cocoa
Product: Firefox → Core
Component: Widget: Cocoa → Target
OS: Unspecified → All
Product: Core → Remote Protocol
Hardware: Unspecified → All

There is indeed the wrong data type returned:
https://searchfox.org/mozilla-central/rev/84922363f4014eae684aabc4f1d06380066494c5/remote/domains/parent/Target.jsm#136-140

We might also have to check additional places where this happens.

ys, is this a blocking bug for you or how manifests it?

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(ys)
Priority: -- → P3

Henrik Skupin, yes, it's blocking my lib to support firefox: https://github.com/go-rod/rod/issues/193.
A statically typed language like Golang or Java usually needs the JSON type to be consistent.

Flags: needinfo?(ys)
Blocks: 1662784

This is great to hear! Whenever you have issues feel free to file appropriate bugs if those don't exist yet. I also filed bug 1662784 to track all of them.

Regarding this bug I will make sure to take care of it early next week when I'm back.

Priority: P3 → P2

Currently we set the session id based on the last index used for the previous session. To be in par with Chrome and to lower the attack factor in discovering active sessions we should move to also use a UUID. By doing that we will always have a string type and won't have to run special code when serializing the session id.

Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Priority: P2 → P1
Summary: The "sessionId" for cdp is not string → Use a UUID as session id for targets

Sure, UUID is even better, good for avoiding race condition, debugging log, etc.

Summary: Use a UUID as session id for targets → The "sessionId" for cdp is not string
Summary: The "sessionId" for cdp is not string → Use a UUID as session id for targets

A session is defined as string in CDP but target specific commands
and events currently return a number based on the last used index.
This also makes it very easy to discover active sessions.

Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/adc5e45e75aa [remote] Use a UUID as session id for targets. r=remote-protocol-reviewers,jgraham
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 82 Branch

ys, this will be fixed in the next Firefox Nightly build that will be available in the next few hours. Please let us know how it works, and if other issues occur please file new bugs. Thanks again for adding Firefox support!

Thank you! Checked, now it works as expected.

Status: RESOLVED → VERIFIED
Component: CDP: Target → CDP
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: