Web Inspector: XHR with text but responseType = "blob" shows blank content
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Aug 2016 22:16:23 +0000 (22:16 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 31 Aug 2016 22:16:23 +0000 (22:16 +0000)
commit6bd75c9b02fec1594a9766d3a4166217b42b213a
tree363ecf6ac66ba160b17a211a901656a379e6cb12
parentece1e3d70d87b5c054fd7144f87c53811da476db
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: https://svn.webkit.org/repository/webkit/trunk@205268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/inspector/network/resources/data.json [new file with mode: 0644]
LayoutTests/inspector/network/xhr-json-blob-has-content-expected.txt [new file with mode: 0644]
LayoutTests/inspector/network/xhr-json-blob-has-content.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorNetworkAgent.cpp
Source/WebCore/inspector/InspectorNetworkAgent.h
Source/WebCore/xml/XMLHttpRequest.cpp