Web Inspector: Some resources fetched via Fetch API do not have data
https://bugs.webkit.org/show_bug.cgi?id=165230
<rdar://problem/29449220>
Reviewed by Alex Christensen.
Source/JavaScriptCore:
* inspector/protocol/Page.json:
Add new Fetch Page.ResourceType.
Source/WebCore:
Tests: http/tests/inspector/network/fetch-response-body.html
http/tests/inspector/network/xhr-response-body.html
* platform/network/ResourceRequestBase.h:
Distinguish Fetch requests.
* Modules/fetch/FetchRequest.cpp:
(WebCore::FetchRequest::initializeWith):
Set the requester type as Fetch.
* loader/DocumentThreadableLoader.cpp:
(WebCore::DocumentThreadableLoader::didReceiveResponse):
* loader/DocumentThreadableLoader.h:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponseImpl):
(WebCore::InspectorInstrumentation::didReceiveXHRResponseImpl): Deleted.
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didReceiveResourceResponse):
(WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponse):
(WebCore::InspectorInstrumentation::didReceiveXHRResponse): Deleted.
* inspector/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::didReceiveThreadableLoaderResponse):
(WebCore::InspectorNetworkAgent::didFinishXHRLoading):
(WebCore::InspectorNetworkAgent::didReceiveXHRResponse): Deleted.
Add a generic way for a ThreadableLoader load to update the type of a network request.
This will include both XHR and Fetch requests.
* inspector/InspectorPageAgent.cpp:
(WebCore::hasTextContent):
(WebCore::createXHRTextDecoder):
(WebCore::InspectorPageAgent::resourceTypeJson):
(WebCore::InspectorPageAgent::cachedResourceType):
(WebCore::InspectorPageAgent::createTextDecoder):
(WebCore::textContentForCachedResource):
* inspector/InspectorPageAgent.h:
* inspector/NetworkResourcesData.cpp:
(WebCore::createOtherResourceTextDecoder): Deleted.
Share the logic that creates a Text Decoders for XHR with other non-buffered requests
(like Fetch). This moves us to identical behavior for now.
* platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::isSupportedJSONMIMEType):
(WebCore::MIMETypeRegistry::isTextMIMEType):
* platform/MIMETypeRegistry.h:
Better detect different JSON content based on MIME Type.
Source/WebInspectorUI:
* Localizations/en.lproj/localizedStrings.js:
New "Fetch" and "Fetches" localized strings.
* UserInterface/Models/Resource.js:
(WebInspector.Resource.displayNameForType):
* UserInterface/Models/ResourceCollection.js:
(WebInspector.ResourceCollection.verifierForType):
* UserInterface/Views/CollectionContentView.js:
(WebInspector.CollectionContentView):
* UserInterface/Views/ResourceClusterContentView.js:
(WebInspector.ResourceClusterContentView.prototype.get responseContentView):
* UserInterface/Views/ResourceTreeElement.js:
(WebInspector.ResourceTreeElement.compareResourceTreeElements):
New ResourceType.Fetch. Behave like XHR in most places.
LayoutTests:
* http/tests/inspector/network/fetch-response-body-expected.txt: Added.
* http/tests/inspector/network/fetch-response-body.html: Added.
* http/tests/inspector/network/resources/data.html: Added.
* http/tests/inspector/network/resources/data.json: Added.
* http/tests/inspector/network/resources/data.svg: Added.
* http/tests/inspector/network/resources/data.txt: Added.
* http/tests/inspector/network/resources/echo.php: Added.
* http/tests/inspector/network/xhr-response-body-expected.txt: Added.
* http/tests/inspector/network/xhr-response-body.html: Added.
Tests for viewing content of XHR and Fetch requested resources
with different kinds of content.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@209629 268f45cc-cd09-0410-ab3c-d52691b4dbfc
36 files changed