Reporting API reports are not shown in the devtools network tab
Categories
(DevTools :: Netmonitor, defect, P2)
Tracking
(firefox150 fixed)
| Tracking | Status | |
|---|---|---|
| firefox150 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: sfarre)
References
(Blocks 1 open bug, Regressed 1 open bug)
Details
(Keywords: devtools-platform-blocked)
Attachments
(2 files, 1 obsolete file)
STR:
- Go to about:config
- Set
dom.reporting.enabledanddom.reporting.header.enabledto true - Navigate to https://nchevobbe--019c088c009977e6946581840457796c.web.val.run/
- Open DevTools, select the Netmonitor
- Click the trigger report button
(Note that the STR seem finicky, the report might only be sent once, when opening the URL in a new tab. After reloading (even hard), it doesn't show up reliably)
Similarly to Bug 1886790, the report POST request is not showing in the regular toolbox netmonitor, only in the Browser Toolbox netmonitor.
This is where we return false https://searchfox.org/firefox-main/rev/a771bf78b90de89e0ea9d17caaa64ffa240ecd7e/devtools/shared/network-observer/NetworkUtils.sys.mjs#541,608-609
function matchRequest(channel, filters) {
...
const win = lazy.NetworkHelper.getWindowForRequest(channel);
return windows.includes(win);
getWindowForRequest(request) {
try {
return this.getRequestLoadContext(request).associatedWindow;
} catch (ex) {
// On some request notificationCallbacks and loadGroup are both null,
// so that we can't retrieve any nsILoadContext interface.
// Fallback on nsILoadInfo to try to retrieve the request's window.
// (this is covered by test_network_get.html and its CSS request)
return request.loadInfo.loadingDocument?.defaultView;
}
},
this.getRequestLoadContext(request).associatedWindow throws with Uncaught NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsILoadContext.associatedWindow]
so we enter the catch block, and request.loadInfo.loadingDocument is null, so we end up returning undefined
| Reporter | ||
Comment 1•3 months ago
|
||
Valentin, would you know where those channels are created and if we can properly set their loading document?
Comment 2•3 months ago
|
||
They are sent from mozilla::dom::SendReports
I'm also not sure if these reports should have a loadingDocument, since we're not actually loading the response of the reporting API report.
Simon is working on the Reporting API so he can provide more info.
| Assignee | ||
Comment 3•3 months ago
|
||
Is this really an issue still? I see the request being made in devtools (under the network panel)? Or is this related to something different?
| Reporter | ||
Comment 4•3 months ago
|
||
(In reply to Simon Farre [:sfarre] from comment #3)
Is this really an issue still? I see the request being made in devtools (under the network panel)? Or is this related to something different?
it's only showing up in the Browser Toolbox Netmonitor (https://firefox-source-docs.mozilla.org/devtools-user/browser_toolbox/index.html), which is a "special" DevTools toolbox, mostly aimed at Firefox engineers. We want to have it displayed in the Tab toolbox netmonitor, which is what Web Developers are using. The tab netmonitor needs to have a way to match a given channel with the current opened tab (done in NetworkUtils.sys.mjs), which it usually does either by checking the associatedWindow or the loadingDocument (as said in Comment 0).
If it's not possible to set those on the channel, we might look for another flag (e.g. browsingContextId, innerWindowId, …) so we could match it with the tab's page.
Does that make sense Simon?
Updated•3 months ago
|
Comment 5•3 months ago
|
||
Feature seems scheduled for 149, we should have devtools support at the same time.
| Reporter | ||
Updated•2 months ago
|
| Assignee | ||
Comment 6•2 months ago
|
||
Work in progress.
| Assignee | ||
Comment 7•2 months ago
•
|
||
I've added a WIP here, but it's touching rather more than I want. It definitely would need review from a few people I believe, if I were to move this out of planned changes.
Updated•2 months ago
|
| Reporter | ||
Comment 8•2 months ago
|
||
Depends on D283896
| Reporter | ||
Comment 9•2 months ago
|
||
This is done by checking the channel associatedBrowsingContext in NetworkUtils matchRequest function.
A test is added to make sure Reporting API requests are visible in the Netmonitor
and that we can inspect their payload.
Updated•2 months ago
|
Comment 10•1 month ago
|
||
Comment 11•1 month ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/167e2110755d
https://hg.mozilla.org/mozilla-central/rev/8a2a412f3291
Updated•1 month ago
|
Description
•