Changeset 90340 in webkit
- Timestamp:
- Jul 3, 2011 8:58:38 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r90339 r90340 1 2011-07-03 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Reviewed by Alexey Proskuryakov. 4 5 Web Inspector: Preflight OPTIONS requests are not shown on network panel for asynchronous XHRs. 6 https://bugs.webkit.org/show_bug.cgi?id=63712 7 8 * http/tests/inspector/network-preflight-options-expected.txt: 9 * http/tests/inspector/network-preflight-options.html: 10 1 11 2011-07-03 Robert Hogan <robert@webkit.org> 2 12 -
trunk/LayoutTests/http/tests/inspector/network-preflight-options-expected.txt
r77379 r90340 1 CONSOLE MESSAGE: line 1: XMLHttpRequest cannot load http://localhost:8000/inspector/resources/cors-target.php?deny=yes. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. 2 CONSOLE MESSAGE: line 1: XMLHttpRequest cannot load http://localhost:8000/inspector/resources/cors-target.php?deny=yes. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. 1 3 CONSOLE MESSAGE: line 1: XMLHttpRequest cannot load http://localhost:8000/inspector/resources/cors-target.php?deny=yes. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. 2 4 CONSOLE MESSAGE: line 1: XMLHttpRequest cannot load http://localhost:8000/inspector/resources/cors-target.php?deny=yes. Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. … … 7 9 OPTIONS http://localhost:8000/inspector/resources/cors-target.php 8 10 POST http://localhost:8000/inspector/resources/cors-target.php 11 POST http://localhost:8000/inspector/resources/cors-target.php?deny=yes 12 OPTIONS http://localhost:8000/inspector/resources/cors-target.php?deny=yes 13 OPTIONS http://localhost:8000/inspector/resources/cors-target.php?async=yes 14 POST http://localhost:8000/inspector/resources/cors-target.php?async=yes 9 15 -
trunk/LayoutTests/http/tests/inspector/network-preflight-options.html
r82713 r90340 4 4 <script type="text/javascript"> 5 5 6 function sendXHR(url, forcePreflight )6 function sendXHR(url, forcePreflight, async) 7 7 { 8 8 var xhr = new XMLHttpRequest(); 9 xhr.open("POST", url, false);9 xhr.open("POST", url, async); 10 10 xhr.setRequestHeader("Content-Type", forcePreflight ? "application/xml" : "text/plain"); 11 11 try { … … 18 18 { 19 19 var targetURL = "http://localhost:8000/inspector/resources/cors-target.php"; 20 20 21 // Failed POSTs with no preflight check should result in a POST request being logged 21 sendXHR(targetURL + "?deny=yes", false );22 sendXHR(targetURL + "?deny=yes", false, false); 22 23 // Failed POSTs with preflight check should result in an OPTIONS request being logged 23 sendXHR(targetURL + "?deny=yes", true );24 sendXHR(targetURL + "?deny=yes", true, false); 24 25 // Successful POSTs with preflight check should result in an OPTIONS request followed by POST request being logged 25 // Generate request name based on timestamp to defeat caching (this is only relevant for repeated invocations of the test in signle instance of DRT) 26 sendXHR(targetURL + "?date=" + Date.now(), true); 26 // Generate request name based on timestamp to defeat OPTIONS request caching (this is only relevant for repeated invocations of the test in signle instance of DRT) 27 sendXHR(targetURL + "?date=" + Date.now(), true, false); 28 29 // And now send the same requests asynchronously 30 // Add redundant async parameter to ensure this request differs from the one above. 31 sendXHR(targetURL + "?deny=yes", false, true); 32 sendXHR(targetURL + "?deny=yes", true, true); 33 sendXHR(targetURL + "?async=yes&date=" + Date.now(), true, true); 27 34 } 28 35 29 36 var test = function() 30 37 { 38 var postRequestsCount = 0; 31 39 function onResource(event) 32 40 { 33 41 var resource = event.data; 34 42 InspectorTest.addResult(resource.requestMethod + " " + resource.url.replace(/[&?]date=\d+/, "")); 35 if (resource.requestMethod === "POST" && !/\?deny=yes/.test(resource.url))43 if (resource.requestMethod === "POST" && ++postRequestsCount == 4) 36 44 InspectorTest.completeTest(); 37 45 } -
trunk/Source/WebCore/ChangeLog
r90338 r90340 1 2011-07-03 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Reviewed by Alexey Proskuryakov. 4 5 Web Inspector: Preflight OPTIONS requests are not shown on network panel for asynchronous XHRs. 6 https://bugs.webkit.org/show_bug.cgi?id=63712 7 8 Added InspectorInstrumentation calls to preflight OPTIONS requests callbacks in DocumentThreadableLoader. 9 10 * loader/DocumentThreadableLoader.cpp: 11 (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): 12 (WebCore::DocumentThreadableLoader::didReceiveResponse): 13 (WebCore::DocumentThreadableLoader::didReceiveData): 14 (WebCore::DocumentThreadableLoader::didFinishLoading): 15 (WebCore::DocumentThreadableLoader::didFail): 16 (WebCore::DocumentThreadableLoader::loadRequest): 17 * loader/DocumentThreadableLoader.h: 18 1 19 2011-06-23 Robert Hogan <robert@webkit.org> 2 20 -
trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp
r89086 r90340 47 47 #include <wtf/UnusedParam.h> 48 48 49 #if ENABLE(INSPECTOR) 50 #include "InspectorInstrumentation.h" 51 #include "ProgressTracker.h" 52 #endif 53 49 54 namespace WebCore { 50 55 … … 70 75 , m_sameOriginRequest(securityOrigin()->canRequest(request.url())) 71 76 , m_async(blockingBehavior == LoadAsynchronously) 77 #if ENABLE(INSPECTOR) 78 , m_preflightRequestIdentifier(0) 79 #endif 72 80 { 73 81 ASSERT(document); … … 178 186 { 179 187 ASSERT(m_client); 188 189 #if ENABLE(INSPECTOR) 190 if (m_preflightRequestIdentifier) { 191 DocumentLoader* loader = m_document->frame()->loader()->documentLoader(); 192 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willReceiveResourceResponse(m_document->frame(), m_preflightRequestIdentifier, response); 193 InspectorInstrumentation::didReceiveResourceResponse(cookie, m_preflightRequestIdentifier, loader, response); 194 } 195 #endif 180 196 181 197 String accessControlErrorDescription; … … 212 228 ASSERT_UNUSED(loader, loader == m_loader); 213 229 230 #if ENABLE(INSPECTOR) 231 if (m_preflightRequestIdentifier) 232 InspectorInstrumentation::didReceiveContentLength(m_document->frame(), m_preflightRequestIdentifier, 0, dataLength); 233 #endif 234 214 235 // Preflight data should be invisible to clients. 215 236 if (m_actualRequest) … … 240 261 void DocumentThreadableLoader::didFinishLoading(unsigned long identifier, double finishTime) 241 262 { 263 #if ENABLE(INSPECTOR) 264 if (m_preflightRequestIdentifier) 265 InspectorInstrumentation::didFinishLoading(m_document->frame(), m_document->frame()->loader()->documentLoader(), m_preflightRequestIdentifier, finishTime); 266 #endif 267 242 268 if (m_actualRequest) { 243 269 ASSERT(!m_sameOriginRequest); … … 253 279 // m_loader may be null if we arrive here via SubresourceLoader::create in the ctor 254 280 ASSERT_UNUSED(loader, loader == m_loader || !m_loader); 281 282 #if ENABLE(INSPECTOR) 283 if (m_preflightRequestIdentifier) 284 InspectorInstrumentation::didFailLoading(m_document->frame(), m_document->frame()->loader()->documentLoader(), m_preflightRequestIdentifier, error); 285 #endif 255 286 256 287 m_client->didFail(error); … … 324 355 bool shouldBufferData = m_options.shouldBufferData || m_actualRequest; 325 356 357 #if ENABLE(INSPECTOR) 358 if (m_actualRequest) { 359 ResourceRequest newRequest(request); 360 // Because willSendRequest only gets called during redirects, we initialize the identifier and the first willSendRequest here. 361 m_preflightRequestIdentifier = m_document->frame()->page()->progress()->createUniqueIdentifier(); 362 ResourceResponse redirectResponse = ResourceResponse(); 363 InspectorInstrumentation::willSendRequest(m_document->frame(), m_preflightRequestIdentifier, m_document->frame()->loader()->documentLoader(), newRequest, redirectResponse); 364 } 365 #endif 366 326 367 // Clear the loader so that any callbacks from SubresourceLoader::create will not have the old loader. 327 368 m_loader = 0; -
trunk/Source/WebCore/loader/DocumentThreadableLoader.h
r89086 r90340 106 106 bool m_async; 107 107 OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Control preflight checks 108 109 #if ENABLE(INSPECTOR) 110 unsigned long m_preflightRequestIdentifier; 111 #endif 108 112 }; 109 113
Note: See TracChangeset
for help on using the changeset viewer.