Open juliandescottes opened 2 months ago
The initiator type in the WebDriver BiDi spec is probably closest to https://fetch.spec.whatwg.org/#concept-request-initiator
Things like "img", "font", "stylesheet" match resourceType in Puppeteer and are currently not in WebDriver BiDi spec. This probably matches https://fetch.spec.whatwg.org/#concept-request-destination or https://fetch.spec.whatwg.org/#request-initiator-type
To be honest, I am not sure Fetch defines these well (perhaps we could use the table mentioned in the fetch spec).
I can try to trace how it is implemented in CDP but I am not sure it is very well defined there.
The Browser Testing and Tools Working Group just discussed Clarify the logic to compute the initiator type of a request
.
From the current spec https://w3c.github.io/webdriver-bidi/#get-the-initiator
The initiator's type can be one of
"parser" / "script" / "preflight" / "other"
. "other" is the default, "preflight" is dedicated to CORS preflight. We should clarify in which cases the type should be "parser" or "script".When using
fetch
orxmlhttprequest
from a script, the type should be "script". When loading resources based on the parsing of the initial document, the type should be "parser". So we should probably focus on scenarios where elements are added via script but still rely on the parser. @OrKoN can you or someone from Google share more details on how CDP determines the initiator type?For comparison, Firefox DevTools has a handful of additional initiator types such as "img", "font", "stylesheet". For instance if a request is done in order to retrieve the image of an
img
element, the type is always "img" regardless of how the element was created.