Closed Bug 1886957 Opened 8 months ago Closed 8 months ago

Inconsistent fragment in BiDi network events between Chrome and Firefox

Categories

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

defect
Points:
2

Tracking

(firefox126 fixed)

RESOLVED FIXED
126 Branch
Tracking Status
firefox126 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [webdriver:m10])

Attachments

(1 file)

From the discussion at https://github.com/puppeteer/puppeteer/pull/12122#pullrequestreview-1952776226 , I was trying to check if hash/fragments should be included in BiDi's network events.

Eg if you fetch https://example.com/#foo, what should be the URL in the network.RequestData and in network.responseData. From quickly checking the fetch spec, I think that RequestData should contain the URL with the hash, but ResponseData should only contain https://example.com/.

The getter for the response's URL clearly states:

The url getter steps are to return the empty string if this’s response’s URL is null; otherwise this’s response’s URL, serialized with exclude fragment set to true.

But there's nothing explicitly mentioned for the request's URL getter. So unless it gets stripped somewhere else, I thing the request's URL should be https://example.com/#foo

At the moment, the behavior is inconsistent between Chrome and Firefox. Chrome always removes the fragment, Firefox always includes it.
I suspect that both approaches are wrong, but to be confirmed.

Adding some insights from :jgraham on Matrix:

Unless something is stripping the fragment as part of the request (maybe; I'm not sure), I think stripping the fragment from the response is wrong because we aren't running those getter steps; we're using the internal response class (not the JS wrapper) and that does have the fragment if the original request object's URL had a fragment.
In HTML we're constructing a navigation request at https://html.spec.whatwg.org/#populating-a-session-history-entry:concept-request and that's the URL for the session history entry, which must include a fragment

So the current Firefox implementation could actually be correct.
We should add a wdspec test to cover this once we reached an agreement.

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d94fe35a485d [wdspec] Add test to check network events for URL with fragment r=webdriver-reviewers,Sasha
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/45348 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Points: --- → 2
Priority: -- → P2
Whiteboard: [webdriver:m10]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: