Web Inspector: Please support HAR Export for network traffic
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Oct 2017 21:34:59 +0000 (21:34 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Oct 2017 21:34:59 +0000 (21:34 +0000)
commit6c5377929de75d4f56803f1b8c1720070f81a6a3
tree11f5814a35a69cd4e8b1596be2a5ff092c48eedf
parentd3a879a506ec9a7a64637f04409deb469e693030
Web Inspector: Please support HAR Export for network traffic
https://bugs.webkit.org/show_bug.cgi?id=146692
<rdar://problem/7463672>

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Network.json:
Add a walltime to each send request.

Source/WebCore:

Tests: http/tests/inspector/network/har/har-basic.html
       http/tests/inspector/network/har/har-page.html

* inspector/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::willSendRequest):
Include the wall time when sending a request. This is needed for HAR to
include a wall time, and can be used for Cookie expiration time calculation
as well.

Source/WebInspectorUI:

* UserInterface/Main.html:
* UserInterface/Test.html:
New resources.

* UserInterface/Base/Platform.js:
Include a build number as well.

* UserInterface/Base/URLUtilities.js:
(parseLocationQueryParameters): Deleted.
Remove unused function.

* UserInterface/Controllers/FrameResourceManager.js:
(WI.FrameResourceManager.prototype.frameDidNavigate):
(WI.FrameResourceManager.prototype.resourceRequestWillBeSent):
(WI.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache):
(WI.FrameResourceManager.prototype.resourceRequestDidReceiveResponse):
(WI.FrameResourceManager.prototype._addNewResourceToFrameOrTarget):
Pass along a walltime.

* UserInterface/Protocol/NetworkObserver.js:
(WI.NetworkObserver.prototype.requestWillBeSent):
Pass along a walltime. This new parameter shifts old parameters.

* UserInterface/Controllers/HARBuilder.js: Added.
(WI.HARBuilder.async.buildArchive):
(WI.HARBuilder.creator):
(WI.HARBuilder.pages):
(WI.HARBuilder.pageTimings):
(WI.HARBuilder.entry):
(WI.HARBuilder.request):
(WI.HARBuilder.response):
(WI.HARBuilder.cookies):
(WI.HARBuilder.headers):
(WI.HARBuilder.content):
(WI.HARBuilder.postData):
(WI.HARBuilder.cache):
(WI.HARBuilder.timings):
(WI.HARBuilder.ipAddress):
(WI.HARBuilder.date):
(WI.HARBuilder.fetchType):
HAR construction and helpers.

* UserInterface/Models/Cookie.js:
(WI.Cookie.prototype.expirationDate):
* UserInterface/Models/Resource.js:
(WI.Resource.prototype.get queryStringParameters):
(WI.Resource.prototype.get requestFormParameters):
(WI.Resource.prototype.get requestSentWalltime):
(WI.Resource.prototype.get requestSentDate):
(WI.Resource.prototype.hasRequestFormParameters):
Helpers for HAR generation and sub-sets of data.

* UserInterface/Models/SourceCode.js:
(WI.SourceCode.prototype._processContent):
Capture the raw, unmodified, base64 encoded flag and content. This ends
up getting used by HAR generation and is otherwise lost.

* UserInterface/Test/TestHarness.js:
(TestHarness.prototype.json):
Helper for just logging JSON data with a filter. This defaults to
a reasonable 2 space indent for JSON logs in our test output.

* UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView.prototype.get saveData):
(WI.DOMTreeContentView.get saveData.saveHandler): Deleted.
Drive-by simplify while looking at other save handlers.

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype.get supportsSave):
(WI.NetworkTableContentView.prototype.get saveData):
(WI.NetworkTableContentView.prototype.tableCellContextMenuClicked):
(WI.NetworkTableContentView.prototype._HARResources):
(WI.NetworkTableContentView.prototype._exportHAR):
Provide a context menu and save keyboard handler to export a HAR.
This matches other browsers.

* UserInterface/Views/ResourceClusterContentView.js:
(WI.ResourceClusterContentView.prototype._canShowRequestContentView):
Use code that is now available in Resource.

LayoutTests:

* http/tests/inspector/network/har/har-basic-expected.txt: Added.
* http/tests/inspector/network/har/har-basic.html: Added.
* http/tests/inspector/network/har/har-page-expected.txt: Added.
* http/tests/inspector/network/har/har-page.html: Added.
Tests with mock resources / data and real resources.

* platform/mac-wk1/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:
Skip on platforms that cannot provide complete metrics, so some optional
fields may be missing.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223856 268f45cc-cd09-0410-ab3c-d52691b4dbfc
27 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/network/har/har-basic-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/har/har-basic.html [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/har/har-page-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/har/har-page.html [new file with mode: 0644]
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/win/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Network.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorNetworkAgent.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Platform.js
Source/WebInspectorUI/UserInterface/Base/URLUtilities.js
Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js
Source/WebInspectorUI/UserInterface/Controllers/HARBuilder.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Main.html
Source/WebInspectorUI/UserInterface/Models/Cookie.js
Source/WebInspectorUI/UserInterface/Models/Resource.js
Source/WebInspectorUI/UserInterface/Models/SourceCode.js
Source/WebInspectorUI/UserInterface/Protocol/NetworkObserver.js
Source/WebInspectorUI/UserInterface/Test.html
Source/WebInspectorUI/UserInterface/Test/TestHarness.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js
Source/WebInspectorUI/UserInterface/Views/ResourceClusterContentView.js