Closed Bug 1904892 Opened 2 years ago Closed 1 year ago

Add support for "initiatorType" and "destination" to network events

Categories

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

task
Points:
2

Tracking

(firefox134 fixed)

RESOLVED FIXED
134 Branch
Tracking Status
firefox134 --- fixed

People

(Reporter: whimboo, Assigned: jdescottes)

References

(Blocks 5 open bugs, )

Details

(Whiteboard: [webdriver:m14][wptsync upstream][webdriver:relnote])

Attachments

(3 external files, 2 obsolete files)

There is the request from Puppeteer folks to add a resourceType to the network events. It's just a proposal at the moment and the specification needs to be done. See https://github.com/w3c/webdriver-bidi/issues/704 for details.

No longer blocks: 1852891

Downgrading as optional for M12 because it's not clear when a spec for this field will be ready.

Blocks: 1790371
Priority: P2 → P3
Whiteboard: [webdriver:m12] → [webdriver:m13]
Whiteboard: [webdriver:m13] → [webdriver:m14]

This is a blocker for Cypress to make use of WebDriver BiDi instead of CDP. We probably have to get it added to our M13 milestone given that it causes breakage for generic stuff they do (see bug 1604723 comment 23).

Blocks: 1604723
Priority: P3 → --
Whiteboard: [webdriver:m14] → [webdriver:triage]
Blocks: 1917540
Priority: -- → P2
Whiteboard: [webdriver:triage] → [webdriver:m13]

https://github.com/w3c/webdriver-bidi/pull/809 has the actual additions that we will be able to merge soon. The two properties are now initiatorType and destination. But those are not supported for the network.beforeRequestSent event where we would need the initiator type which is to be followed in a different PR.

As such lets use this bug for the implementation of the initiatorType and destination properties.

No longer blocks: 1790369
Summary: Add support for "resourceType" to network events → Add support for "initiatorType" and "destination" to network events

The WebDriver BiDi PR got merged. So this bug can be implemented now.

When implementing this feature we should as well deprecate the Initiator.type field as proposed in this PR:
https://github.com/w3c/webdriver-bidi/pull/813/files

I gave this a quick shot today, got help from necko peers. Some observations:

Kershaw: I asked on the channel, but just to avoid forgetting about it: do you think we can propagate the initiatorType information from the content channel to the parent channel before "http-on-before-connect" is emitted?

Flags: needinfo?(kershaw)
Whiteboard: [webdriver:m13] → [webdriver:m14]

Yes, should be easy to do.

We need to HttpChannelOpenArgs, set the arg in
mozilla::net::HttpChannelChild::ContinueAsyncOpen, extract it in mozilla::net::HttpChannelParent::Init then in mozilla::net::HttpChannelParent::DoAsyncOpen we need to call
httpChannel->SetInitiatorType(aInitiatorType)

Flags: needinfo?(kershaw)

(In reply to Valentin Gosu [:valentin] (he/him) from comment #7)

Yes, should be easy to do.

We need to HttpChannelOpenArgs, set the arg in
mozilla::net::HttpChannelChild::ContinueAsyncOpen, extract it in mozilla::net::HttpChannelParent::Init then in mozilla::net::HttpChannelParent::DoAsyncOpen we need to call
httpChannel->SetInitiatorType(aInitiatorType)

Thanks I will give it a shot!

Edit: works perfectly, thanks for the hints.

This changeset synchronizes the initiatorType from the child channel to the parent channel in asyncOpen.
It also removes noscript from initiatorType in nsITimedChannel

Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

Add the new fields to request data for all event types

Depends on D229381

Update the basic assert helpers to check the new fields and change initiator to be optional
for beforeRequestSent

Depends on D229382

Expose a getter on nsILoadInfo to easily retrieve the fetch destination as a string
This avoids duplicating the mapping logic in JS for webdriver bidi

Depends on: 1932162

Comment on attachment 9438368 [details]
Bug 1904892 - Expose fetch destination on nsILoadInfo

Revision D229384 was moved to bug 1932162. Setting attachment 9438368 [details] to obsolete.

Attachment #9438368 - Attachment is obsolete: true

Comment on attachment 9438361 [details]
Bug 1904892 - Set the initiatorType in HttpChannelParent and expose to scripts

Revision D229378 was moved to bug 1932162. Setting attachment 9438361 [details] to obsolete.

Attachment #9438361 - Attachment is obsolete: true

Downgrading to 2p since part of the patches moved to Bug 1932162.

Points: 3 → 2
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/117435d3eba6 [bidi] Add destination and initiatorType to network events RequestData r=webdriver-reviewers,whimboo https://hg.mozilla.org/integration/autoland/rev/7a28805ee7e5 [wdspec] Update wdspec assert helpers to support initiatorType and destination r=webdriver-reviewers,whimboo https://hg.mozilla.org/integration/autoland/rev/d4f7c1a6155f [wdspec] Add wdspec tests for requestData initiatorType and destination r=webdriver-reviewers,whimboo
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/49338 for changes under testing/web-platform/tests
Whiteboard: [webdriver:m14] → [webdriver:m14], [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch
Upstream PR merged by moz-wptsync-bot

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #5)

When implementing this feature we should as well deprecate the Initiator.type field as proposed in this PR:
https://github.com/w3c/webdriver-bidi/pull/813/files

Julian it looks like we missed to to that. So we probably should get a new bug filed.

Flags: needinfo?(jdescottes)

Right I need to file a new bug, but that was intentional, I wanted to do it separately.

Flags: needinfo?(jdescottes)
Blocks: 1933144
Blocks: 1933250
Blocks: 1933331
Whiteboard: [webdriver:m14], [wptsync upstream] → [webdriver:m14][wptsync upstream][webdriver:relnote]
See Also: → 1985552
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: