Open Bug 1602005 Opened 6 years ago Updated 6 months ago

webRequest.onHeadersReceived: more object "details" properties than in the documentation

Categories

(WebExtensions :: Request Handling, task, P3)

70 Branch
task

Tracking

(Not tracked)

People

(Reporter: mad1ost, Assigned: robwu, NeedInfo)

References

Details

(Keywords: dev-doc-complete)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0

Steps to reproduce:

browser.webRequest.onHeadersReceived.addListener(
  (requestDetails) => console.log(requestDetails),
  {urls: ["<all_urls>"]}
);

Actual results:

In console

{…}
documentUrl: undefined
frameAncestors: Array []
​frameId: 0
​fromCache: false
​incognito: false
​ip: "93.184.216.34"
​method: "GET"
​originUrl: undefined
​parentFrameId: -1
​proxyInfo: null
​requestId: "1738"
​statusCode: 200
​statusLine: "HTTP/1.1 200 OK"
​tabId: 17
​timeStamp: 1575648080039
​type: "main_frame"
​url: "http://example.com/"

Expected results:

Properties such as ip, fromCache are not documented in https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/onHeadersReceived

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Request Handling

Not supported by Chrome, but I don't see a reason to remove them, so let's document it.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: dev-doc-needed
See Also: → 1471421, 1395020
Flags: needinfo?(richard)
Priority: -- → P2

Tracking via the GitHub issue 2593

Flags: needinfo?(richard)

I have added details of cookieStoreId and incognito to webRequest.onHeadersReceived. However, frameAncestors, ​fromCache, and ​​ip are not included in web_request.json for onHeadersReceived. Should they be added to web_request.json first? And if so, what's the process for doing that? If they don't need to be added to web_request.json first, where can I find more details on these properties? (ip is documented for other events, can I follow that documentation for onHeadersReceived?)
I've also noticed that cookieStoreId and incognito are documented in web_request.json for all the events, but aren't included in the MDN documentation. Once you've reviewed my changes in onHeadersReceived, I will update the other events.
Compatibility data is not done yet, I will address that once we've answered the questions above.

Flags: needinfo?(rob)
Flags: needinfo?(mixedpuppy)

frameAncestors was added in bug 1305237, but not added to web_request.json (while it should have been).

In Firefox, fromCache and ip are also set in onHeadersReceived when support was added in bug 1236940, but somehow it is not in Chrome (even though the information is known to the browser at that point).

Richard, could you update BCD and add fromCache/ip to onHeadersReceived (only supported by Firefox 47+, not in any other browser).
frameAncestors should also be in BCD (Firefox 58+, unsupported in other browsers), and web_request.json. I don't know if you also submit patches to mozilla-central, but if you do, could you attach a patch with a proposed change with frameAncestors in web_request.json? If not, let me know and I can do it myself.

(... this example is yet another reason to fix bug 1509938)

Flags: needinfo?(rob)
Flags: needinfo?(mixedpuppy)
See Also: → 1305237, 1509938

I will update the BCD (seems to be an issue with the BCD linter at the moment, once that's resolved I will submit the changes). I will also make the necessary updates to MDN. However, I'm not familiar with submitting patches to mozilla-central, I'm happy to figure out how to do this but it may be more efficient for you to do, please let me know.

Flags: needinfo?(rob)

I'll take it.

Assignee: nobody → rob
Flags: needinfo?(rob)

Thanks for the feedback, on MDN I have now updated:

  • onHeadersReceived to add details of frameAncestors, ip, and fromCache
  • all webRequest events to include cookieStoreId and incognito

I am unable to submit the BCD changes as the linter is failing for apparently unrelated issues. Once the linter issues are resolved I will submit the changes.

Thanks for agreeing to make the necessary schema updates on Mozilla central.

Flags: needinfo?(rob)
Severity: normal → N/A
Type: defect → task
Priority: P2 → P3

All of the MDN and BCD changes have been made. The outstanding item is to update web_request.json on mozilla-central. Rob, you mentioned that you do this. OK, if I remove the dev-docs-needed flag?

dev-doc-complete confirmed with :robwu (on Slack March 3)

You need to log in before you can comment on or make changes to this bug.