Charles Proxy errors opening har files exported from Safari (invalid startedDateTime) Steps to Reproduce: 1. Open apple.com 2. Open inspector after page load 3. Export a HAR from Network Tab (lacking resource load data, just listing existing resource) 4. Open HAR in Charles => ‘JsonParse: Invalid format: “”’ Note: • This is due to `"startedDateTime" = ""` in the HAR content • `startedDateTime` is non-optional in entries and pages: http://www.softwareishard.com/blog/har-12-spec/ Proposal: We should not allow exporting a HAR without full load data. So disallow HAR export when just opening the inspector for a page but allowing it on reload / navigation once we have main resource content.
<rdar://problem/46863411>
Created attachment 357893 [details] [PATCH] Proposed Fix
Comment on attachment 357893 [details] [PATCH] Proposed Fix r=me Is there a way to test this? And, we probably should update documentation somewhere to explain this restriction.
Comment on attachment 357893 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=357893&action=review > Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1167 > + let mainResource = mainFrame.mainResource; Considering that the HAR is built based on the filtered resources in the table, is this check necessary? Do we allow an export without the main resource? > Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1168 > + if (!mainResource) Aside: is it ever possible for the `mainFrame` to not have a `mainResource`? > Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1174 > + if (!this._HARResources().length) NIT: I know that this isn't part of this patch, but shouldn't this be named `_harResouces`?
(In reply to Brian Burg from comment #3) > Comment on attachment 357893 [details] > [PATCH] Proposed Fix > > r=me > > Is there a way to test this? And, we probably should update documentation > somewhere to explain this restriction. Existing HAR tests passed. The rest is primarily a UI restriction. (In reply to Devin Rousso from comment #4) > Comment on attachment 357893 [details] > [PATCH] Proposed Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=357893&action=review > > > Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1167 > > + let mainResource = mainFrame.mainResource; > > Considering that the HAR is built based on the filtered resources in the > table, is this check necessary? Do we allow an export without the main > resource? We can export a subset, but the HAR itself will need top level info. > > Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1168 > > + if (!mainResource) > > Aside: is it ever possible for the `mainFrame` to not have a `mainResource`? Probably not, but might as well check. I don't know about cases like ITMLKit. > > Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js:1174 > > + if (!this._HARResources().length) > > NIT: I know that this isn't part of this patch, but shouldn't this be named > `_harResouces`? Either works.
Comment on attachment 357893 [details] [PATCH] Proposed Fix Clearing flags on attachment: 357893 Committed r239478: <https://trac.webkit.org/changeset/239478>
All reviewed patches have been landed. Closing bug.