Inspector should display service worker served responses properly
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 22:00:37 +0000 (22:00 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 2 Nov 2017 22:00:37 +0000 (22:00 +0000)
commite4b0c5c4c8fe84058a52d0cc3ecbd8b5251a5840
treeed60d385d93d27866ca600779371f4101c2d0932
parent3a6550313f57f3cbfcbd4ed7e03e8ca633fa75a5
Inspector should display service worker served responses properly
https://bugs.webkit.org/show_bug.cgi?id=178597
<rdar://problem/35186111>

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Network.json:
Expose a new "service-worker" response source.

Source/WebCore:

Test: http/tests/inspector/network/resource-response-service-worker.html

* inspector/InspectorNetworkAgent.cpp:
(WebCore::responseSource):
Use the new protocol enum.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
New Service Worker related strings.

* UserInterface/Controllers/HARBuilder.js:
(WI.HARBuilder.entry):
(WI.HARBuilder.timings):
Only output timing data when we have real resource timing data.

(WI.HARBuilder.fetchType):
Output a new string for a Service Worker load in our custom field.

* UserInterface/Models/ResourceTimingData.js:
(WI.ResourceTimingData.prototype.get responseStart):
Fallback further to the responseEnd. This can happen if the response
itself is an error/failure and there was no response, so treat it as
the same as response end.

* UserInterface/Models/Resource.js:
(WI.Resource.responseSourceFromPayload):
(WI.Resource.prototype.updateForRedirectResponse):
(WI.Resource.prototype.updateForResponse):
A fetch response won't change the URL, so if the URL is empty
don't change it from what the request's URL was.

(WI.Resource.prototype.hasResponse):
Failure is like finished. We should likely transition to an "isComplete" method.

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype._populateTransferSizeCell):
(WI.NetworkTableContentView.prototype._generateSortComparator):
Output "(service worker)" in the transfer size field, to indicate this came
from a Service worker. Sort such loads together.

* UserInterface/Views/ResourceHeadersContentView.js:
(WI.ResourceHeadersContentView.prototype._responseSourceDisplayString):
(WI.ResourceHeadersContentView.prototype._refreshSummarySection):
Include the Service Worker response source in this details view. Also include
a FIXME, since we would like to link directly to the service worker in the future.

LayoutTests:

* LayoutTests/platform/gtk/TestExpectations:
* LayoutTests/platform/mac-wk1/TestExpectations:
* LayoutTests/platform/win/TestExpectations:
* LayoutTests/platform/wpe/TestExpectations:
Skip Inspector service worker tests on platforms where Service Workers
are not yet supported. For now this is just one test, future tests
specific to Service Workers will go into a directory.

* http/tests/inspector/network/resource-response-service-worker-expected.txt: Added.
* http/tests/inspector/network/resource-response-service-worker.html: Added.
* http/tests/inspector/network/resources/fetch-service-worker.js: Added.
Test for service worker initiated loads.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224357 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/network/resource-response-service-worker-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resource-response-service-worker.html [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/resources/fetch-service-worker.js [new file with mode: 0644]
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wpe/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/Network.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Controllers/HARBuilder.js
Source/WebInspectorUI/UserInterface/Models/Resource.js
Source/WebInspectorUI/UserInterface/Models/ResourceTimingData.js
Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js
Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js