OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 { | 339 { |
340 // Any credential should have been removed from the cross-site requests. | 340 // Any credential should have been removed from the cross-site requests. |
341 const KURL& requestURL = request.url(); | 341 const KURL& requestURL = request.url(); |
342 ASSERT(m_sameOriginRequest || requestURL.user().isEmpty()); | 342 ASSERT(m_sameOriginRequest || requestURL.user().isEmpty()); |
343 ASSERT(m_sameOriginRequest || requestURL.pass().isEmpty()); | 343 ASSERT(m_sameOriginRequest || requestURL.pass().isEmpty()); |
344 | 344 |
345 if (m_async) { | 345 if (m_async) { |
346 // Don't sniff content or send load callbacks for the preflight request. | 346 // Don't sniff content or send load callbacks for the preflight request. |
347 bool sendLoadCallbacks = m_options.sendLoadCallbacks && !m_actualRequest
; | 347 bool sendLoadCallbacks = m_options.sendLoadCallbacks && !m_actualRequest
; |
348 bool sniffContent = m_options.sniffContent && !m_actualRequest; | 348 bool sniffContent = m_options.sniffContent && !m_actualRequest; |
| 349 // Keep buffering the data for the preflight request. |
| 350 bool shouldBufferData = m_options.shouldBufferData || m_actualRequest; |
349 | 351 |
350 // Clear the loader so that any callbacks from SubresourceLoader::create
will not have the old loader. | 352 // Clear the loader so that any callbacks from SubresourceLoader::create
will not have the old loader. |
351 m_loader = 0; | 353 m_loader = 0; |
352 m_loader = resourceLoadScheduler()->scheduleSubresourceLoad(m_document->
frame(), this, request, ResourceLoadPriorityMedium, securityCheck, sendLoadCallb
acks, | 354 m_loader = resourceLoadScheduler()->scheduleSubresourceLoad(m_document->
frame(), this, request, ResourceLoadPriorityMedium, securityCheck, sendLoadCallb
acks, |
353 sniffContent
, m_optionalOutgoingReferrer); | 355 sniffContent
, m_optionalOutgoingReferrer, shouldBufferData); |
354 return; | 356 return; |
355 } | 357 } |
356 | 358 |
357 // FIXME: ThreadableLoaderOptions.sniffContent is not supported for synchron
ous requests. | 359 // FIXME: ThreadableLoaderOptions.sniffContent is not supported for synchron
ous requests. |
358 StoredCredentials storedCredentials = m_options.allowCredentials ? AllowStor
edCredentials : DoNotAllowStoredCredentials; | 360 StoredCredentials storedCredentials = m_options.allowCredentials ? AllowStor
edCredentials : DoNotAllowStoredCredentials; |
359 | 361 |
360 Vector<char> data; | 362 Vector<char> data; |
361 ResourceError error; | 363 ResourceError error; |
362 ResourceResponse response; | 364 ResourceResponse response; |
363 unsigned long identifier = std::numeric_limits<unsigned long>::max(); | 365 unsigned long identifier = std::numeric_limits<unsigned long>::max(); |
(...skipping 29 matching lines...) Expand all Loading... |
393 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) | 395 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) |
394 return true; | 396 return true; |
395 | 397 |
396 // FIXME: We need to implement access control for each redirect. This will r
equire some refactoring though, because the code | 398 // FIXME: We need to implement access control for each redirect. This will r
equire some refactoring though, because the code |
397 // that processes redirects doesn't know about access control and expects a
synchronous answer from its client about whether | 399 // that processes redirects doesn't know about access control and expects a
synchronous answer from its client about whether |
398 // a redirect should proceed. | 400 // a redirect should proceed. |
399 return m_sameOriginRequest && m_document->securityOrigin()->canRequest(url); | 401 return m_sameOriginRequest && m_document->securityOrigin()->canRequest(url); |
400 } | 402 } |
401 | 403 |
402 } // namespace WebCore | 404 } // namespace WebCore |
OLD | NEW |