Diff
Modified: releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog (205608 => 205609)
--- releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog 2016-09-08 09:04:02 UTC (rev 205608)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/ChangeLog 2016-09-08 09:05:55 UTC (rev 205609)
@@ -1,3 +1,15 @@
+2016-08-31 Joseph Pecoraro <[email protected]>
+
+ 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.
+
+ * 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.
+
2016-08-31 Chris Dumez <[email protected]>
Object.getPrototypeOf() should return null cross-origin
Added: releases/WebKitGTK/webkit-2.14/LayoutTests/inspector/network/resources/data.json (0 => 205609)
--- releases/WebKitGTK/webkit-2.14/LayoutTests/inspector/network/resources/data.json (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/inspector/network/resources/data.json 2016-09-08 09:05:55 UTC (rev 205609)
@@ -0,0 +1 @@
+{"alpha":"beta","gamma":12345}
Added: releases/WebKitGTK/webkit-2.14/LayoutTests/inspector/network/xhr-json-blob-has-content-expected.txt (0 => 205609)
--- releases/WebKitGTK/webkit-2.14/LayoutTests/inspector/network/xhr-json-blob-has-content-expected.txt (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/inspector/network/xhr-json-blob-has-content-expected.txt 2016-09-08 09:05:55 UTC (rev 205609)
@@ -0,0 +1,14 @@
+Tests that an XMLHttpRequest resource gives us JSON text even if it is marked as having blob content.
+
+
+== Running test suite: XHR.Blob
+-- Running test case: XHR.JSONContent
+PASS: Resource should be created.
+PASS: Resource should complete loading.
+PASS: Resource has expected content.
+
+-- Running test case: XHR.JSONContent.Blob
+PASS: Resource should be created.
+PASS: Resource should complete loading.
+PASS: Resource has expected content.
+
Added: releases/WebKitGTK/webkit-2.14/LayoutTests/inspector/network/xhr-json-blob-has-content.html (0 => 205609)
--- releases/WebKitGTK/webkit-2.14/LayoutTests/inspector/network/xhr-json-blob-has-content.html (rev 0)
+++ releases/WebKitGTK/webkit-2.14/LayoutTests/inspector/network/xhr-json-blob-has-content.html 2016-09-08 09:05:55 UTC (rev 205609)
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script>
+function createJSONXHR() {
+ let xhr = new XMLHttpRequest;
+ xhr.open("GET", "resources/data.json?" + Math.random(), true);
+ xhr.send();
+}
+
+function createJSONBlobXHR() {
+ let xhr = new XMLHttpRequest;
+ xhr.open("GET", "resources/data.json?" + Math.random(), true);
+ xhr.responseType = "blob";
+ xhr.send();
+}
+
+function test()
+{
+ let suite = InspectorTest.createAsyncSuite("XHR.Blob");
+
+ const jsonContent = `{"alpha":"beta","gamma":12345}\n`;
+
+ suite.addTestCase({
+ name: "XHR.JSONContent",
+ description: "Ensure an XMLHttpRequest with JSON content still gives us text.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("createJSONXHR()");
+ WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+ let resource = event.data.resource;
+ InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+ resource.singleFireEventListener(WebInspector.Resource.Event.LoadingDidFinish, (event) => {
+ InspectorTest.pass("Resource should complete loading.");
+ resource.requestContent().then(() => {
+ InspectorTest.expectThat(resource.content === jsonContent, "Resource has expected content.");
+ }).then(resolve, reject);
+ });
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "XHR.JSONContent.Blob",
+ description: "Ensure an XMLHttpRequest with JSON content and a responseType of blob still gives us text.",
+ test: (resolve, reject) => {
+ InspectorTest.evaluateInPage("createJSONBlobXHR()");
+ WebInspector.Frame.singleFireEventListener(WebInspector.Frame.Event.ResourceWasAdded, (event) => {
+ let resource = event.data.resource;
+ InspectorTest.expectThat(resource instanceof WebInspector.Resource, "Resource should be created.");
+ resource.singleFireEventListener(WebInspector.Resource.Event.LoadingDidFinish, (event) => {
+ InspectorTest.pass("Resource should complete loading.");
+ resource.requestContent().then(() => {
+ InspectorTest.expectThat(resource.content === jsonContent, "Resource has expected content.");
+ }).then(resolve, reject);
+ });
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests that an XMLHttpRequest resource gives us JSON text even if it is marked as having blob content.</p>
+</body>
+</html>
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (205608 => 205609)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog 2016-09-08 09:04:02 UTC (rev 205608)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog 2016-09-08 09:05:55 UTC (rev 205609)
@@ -1,3 +1,34 @@
+2016-08-31 Joseph Pecoraro <[email protected]>
+
+ 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.
+
+ 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.
+
2016-08-31 Andreas Kling <[email protected]>
DOM event handling should pass Event around by reference.
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorInstrumentation.cpp (205608 => 205609)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorInstrumentation.cpp 2016-09-08 09:04:02 UTC (rev 205608)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorInstrumentation.cpp 2016-09-08 09:05:55 UTC (rev 205609)
@@ -635,12 +635,14 @@
consoleAgent->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this.
}
-void InspectorInstrumentation::didFinishXHRLoadingImpl(InstrumentingAgents& instrumentingAgents, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
+void InspectorInstrumentation::didFinishXHRLoadingImpl(InstrumentingAgents& instrumentingAgents, ThreadableLoaderClient* client, unsigned long identifier, Optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
{
if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
consoleAgent->didFinishXHRLoading(identifier, url, sendURL, sendLineNumber, sendColumnNumber);
- if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent())
- networkAgent->didFinishXHRLoading(client, identifier, sourceString);
+ if (InspectorNetworkAgent* networkAgent = instrumentingAgents.inspectorNetworkAgent()) {
+ if (decodedText)
+ networkAgent->didFinishXHRLoading(client, identifier, *decodedText);
+ }
}
void InspectorInstrumentation::didReceiveXHRResponseImpl(InstrumentingAgents& instrumentingAgents, unsigned long identifier)
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorInstrumentation.h (205608 => 205609)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorInstrumentation.h 2016-09-08 09:04:02 UTC (rev 205608)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorInstrumentation.h 2016-09-08 09:05:55 UTC (rev 205609)
@@ -176,7 +176,7 @@
static void didReceiveData(Frame*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength);
static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, double finishTime);
static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
- static void didFinishXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
+ static void didFinishXHRLoading(ScriptExecutionContext*, ThreadableLoaderClient*, unsigned long identifier, Optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
static void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier);
static void willLoadXHRSynchronously(ScriptExecutionContext*);
static void didLoadXHRSynchronously(ScriptExecutionContext*);
@@ -348,7 +348,7 @@
static void didFailLoadingImpl(InstrumentingAgents&, unsigned long identifier, DocumentLoader*, const ResourceError&);
static void willLoadXHRImpl(InstrumentingAgents&, ThreadableLoaderClient*, const String&, const URL&, bool, RefPtr<FormData>&&, const HTTPHeaderMap&, bool);
static void didFailXHRLoadingImpl(InstrumentingAgents&, ThreadableLoaderClient*);
- static void didFinishXHRLoadingImpl(InstrumentingAgents&, ThreadableLoaderClient*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
+ static void didFinishXHRLoadingImpl(InstrumentingAgents&, ThreadableLoaderClient*, unsigned long identifier, Optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber);
static void didReceiveXHRResponseImpl(InstrumentingAgents&, unsigned long identifier);
static void willLoadXHRSynchronouslyImpl(InstrumentingAgents&);
static void didLoadXHRSynchronouslyImpl(InstrumentingAgents&);
@@ -916,10 +916,10 @@
didFailLoadingImpl(*instrumentingAgents, identifier, loader, error);
}
-inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
+inline void InspectorInstrumentation::didFinishXHRLoading(ScriptExecutionContext* context, ThreadableLoaderClient* client, unsigned long identifier, Optional<String> decodedText, const String& url, const String& sendURL, unsigned sendLineNumber, unsigned sendColumnNumber)
{
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
- didFinishXHRLoadingImpl(*instrumentingAgents, client, identifier, sourceString, url, sendURL, sendLineNumber, sendColumnNumber);
+ didFinishXHRLoadingImpl(*instrumentingAgents, client, identifier, decodedText, url, sendURL, sendLineNumber, sendColumnNumber);
}
inline void InspectorInstrumentation::didReceiveXHRResponse(ScriptExecutionContext* context, unsigned long identifier)
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorNetworkAgent.cpp (205608 => 205609)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorNetworkAgent.cpp 2016-09-08 09:04:02 UTC (rev 205608)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorNetworkAgent.cpp 2016-09-08 09:05:55 UTC (rev 205609)
@@ -448,9 +448,9 @@
m_resourcesData->setResourceType(IdentifiersFactory::requestId(identifier), InspectorPageAgent::ScriptResource);
}
-void InspectorNetworkAgent::didFinishXHRLoading(ThreadableLoaderClient*, unsigned long identifier, const String& sourceString)
+void InspectorNetworkAgent::didFinishXHRLoading(ThreadableLoaderClient*, unsigned long identifier, const String& decodedText)
{
- m_resourcesData->setResourceContent(IdentifiersFactory::requestId(identifier), sourceString);
+ m_resourcesData->setResourceContent(IdentifiersFactory::requestId(identifier), decodedText);
}
void InspectorNetworkAgent::didReceiveXHRResponse(unsigned long identifier)
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorNetworkAgent.h (205608 => 205609)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorNetworkAgent.h 2016-09-08 09:04:02 UTC (rev 205608)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/inspector/InspectorNetworkAgent.h 2016-09-08 09:05:55 UTC (rev 205609)
@@ -82,7 +82,7 @@
void didFinishLoading(unsigned long identifier, DocumentLoader&, double finishTime);
void didFailLoading(unsigned long identifier, DocumentLoader&, const ResourceError&);
void didLoadResourceFromMemoryCache(DocumentLoader&, CachedResource&);
- void didFinishXHRLoading(ThreadableLoaderClient*, unsigned long identifier, const String& sourceString);
+ void didFinishXHRLoading(ThreadableLoaderClient*, unsigned long identifier, const String& decodedText);
void didReceiveXHRResponse(unsigned long identifier);
void willLoadXHRSynchronously();
void didLoadXHRSynchronously();
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/xml/XMLHttpRequest.cpp (205608 => 205609)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/xml/XMLHttpRequest.cpp 2016-09-08 09:04:02 UTC (rev 205608)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/xml/XMLHttpRequest.cpp 2016-09-08 09:05:55 UTC (rev 205609)
@@ -1006,7 +1006,10 @@
m_responseBuilder.shrinkToFit();
- InspectorInstrumentation::didFinishXHRLoading(scriptExecutionContext(), this, identifier, m_responseBuilder.toStringPreserveCapacity(), m_url, m_lastSendURL, m_lastSendLineNumber, m_lastSendColumnNumber);
+ Optional<String> decodedText;
+ if (!m_binaryResponseBuilder)
+ decodedText = m_responseBuilder.toStringPreserveCapacity();
+ InspectorInstrumentation::didFinishXHRLoading(scriptExecutionContext(), this, identifier, decodedText, m_url, m_lastSendURL, m_lastSendLineNumber, m_lastSendColumnNumber);
bool hadLoader = m_loader;
m_loader = nullptr;