OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 // If the document specified an application cache manifest, it violates the
author's intent if we store it in the memory cache | 318 // If the document specified an application cache manifest, it violates the
author's intent if we store it in the memory cache |
319 // and deny the appcache the chance to intercept it in the future, so remove
from the memory cache. | 319 // and deny the appcache the chance to intercept it in the future, so remove
from the memory cache. |
320 if (m_frame) { | 320 if (m_frame) { |
321 if (m_mainResource && m_frame->document()->hasManifest()) | 321 if (m_mainResource && m_frame->document()->hasManifest()) |
322 memoryCache()->remove(m_mainResource.get()); | 322 memoryCache()->remove(m_mainResource.get()); |
323 } | 323 } |
324 m_applicationCacheHost->finishedLoadingMainResource(); | 324 m_applicationCacheHost->finishedLoadingMainResource(); |
325 clearMainResourceHandle(); | 325 clearMainResourceHandle(); |
326 } | 326 } |
327 | 327 |
328 bool DocumentLoader::isPostOrRedirectAfterPost(const ResourceRequest& newRequest
, const ResourceResponse& redirectResponse) | 328 bool DocumentLoader::isRedirectAfterPost(const ResourceRequest& newRequest, cons
t ResourceResponse& redirectResponse) |
329 { | 329 { |
330 if (newRequest.httpMethod() == "POST") | |
331 return true; | |
332 | |
333 int status = redirectResponse.httpStatusCode(); | 330 int status = redirectResponse.httpStatusCode(); |
334 if (((status >= 301 && status <= 303) || status == 307) | 331 if (((status >= 301 && status <= 303) || status == 307) |
335 && m_originalRequest.httpMethod() == "POST") | 332 && m_originalRequest.httpMethod() == "POST") |
336 return true; | 333 return true; |
337 | 334 |
338 return false; | 335 return false; |
339 } | 336 } |
340 | 337 |
341 void DocumentLoader::handleSubstituteDataLoadNow(DocumentLoaderTimer*) | 338 void DocumentLoader::handleSubstituteDataLoadNow(DocumentLoaderTimer*) |
342 { | 339 { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 } | 425 } |
429 | 426 |
430 // Update cookie policy base URL as URL changes, except for subframes, which
use the | 427 // Update cookie policy base URL as URL changes, except for subframes, which
use the |
431 // URL of the main frame which doesn't change when we redirect. | 428 // URL of the main frame which doesn't change when we redirect. |
432 if (frameLoader()->isLoadingMainFrame()) | 429 if (frameLoader()->isLoadingMainFrame()) |
433 newRequest.setFirstPartyForCookies(newRequest.url()); | 430 newRequest.setFirstPartyForCookies(newRequest.url()); |
434 | 431 |
435 // If we're fielding a redirect in response to a POST, force a load from ori
gin, since | 432 // If we're fielding a redirect in response to a POST, force a load from ori
gin, since |
436 // this is a common site technique to return to a page viewing some data tha
t the POST | 433 // this is a common site technique to return to a page viewing some data tha
t the POST |
437 // just modified. | 434 // just modified. |
438 // Also, POST requests always load from origin, but this does not affect sub
resources. | 435 if (newRequest.cachePolicy() == UseProtocolCachePolicy && isRedirectAfterPos
t(newRequest, redirectResponse)) |
439 if (newRequest.cachePolicy() == UseProtocolCachePolicy && isPostOrRedirectAf
terPost(newRequest, redirectResponse)) | |
440 newRequest.setCachePolicy(ReloadIgnoringCacheData); | 436 newRequest.setCachePolicy(ReloadIgnoringCacheData); |
441 | 437 |
442 Frame* parent = m_frame->tree()->parent(); | 438 Frame* parent = m_frame->tree()->parent(); |
443 if (parent) { | 439 if (parent) { |
444 if (!parent->loader()->mixedContentChecker()->canRunInsecureContent(pare
nt->document()->securityOrigin(), newRequest.url())) { | 440 if (!parent->loader()->mixedContentChecker()->canRunInsecureContent(pare
nt->document()->securityOrigin(), newRequest.url())) { |
445 cancelMainResourceLoad(ResourceError::cancelledError(newRequest.url(
))); | 441 cancelMainResourceLoad(ResourceError::cancelledError(newRequest.url(
))); |
446 return; | 442 return; |
447 } | 443 } |
448 } | 444 } |
449 | 445 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 946 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
951 { | 947 { |
952 m_frame->loader()->stopAllLoaders(); | 948 m_frame->loader()->stopAllLoaders(); |
953 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : "", m_writer ? m_writer->encod
ingWasChosenByUser() : false, true); | 949 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : "", m_writer ? m_writer->encod
ingWasChosenByUser() : false, true); |
954 if (!source.isNull()) | 950 if (!source.isNull()) |
955 m_writer->appendReplacingData(source); | 951 m_writer->appendReplacingData(source); |
956 endWriting(m_writer.get()); | 952 endWriting(m_writer.get()); |
957 } | 953 } |
958 | 954 |
959 } // namespace WebCore | 955 } // namespace WebCore |
OLD | NEW |