Changeset 125681 in webkit
- Timestamp:
- Aug 15, 2012 9:50:13 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r125670 r125681 1 2012-08-15 Pavel Chadnov <chadnov@google.com> 2 3 Web Inspector: Incorrect XHR responses when two async xhrs are sent synchronously 4 https://bugs.webkit.org/show_bug.cgi?id=91630 5 6 Reviewed by Vsevolod Vlasov. 7 8 New test for two async XHRs sent synchronously. 9 10 * http/tests/inspector/network-test.js: 11 (doXHR): 12 (doXHRWithPayload.xhr.onreadystatechange): 13 (doXHRWithPayload): 14 * http/tests/inspector/network/network-xhr-async-double-expected.txt: Added. 15 * http/tests/inspector/network/network-xhr-async-double.html: Added. 16 * http/tests/inspector/network/resources/echo-payload.php: Added. 17 * platform/chromium/http/tests/inspector/console-xhr-logging-async-expected.txt: 18 * platform/chromium/http/tests/inspector/console-xhr-logging-expected.txt: 19 1 20 2012-08-15 Christophe Dumez <christophe.dumez@intel.com> 2 21 -
trunk/LayoutTests/http/tests/inspector/network-test.js
r113863 r125681 28 28 function doXHR(method, url, async, callback) 29 29 { 30 doXHRWithPayload(method, url, async, null, callback); 31 } 32 33 function doXHRWithPayload(method, url, async, payload, callback) 34 { 30 35 var xhr = new XMLHttpRequest(); 31 36 xhr.onreadystatechange = function() … … 35 40 callback(); 36 41 } 37 } ;42 } 38 43 xhr.open(method, url, async); 39 xhr.send( null);44 xhr.send(payload); 40 45 } 41 46 -
trunk/LayoutTests/platform/chromium/http/tests/inspector/console-xhr-logging-async-expected.txt
r121871 r125681 4 4 5 5 Bug 79229 6 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". network-test.js: 396 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". network-test.js:44 7 7 Done. console-xhr-logging-async.html:14 8 8 -
trunk/LayoutTests/platform/chromium/http/tests/inspector/console-xhr-logging-expected.txt
r110693 r125681 12 12 13 13 sending a GET request to resources/xhr-exists.html console-xhr-logging.html:10 14 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". network-test.js: 3914 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-exists.html". network-test.js:44 15 15 sending a GET request to resources/xhr-does-not-exist.html console-xhr-logging.html:10 16 GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) network-test.js: 3917 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html". network-test.js: 3916 GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) network-test.js:44 17 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html". network-test.js:44 18 18 sending a POST request to resources/post-target.cgi console-xhr-logging.html:10 19 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/post-target.cgi". network-test.js: 3919 XHR finished loading: "http://127.0.0.1:8000/inspector/resources/post-target.cgi". network-test.js:44 20 20 sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html console-xhr-logging.html:10 21 21 XMLHttpRequest cannot load http://localhost:8000/inspector/resources/xhr-exists.html. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. 22 22 sending a GET request to resources/xhr-exists.html console-xhr-logging.html:10 23 23 sending a GET request to resources/xhr-does-not-exist.html console-xhr-logging.html:10 24 GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) network-test.js: 3924 GET http://127.0.0.1:8000/inspector/resources/xhr-does-not-exist.html 404 (Not Found) network-test.js:44 25 25 sending a POST request to resources/post-target.cgi console-xhr-logging.html:10 26 26 sending a GET request to http://localhost:8000/inspector/resources/xhr-exists.html console-xhr-logging.html:10 -
trunk/Source/WebCore/ChangeLog
r125677 r125681 1 2012-08-15 Pavel Chadnov <chadnov@google.com> 2 3 Web Inspector: Incorrect XHR responses when two async xhrs are sent synchronously 4 https://bugs.webkit.org/show_bug.cgi?id=91630 5 6 Reviewed by Vsevolod Vlasov. 7 8 CachedResource object for XHR response is now taken from ResourceLoader (if it's possible). 9 10 Test: http/tests/inspector/network/network-xhr-async-double.html 11 12 * inspector/InspectorInstrumentation.cpp: 13 (WebCore): 14 (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl): 15 (WebCore::InspectorInstrumentation::didReceiveResourceResponseButCanceledImpl): 16 * inspector/InspectorInstrumentation.h: 17 (InspectorInstrumentation): 18 (WebCore::InspectorInstrumentation::didReceiveResourceResponse): 19 * inspector/InspectorResourceAgent.cpp: 20 (WebCore::InspectorResourceAgent::willSendRequest): 21 (WebCore::InspectorResourceAgent::didReceiveResponse): 22 * inspector/InspectorResourceAgent.h: 23 (WebCore): 24 (InspectorResourceAgent): 25 * loader/DocumentThreadableLoader.cpp: 26 (WebCore::DocumentThreadableLoader::didReceiveResponse): 27 * loader/ResourceLoadNotifier.cpp: 28 (WebCore::ResourceLoadNotifier::didReceiveResponse): 29 (WebCore::ResourceLoadNotifier::dispatchDidReceiveResponse): 30 * loader/ResourceLoadNotifier.h: 31 (ResourceLoadNotifier): 32 * loader/ResourceLoader.cpp: 33 (WebCore::ResourceLoader::isSubresourceLoader): 34 (WebCore): 35 * loader/ResourceLoader.h: 36 (ResourceLoader): 37 * loader/SubresourceLoader.cpp: 38 (WebCore::SubresourceLoader::cachedResource): 39 (WebCore): 40 (WebCore::SubresourceLoader::isSubresourceLoader): 41 * loader/SubresourceLoader.h: 42 (SubresourceLoader): 43 * loader/appcache/ApplicationCacheGroup.cpp: 44 (WebCore::ApplicationCacheGroup::didReceiveResponse): 45 1 46 2012-08-15 Taiju Tsuiki <tzik@chromium.org> 2 47 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r125277 r125681 675 675 } 676 676 677 void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response )677 void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader) 678 678 { 679 679 if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie)) … … 685 685 return; 686 686 if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent()) 687 resourceAgent->didReceiveResponse(identifier, loader, response );687 resourceAgent->didReceiveResponse(identifier, loader, response, resourceLoader); 688 688 if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent()) 689 689 consoleAgent->didReceiveResponse(identifier, response); // This should come AFTER resource notification, front-end relies on this. … … 693 693 { 694 694 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(frame, identifier, r); 695 InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, r );695 InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, r, 0); 696 696 } 697 697 -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r125277 r125681 173 173 static void didReceiveResourceData(const InspectorInstrumentationCookie&); 174 174 static InspectorInstrumentationCookie willReceiveResourceResponse(Frame*, unsigned long identifier, const ResourceResponse&); 175 static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse& );175 static void didReceiveResourceResponse(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); 176 176 static void continueAfterXFrameOptionsDenied(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); 177 177 static void continueWithPolicyDownload(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); … … 352 352 static void didReceiveResourceDataImpl(const InspectorInstrumentationCookie&); 353 353 static InspectorInstrumentationCookie willReceiveResourceResponseImpl(InstrumentingAgents*, unsigned long identifier, const ResourceResponse&, Frame*); 354 static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse& );354 static void didReceiveResourceResponseImpl(const InspectorInstrumentationCookie&, unsigned long identifier, DocumentLoader*, const ResourceResponse&, ResourceLoader*); 355 355 static void didReceiveResourceResponseButCanceledImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); 356 356 static void continueAfterXFrameOptionsDeniedImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&); … … 1083 1083 } 1084 1084 1085 inline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response )1085 inline void InspectorInstrumentation::didReceiveResourceResponse(const InspectorInstrumentationCookie& cookie, unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader) 1086 1086 { 1087 1087 #if ENABLE(INSPECTOR) 1088 1088 // Call this unconditionally so that we're able to log to console with no front-end attached. 1089 didReceiveResourceResponseImpl(cookie, identifier, loader, response );1089 didReceiveResourceResponseImpl(cookie, identifier, loader, response, resourceLoader); 1090 1090 #endif 1091 1091 } -
trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp
r124032 r125681 55 55 #include "ProgressTracker.h" 56 56 #include "ResourceError.h" 57 #include "ResourceLoader.h" 57 58 #include "ResourceRequest.h" 58 59 #include "ResourceResponse.h" … … 60 61 #include "ScriptCallStackFactory.h" 61 62 #include "ScriptableDocumentParser.h" 63 #include "SubresourceLoader.h" 62 64 #include "WebSocketFrame.h" 63 65 #include "WebSocketHandshakeRequest.h" … … 222 224 223 225 if (m_state->getBoolean(ResourceAgentState::cacheDisabled)) { 226 request.setHTTPHeaderField("Pragma", "no-cache"); 224 227 request.setCachePolicy(ReloadIgnoringCacheData); 225 request.setHTTPHeaderField("Pragma", "no-cache");226 228 request.setHTTPHeaderField("Cache-Control", "no-cache"); 227 229 } … … 236 238 } 237 239 238 void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response )240 void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, ResourceLoader* resourceLoader) 239 241 { 240 242 String requestId = IdentifiersFactory::requestId(identifier); … … 243 245 long cachedResourceSize = 0; 244 246 247 bool isNotModified = response.httpStatusCode() == 304; 245 248 if (loader) { 246 CachedResource* cachedResource = InspectorPageAgent::cachedResource(loader->frame(), response.url()); 249 CachedResource* cachedResource = 0; 250 if (resourceLoader && resourceLoader->isSubresourceLoader() && !isNotModified) 251 cachedResource = static_cast<SubresourceLoader*>(resourceLoader)->cachedResource(); 252 if (!cachedResource) 253 cachedResource = InspectorPageAgent::cachedResource(loader->frame(), response.url()); 247 254 if (cachedResource) { 248 255 type = InspectorPageAgent::cachedResourceType(*cachedResource); … … 269 276 // If we revalidated the resource and got Not modified, send content length following didReceiveResponse 270 277 // as there will be no calls to didReceiveData from the network stack. 271 if (cachedResourceSize && response.httpStatusCode() == 304)278 if (cachedResourceSize && isNotModified) 272 279 didReceiveData(identifier, 0, cachedResourceSize, 0); 273 280 } -
trunk/Source/WebCore/inspector/InspectorResourceAgent.h
r125249 r125681 63 63 class Page; 64 64 class ResourceError; 65 class ResourceLoader; 65 66 class ResourceRequest; 66 67 class ResourceResponse; … … 92 93 void willSendRequest(unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse); 93 94 void markResourceAsCached(unsigned long identifier); 94 void didReceiveResponse(unsigned long identifier, DocumentLoader* laoder, const ResourceResponse& );95 void didReceiveResponse(unsigned long identifier, DocumentLoader* laoder, const ResourceResponse&, ResourceLoader*); 95 96 void didReceiveData(unsigned long identifier, const char* data, int dataLength, int encodedDataLength); 96 97 void didFinishLoading(unsigned long identifier, DocumentLoader*, double finishTime); -
trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp
r121803 r125681 250 250 DocumentLoader* loader = m_document->frame()->loader()->documentLoader(); 251 251 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_document->frame(), m_preflightRequestIdentifier, response); 252 InspectorInstrumentation::didReceiveResourceResponse(cookie, m_preflightRequestIdentifier, loader, response );252 InspectorInstrumentation::didReceiveResourceResponse(cookie, m_preflightRequestIdentifier, loader, response, 0); 253 253 } 254 254 #endif -
trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp
r111361 r125681 72 72 page->progress()->incrementProgress(loader->identifier(), r); 73 73 74 dispatchDidReceiveResponse(loader->documentLoader(), loader->identifier(), r );74 dispatchDidReceiveResponse(loader->documentLoader(), loader->identifier(), r, loader); 75 75 } 76 76 … … 124 124 } 125 125 126 void ResourceLoadNotifier::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r )126 void ResourceLoadNotifier::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long identifier, const ResourceResponse& r, ResourceLoader* resourceLoader) 127 127 { 128 128 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_frame, identifier, r); 129 129 m_frame->loader()->client()->dispatchDidReceiveResponse(loader, identifier, r); 130 InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, r );130 InspectorInstrumentation::didReceiveResourceResponse(cookie, identifier, loader, r, resourceLoader); 131 131 } 132 132 -
trunk/Source/WebCore/loader/ResourceLoadNotifier.h
r111361 r125681 60 60 void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&); 61 61 void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse); 62 void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse& );62 void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&, ResourceLoader* = 0); 63 63 void dispatchDidReceiveData(DocumentLoader*, unsigned long identifier, const char* data, int dataLength, int encodedDataLength); 64 64 void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier, double finishTime); -
trunk/Source/WebCore/loader/ResourceLoader.cpp
r124884 r125681 215 215 } 216 216 217 bool ResourceLoader::isSubresourceLoader() 218 { 219 return false; 220 } 221 217 222 void ResourceLoader::willSendRequest(ResourceRequest& request, const ResourceResponse& redirectResponse) 218 223 { -
trunk/Source/WebCore/loader/ResourceLoader.h
r122920 r125681 76 76 virtual PassRefPtr<SharedBuffer> resourceData(); 77 77 void clearResourceData(); 78 virtual bool isSubresourceLoader(); 78 79 79 80 virtual void willSendRequest(ResourceRequest&, const ResourceResponse& redirectResponse); -
trunk/Source/WebCore/loader/SubresourceLoader.cpp
r125265 r125681 123 123 } 124 124 125 CachedResource* SubresourceLoader::cachedResource() 126 { 127 return m_resource; 128 } 129 125 130 void SubresourceLoader::cancelIfNotFinishing() 126 131 { … … 148 153 m_state = Initialized; 149 154 m_documentLoader->addSubresourceLoader(this); 155 return true; 156 } 157 158 bool SubresourceLoader::isSubresourceLoader() 159 { 150 160 return true; 151 161 } -
trunk/Source/WebCore/loader/SubresourceLoader.h
r125265 r125681 47 47 48 48 void cancelIfNotFinishing(); 49 virtual bool isSubresourceLoader(); 50 CachedResource* cachedResource(); 49 51 50 52 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; -
trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
r125615 r125681 525 525 DocumentLoader* loader = (handle == m_manifestHandle) ? 0 : m_frame->loader()->documentLoader(); 526 526 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_frame, m_currentResourceIdentifier, response); 527 InspectorInstrumentation::didReceiveResourceResponse(cookie, m_currentResourceIdentifier, loader, response );527 InspectorInstrumentation::didReceiveResourceResponse(cookie, m_currentResourceIdentifier, loader, response, 0); 528 528 #endif 529 529
Note: See TracChangeset
for help on using the changeset viewer.