Cache information is not exposed to HAR
Categories
(DevTools :: Netmonitor, defect, P3)
Tracking
(firefox69 fixed)
Tracking | Status | |
---|---|---|
firefox69 | --- | fixed |
People
(Reporter: sebo, Assigned: lalas)
References
(Blocks 2 open bugs, )
Details
(Whiteboard: [webpagetest])
Attachments
(1 file, 1 obsolete file)
Updated•7 years ago
|
Comment 1•6 years ago
|
||
Comment 2•6 years ago
|
||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 3•6 years ago
|
||
No activity on this bug over the past 9 months when it was claimed.
Unassigning now.
Feel free to pick it up again if you did intend to work on it still.
This is just to clean our backlog of bugs and make things available for others when they're not being worked on.
Comment 4•6 years ago
|
||
Hi all,
I would like to try this, if it's available :)
thanks!
Assignee | ||
Comment 5•5 years ago
|
||
Is this a bug someone is already working on? If Mellina doesn't want to take it on any longer, I would like to take this one on.
Thanks!
Comment 6•5 years ago
|
||
Done!
Honza
Assignee | ||
Comment 7•5 years ago
|
||
Honza,
Tried a few different approaches and haven't been able to figure this one out. Will work on a few other and put this one on hold. Perhaps we can put it back to unassigned until I circle back in case someone more familiar with the HAR component wants to work on it in the meantime.
Thanks!
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Comment 8•5 years ago
|
||
Some pointers:
-
HAR file is built using HAR Builder. The cache entry around this place:
https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/devtools/client/netmonitor/src/har/har-builder.js#115 -
Note that the cache data might need to be fetched from the backend. They are sent to the client only if the user opens the Cache side panel.
See here:
https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/devtools/client/netmonitor/src/components/CachePanel.js#44
This is why e.g. buildRequest methdo is async (see in the previous link)
entry.request = await this.buildRequest(file);
... but this.buildCache
is not
- Fetching data from the backend is done through
this._options.requestData(file.id, "<data type>");
See an example for fetching "requestHeaders"
https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/devtools/client/netmonitor/src/har/har-builder.js#175
- I don't see that cache data would be fetched. It should be done around this place (in
buildCache
or inbuildCacheEntry
https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/devtools/client/netmonitor/src/har/har-builder.js#406-434
So, this needs to be used: this._options.requestData(file.id, "responseCache");
Does that help?
Honza
Assignee | ||
Comment 9•5 years ago
|
||
(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #8)
Some pointers:
HAR file is built using HAR Builder. The cache entry around this place:
https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/devtools/client/netmonitor/src/har/har-builder.js#115Note that the cache data might need to be fetched from the backend. They are sent to the client only if the user opens the Cache side panel.
See here:
https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/devtools/client/netmonitor/src/components/CachePanel.js#44This is why e.g. buildRequest methdo is async (see in the previous link)
entry.request = await this.buildRequest(file);
... butthis.buildCache
is not
- Fetching data from the backend is done through
this._options.requestData(file.id, "<data type>");
See an example for fetching "requestHeaders"
https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/devtools/client/netmonitor/src/har/har-builder.js#175
- I don't see that cache data would be fetched. It should be done around this place (in
buildCache
or inbuildCacheEntry
https://searchfox.org/mozilla-central/rev/7556a400affa9eb99e522d2d17c40689fa23a729/devtools/client/netmonitor/src/har/har-builder.js#406-434So, this needs to be used:
this._options.requestData(file.id, "responseCache");
Does that help?
Honza
It does. I know I did tinker with a few of these files but not the latter functions. I'll tinker with those - thanks Honza!
Assignee | ||
Comment 10•5 years ago
|
||
Pushing an update for you to check Honza. Will post questions on the Diff. comments.
Assignee | ||
Comment 11•5 years ago
|
||
Comment 13•5 years ago
|
||
I can also reproduce the problem with undefined cache
Here are the places which should be investigated:
- The Cache panel works and it fetches the data here
https://searchfox.org/mozilla-central/rev/0da35261b6789eec65476dbdd4913df6e235af6d/devtools/client/netmonitor/src/components/CachePanel.js#42-49
In the end it uses the same API as the HAR Builder. But, note that the panel expects the store to be updated with returned data from the backend, which causes the panel to rerender
- The HAR Builder uses:
const responseCache = await this._options.requestData(file.id, "responseCache");
It ends up using FirefoxDataProvider.requestData
(just like the CachePanel):
https://searchfox.org/mozilla-central/rev/0da35261b6789eec65476dbdd4913df6e235af6d/devtools/client/netmonitor/src/connector/firefox-data-provider.js#462
But, HARBuilder expects a return value, perhaps it's broken for the cache data?
Another difference is that this.actionsEnabled
is set to false during the HAR export
https://searchfox.org/mozilla-central/rev/0da35261b6789eec65476dbdd4913df6e235af6d/devtools/client/netmonitor/src/har/har-exporter.js#205
... to make HAR export faster. This could also be part of the problem...?
It's used in requestData
and it means that actions are not fired and reducer not updated:
https://searchfox.org/mozilla-central/rev/0da35261b6789eec65476dbdd4913df6e235af6d/devtools/client/netmonitor/src/connector/firefox-data-provider.js#477
- The backend is collecting cache data here:
https://searchfox.org/mozilla-central/rev/0da35261b6789eec65476dbdd4913df6e235af6d/devtools/server/actors/network-monitor/network-response-listener.js#393
And loading the cache data from the Browser cache here:
https://searchfox.org/mozilla-central/rev/0da35261b6789eec65476dbdd4913df6e235af6d/devtools/server/actors/network-monitor/network-response-listener.js#313
You should:
- Create console.logs around the places above
- Use Browser debugger to debug the places above
Mainly figure out why the CachePanel works well and HARBuilder doesn't
Honza
Assignee | ||
Comment 14•5 years ago
|
||
Honza,
Those are great ideas. I've made some progress, going to keep looking at the CachePanel, feels like I might be taking longer than I should on this one, lol.
Thanks!
Comment 15•5 years ago
|
||
Comment 16•5 years ago
|
||
Backed out changeset b4f0ee392b97 (bug 1174100) for failing at browser_net_har_import.js on a CLOSED TREE.
Backout link: https://hg.mozilla.org/integration/autoland/rev/bef3fa175d99de7fef6e1c34e94d6eba50719f35
Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&selectedJob=251899940&revision=b4f0ee392b9771796370b8f2b3194abba3599ff6
Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=251899940&repo=autoland&lineNumber=7744
Log snippet:
[task 2019-06-14T15:17:38.601Z] 15:17:38 INFO - TEST-PASS | devtools/client/netmonitor/src/har/test/browser_net_har_import.js | There must be the same number of keys for: log/entries/2 -
[task 2019-06-14T15:17:38.602Z] 15:17:38 INFO - TEST-PASS | devtools/client/netmonitor/src/har/test/browser_net_har_import.js | There must be the same keys for: log/entries/2 -
[task 2019-06-14T15:17:38.602Z] 15:17:38 INFO - Buffered messages finished
[task 2019-06-14T15:17:38.606Z] 15:17:38 INFO - TEST-UNEXPECTED-FAIL | devtools/client/netmonitor/src/har/test/browser_net_har_import.js | There must be the same number of keys for: log/entries/2/cache - Got 1, expected 0
[task 2019-06-14T15:17:38.607Z] 15:17:38 INFO - Stack trace:
[task 2019-06-14T15:17:38.607Z] 15:17:38 INFO - chrome://mochikit/content/browser-test.js:test_is:1324
[task 2019-06-14T15:17:38.608Z] 15:17:38 INFO - chrome://mochitests/content/browser/devtools/client/netmonitor/src/har/test/browser_net_har_import.js:compare:86
[task 2019-06-14T15:17:38.610Z] 15:17:38 INFO - chrome://mochitests/content/browser/devtools/client/netmonitor/src/har/test/browser_net_har_import.js:compare:128
[task 2019-06-14T15:17:38.611Z] 15:17:38 INFO - chrome://mochitests/content/browser/devtools/client/netmonitor/src/har/test/browser_net_har_import.js:compare:128
[task 2019-06-14T15:17:38.611Z] 15:17:38 INFO - chrome://mochitests/content/browser/devtools/client/netmonitor/src/har/test/browser_net_har_import.js:compare:118
[task 2019-06-14T15:17:38.611Z] 15:17:38 INFO - chrome://mochitests/content/browser/devtools/client/netmonitor/src/har/test/browser_net_har_import.js:null:71
[task 2019-06-14T15:17:38.612Z] 15:17:38 INFO - chrome://mochikit/content/browser-test.js:Tester_execTest/<:1115
[task 2019-06-14T15:17:38.613Z] 15:17:38 INFO - chrome://mochikit/content/browser-test.js:Tester_execTest:1143
[task 2019-06-14T15:17:38.614Z] 15:17:38 INFO - chrome://mochikit/content/browser-test.js:nextTest/<:1004
[task 2019-06-14T15:17:38.614Z] 15:17:38 INFO - chrome://mochikit/content/tests/SimpleTest/SimpleTest.js:SimpleTest.waitForFocus/waitForFocusInner/focusedOrLoaded/<:803
[task 2019-06-14T15:17:38.615Z] 15:17:38 INFO - Not taking screenshot here: see the one that was previously logged
Assignee | ||
Comment 17•5 years ago
|
||
I'll take a look at that test and update it - thanks!
Comment 18•5 years ago
|
||
Some analysis in the attached patch.
Honza
Comment 19•5 years ago
|
||
One more thing. The HAR spec says that custom fields need to start with underscore
http://www.softwareishard.com/blog/har-12-spec
So, all additional cache fields need to follow that rule.
- _dataSize
- _lastModified
- _device
Honza
Updated•5 years ago
|
Comment 20•5 years ago
|
||
Comment 21•5 years ago
|
||
bugherder |
Description
•