Web Inspector: XHR with text but responseType = "blob" shows blank content
https://bugs.webkit.org/show_bug.cgi?id=161422
<rdar://problem/28066869>
Reviewed by Brian Burg.
Source/WebCore:
Test: inspector/network/xhr-json-blob-has-content.html
When an XMLHttpRequest finished loading it was always setting the Inspector's
content for that load at the end. However, if the XHR was loading binary data
then it was passing an empty string to the inspector and overwriting the
data the inspector already had for the resource. Avoid this overwriting.
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::didFinishLoading):
When loading binary content we have no decoded text to send to the inspector.
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didFinishXHRLoadingImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::didFinishXHRLoading):
Switch to an Optional string, and if it is not available don't
call through to the NetworkAgent expecting decoded text.
* inspector/InspectorNetworkAgent.cpp:
(WebCore::InspectorNetworkAgent::didFinishXHRLoading):
* inspector/InspectorNetworkAgent.h:
Improve variable name.
LayoutTests:
* inspector/network/resources/data.json: Added.
* inspector/network/xhr-json-blob-has-content-expected.txt: Added.
* inspector/network/xhr-json-blob-has-content.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@205268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
10 files changed