| 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 16 matching lines...) Expand all Loading... |
| 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "DocumentLoader.h" | 31 #include "DocumentLoader.h" |
| 32 | 32 |
| 33 #include "ApplicationCacheHost.h" | 33 #include "ApplicationCacheHost.h" |
| 34 #include "ArchiveResourceCollection.h" | 34 #include "ArchiveResourceCollection.h" |
| 35 #include "CachedPage.h" | 35 #include "CachedPage.h" |
| 36 #include "CachedResourceLoader.h" | 36 #include "CachedResourceLoader.h" |
| 37 #include "CancelledResourceError.h" |
| 37 #include "DOMWindow.h" | 38 #include "DOMWindow.h" |
| 38 #include "Document.h" | 39 #include "Document.h" |
| 39 #include "DocumentParser.h" | 40 #include "DocumentParser.h" |
| 40 #include "DocumentWriter.h" | 41 #include "DocumentWriter.h" |
| 41 #include "Event.h" | 42 #include "Event.h" |
| 42 #include "FormState.h" | 43 #include "FormState.h" |
| 43 #include "Frame.h" | 44 #include "Frame.h" |
| 44 #include "FrameLoader.h" | 45 #include "FrameLoader.h" |
| 45 #include "FrameLoaderClient.h" | 46 #include "FrameLoaderClient.h" |
| 46 #include "FrameTree.h" | 47 #include "FrameTree.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 return; | 270 return; |
| 270 } | 271 } |
| 271 | 272 |
| 272 // We might run in to infinite recursion if we're stopping loading as the re
sult of | 273 // We might run in to infinite recursion if we're stopping loading as the re
sult of |
| 273 // detaching from the frame, so break out of that recursion here. | 274 // detaching from the frame, so break out of that recursion here. |
| 274 // See <rdar://problem/9673866> for more details. | 275 // See <rdar://problem/9673866> for more details. |
| 275 if (m_isStopping) | 276 if (m_isStopping) |
| 276 return; | 277 return; |
| 277 | 278 |
| 278 m_isStopping = true; | 279 m_isStopping = true; |
| 279 | |
| 280 FrameLoader* frameLoader = DocumentLoader::frameLoader(); | |
| 281 | 280 |
| 282 if (isLoadingMainResource()) | 281 if (isLoadingMainResource()) |
| 283 // Stop the main resource loader and let it send the cancelled message. | 282 // Stop the main resource loader and let it send the cancelled message. |
| 284 cancelMainResourceLoad(frameLoader->cancelledError(m_request)); | 283 cancelMainResourceLoad(CancelledResourceError(m_request.url())); |
| 285 else if (!m_resourceLoaders.isEmpty()) | 284 else if (!m_resourceLoaders.isEmpty()) |
| 286 // The main resource loader already finished loading. Set the cancelled
error on the | 285 // The main resource loader already finished loading. Set the cancelled
error on the |
| 287 // document and let the resourceLoaders send individual cancelled messag
es below. | 286 // document and let the resourceLoaders send individual cancelled messag
es below. |
| 288 setMainDocumentError(frameLoader->cancelledError(m_request)); | 287 setMainDocumentError(CancelledResourceError(m_request.url())); |
| 289 else | 288 else |
| 290 // If there are no resource loaders, we need to manufacture a cancelled
message. | 289 // If there are no resource loaders, we need to manufacture a cancelled
message. |
| 291 // (A back/forward navigation has no resource loaders because its resour
ces are cached.) | 290 // (A back/forward navigation has no resource loaders because its resour
ces are cached.) |
| 292 mainReceivedError(frameLoader->cancelledError(m_request)); | 291 mainReceivedError(CancelledResourceError(m_request.url())); |
| 293 | 292 |
| 294 stopLoadingSubresources(); | 293 stopLoadingSubresources(); |
| 295 | 294 |
| 296 m_isStopping = false; | 295 m_isStopping = false; |
| 297 } | 296 } |
| 298 | 297 |
| 299 void DocumentLoader::commitIfReady() | 298 void DocumentLoader::commitIfReady() |
| 300 { | 299 { |
| 301 if (!m_committed) { | 300 if (!m_committed) { |
| 302 m_committed = true; | 301 m_committed = true; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 418 |
| 420 void DocumentLoader::willSendRequest(ResourceRequest& newRequest, const Resource
Response& redirectResponse) | 419 void DocumentLoader::willSendRequest(ResourceRequest& newRequest, const Resource
Response& redirectResponse) |
| 421 { | 420 { |
| 422 // Note that there are no asserts here as there are for the other callbacks.
This is due to the | 421 // Note that there are no asserts here as there are for the other callbacks.
This is due to the |
| 423 // fact that this "callback" is sent when starting every load, and the state
of callback | 422 // fact that this "callback" is sent when starting every load, and the state
of callback |
| 424 // deferrals plays less of a part in this function in preventing the bad beh
avior deferring | 423 // deferrals plays less of a part in this function in preventing the bad beh
avior deferring |
| 425 // callbacks is meant to prevent. | 424 // callbacks is meant to prevent. |
| 426 ASSERT(!newRequest.isNull()); | 425 ASSERT(!newRequest.isNull()); |
| 427 | 426 |
| 428 if (!frameLoader()->checkIfFormActionAllowedByCSP(newRequest.url())) { | 427 if (!frameLoader()->checkIfFormActionAllowedByCSP(newRequest.url())) { |
| 429 cancelMainResourceLoad(frameLoader()->cancelledError(newRequest)); | 428 cancelMainResourceLoad(CancelledResourceError(newRequest.url())); |
| 430 return; | 429 return; |
| 431 } | 430 } |
| 432 | 431 |
| 433 ASSERT(timing()->fetchStart()); | 432 ASSERT(timing()->fetchStart()); |
| 434 if (!redirectResponse.isNull()) { | 433 if (!redirectResponse.isNull()) { |
| 435 // If the redirecting url is not allowed to display content from the tar
get origin, | 434 // If the redirecting url is not allowed to display content from the tar
get origin, |
| 436 // then block the redirect. | 435 // then block the redirect. |
| 437 RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redire
ctResponse.url()); | 436 RefPtr<SecurityOrigin> redirectingOrigin = SecurityOrigin::create(redire
ctResponse.url()); |
| 438 if (!redirectingOrigin->canDisplay(newRequest.url())) { | 437 if (!redirectingOrigin->canDisplay(newRequest.url())) { |
| 439 FrameLoader::reportLocalLoadFailed(m_frame, newRequest.url().string(
)); | 438 FrameLoader::reportLocalLoadFailed(m_frame, newRequest.url().string(
)); |
| 440 cancelMainResourceLoad(frameLoader()->cancelledError(newRequest)); | 439 cancelMainResourceLoad(CancelledResourceError(newRequest.url())); |
| 441 return; | 440 return; |
| 442 } | 441 } |
| 443 timing()->addRedirect(redirectResponse.url(), newRequest.url()); | 442 timing()->addRedirect(redirectResponse.url(), newRequest.url()); |
| 444 } | 443 } |
| 445 | 444 |
| 446 // Update cookie policy base URL as URL changes, except for subframes, which
use the | 445 // Update cookie policy base URL as URL changes, except for subframes, which
use the |
| 447 // URL of the main frame which doesn't change when we redirect. | 446 // URL of the main frame which doesn't change when we redirect. |
| 448 if (frameLoader()->isLoadingMainFrame()) | 447 if (frameLoader()->isLoadingMainFrame()) |
| 449 newRequest.setFirstPartyForCookies(newRequest.url()); | 448 newRequest.setFirstPartyForCookies(newRequest.url()); |
| 450 | 449 |
| 451 // If we're fielding a redirect in response to a POST, force a load from ori
gin, since | 450 // If we're fielding a redirect in response to a POST, force a load from ori
gin, since |
| 452 // this is a common site technique to return to a page viewing some data tha
t the POST | 451 // this is a common site technique to return to a page viewing some data tha
t the POST |
| 453 // just modified. | 452 // just modified. |
| 454 // Also, POST requests always load from origin, but this does not affect sub
resources. | 453 // Also, POST requests always load from origin, but this does not affect sub
resources. |
| 455 if (newRequest.cachePolicy() == UseProtocolCachePolicy && isPostOrRedirectAf
terPost(newRequest, redirectResponse)) | 454 if (newRequest.cachePolicy() == UseProtocolCachePolicy && isPostOrRedirectAf
terPost(newRequest, redirectResponse)) |
| 456 newRequest.setCachePolicy(ReloadIgnoringCacheData); | 455 newRequest.setCachePolicy(ReloadIgnoringCacheData); |
| 457 | 456 |
| 458 Frame* top = m_frame->tree()->top(); | 457 Frame* top = m_frame->tree()->top(); |
| 459 if (top != m_frame) { | 458 if (top != m_frame) { |
| 460 if (!frameLoader()->mixedContentChecker()->canDisplayInsecureContent(top
->document()->securityOrigin(), newRequest.url())) { | 459 if (!frameLoader()->mixedContentChecker()->canDisplayInsecureContent(top
->document()->securityOrigin(), newRequest.url())) { |
| 461 cancelMainResourceLoad(frameLoader()->cancelledError(newRequest)); | 460 cancelMainResourceLoad(CancelledResourceError(newRequest.url())); |
| 462 return; | 461 return; |
| 463 } | 462 } |
| 464 } | 463 } |
| 465 | 464 |
| 466 setRequest(newRequest); | 465 setRequest(newRequest); |
| 467 | 466 |
| 468 if (!redirectResponse.isNull()) { | 467 if (!redirectResponse.isNull()) { |
| 469 // We checked application cache for initial URL, now we need to check it
for redirected one. | 468 // We checked application cache for initial URL, now we need to check it
for redirected one. |
| 470 ASSERT(!m_substituteData.isValid()); | 469 ASSERT(!m_substituteData.isValid()); |
| 471 m_applicationCacheHost->maybeLoadMainResourceForRedirect(newRequest, m_s
ubstituteData); | 470 m_applicationCacheHost->maybeLoadMainResourceForRedirect(newRequest, m_s
ubstituteData); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 ASSERT(m_mainResource); | 531 ASSERT(m_mainResource); |
| 533 unsigned long identifier = m_identifierForLoadWithoutResourceLoader ? m_
identifierForLoadWithoutResourceLoader : m_mainResource->identifier(); | 532 unsigned long identifier = m_identifierForLoadWithoutResourceLoader ? m_
identifierForLoadWithoutResourceLoader : m_mainResource->identifier(); |
| 534 ASSERT(identifier); | 533 ASSERT(identifier); |
| 535 if (frameLoader()->shouldInterruptLoadForXFrameOptions(content, response
.url(), identifier)) { | 534 if (frameLoader()->shouldInterruptLoadForXFrameOptions(content, response
.url(), identifier)) { |
| 536 InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame,
this, identifier, response); | 535 InspectorInstrumentation::continueAfterXFrameOptionsDenied(m_frame,
this, identifier, response); |
| 537 String message = "Refused to display '" + response.url().elidedStrin
g() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; | 536 String message = "Refused to display '" + response.url().elidedStrin
g() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; |
| 538 frame()->document()->addConsoleMessage(SecurityMessageSource, ErrorM
essageLevel, message, identifier); | 537 frame()->document()->addConsoleMessage(SecurityMessageSource, ErrorM
essageLevel, message, identifier); |
| 539 frame()->document()->enforceSandboxFlags(SandboxOrigin); | 538 frame()->document()->enforceSandboxFlags(SandboxOrigin); |
| 540 if (HTMLFrameOwnerElement* ownerElement = frame()->ownerElement()) | 539 if (HTMLFrameOwnerElement* ownerElement = frame()->ownerElement()) |
| 541 ownerElement->dispatchEvent(Event::create(eventNames().loadEvent
, false, false)); | 540 ownerElement->dispatchEvent(Event::create(eventNames().loadEvent
, false, false)); |
| 542 cancelMainResourceLoad(frameLoader()->cancelledError(m_request)); | 541 cancelMainResourceLoad(CancelledResourceError(m_request.url())); |
| 543 return; | 542 return; |
| 544 } | 543 } |
| 545 } | 544 } |
| 546 | 545 |
| 547 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading()); | 546 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading()); |
| 548 | 547 |
| 549 if (m_isLoadingMultipartContent) { | 548 if (m_isLoadingMultipartContent) { |
| 550 setupForReplace(); | 549 setupForReplace(); |
| 551 m_mainResource->clear(); | 550 m_mainResource->clear(); |
| 552 } else if (response.isMultipart()) { | 551 } else if (response.isMultipart()) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 584 |
| 586 KURL url = m_request.url(); | 585 KURL url = m_request.url(); |
| 587 const String& mimeType = m_response.mimeType(); | 586 const String& mimeType = m_response.mimeType(); |
| 588 | 587 |
| 589 switch (policy) { | 588 switch (policy) { |
| 590 case PolicyUse: { | 589 case PolicyUse: { |
| 591 // Prevent remote web archives from loading because they can claim to be
from any domain and thus avoid cross-domain security checks (4120255). | 590 // Prevent remote web archives from loading because they can claim to be
from any domain and thus avoid cross-domain security checks (4120255). |
| 592 bool isRemoteWebArchive = equalIgnoringCase("multipart/related", mimeTyp
e) | 591 bool isRemoteWebArchive = equalIgnoringCase("multipart/related", mimeTyp
e) |
| 593 && !m_substituteData.isValid() && !SchemeRegistry::shouldTreatURLSch
emeAsLocal(url.protocol()); | 592 && !m_substituteData.isValid() && !SchemeRegistry::shouldTreatURLSch
emeAsLocal(url.protocol()); |
| 594 if (!frameLoader()->client()->canShowMIMEType(mimeType) || isRemoteWebAr
chive) { | 593 if (!frameLoader()->client()->canShowMIMEType(mimeType) || isRemoteWebAr
chive) { |
| 595 frameLoader()->policyChecker()->cannotShowMIMEType(m_response); | 594 ASSERT_NOT_REACHED(); |
| 596 // Check reachedTerminalState since the load may have already been c
anceled inside of _handleUnimplementablePolicyWithErrorCode::. | |
| 597 stopLoadingForPolicyChange(); | 595 stopLoadingForPolicyChange(); |
| 598 return; | 596 return; |
| 599 } | 597 } |
| 600 break; | 598 break; |
| 601 } | 599 } |
| 602 | 600 |
| 603 case PolicyDownload: { | 601 case PolicyDownload: { |
| 604 // m_mainResource can be null, e.g. when loading a substitute resource f
rom application cache. | 602 ASSERT(m_mainResource); |
| 605 if (!m_mainResource) { | |
| 606 mainReceivedError(frameLoader()->client()->cannotShowURLError(m_requ
est)); | |
| 607 return; | |
| 608 } | |
| 609 InspectorInstrumentation::continueWithPolicyDownload(m_frame, this, main
ResourceLoader()->identifier(), m_response); | 603 InspectorInstrumentation::continueWithPolicyDownload(m_frame, this, main
ResourceLoader()->identifier(), m_response); |
| 610 | 604 |
| 611 // When starting the request, we didn't know that it would result in dow
nload and not navigation. Now we know that main document URL didn't change. | 605 // When starting the request, we didn't know that it would result in dow
nload and not navigation. Now we know that main document URL didn't change. |
| 612 // Download may use this knowledge for purposes unrelated to cookies, no
tably for setting file quarantine data. | 606 // Download may use this knowledge for purposes unrelated to cookies, no
tably for setting file quarantine data. |
| 613 frameLoader()->setOriginalURLForDownloadRequest(m_request); | 607 frameLoader()->setOriginalURLForDownloadRequest(m_request); |
| 614 return; | 608 return; |
| 615 } | 609 } |
| 616 case PolicyIgnore: | 610 case PolicyIgnore: |
| 617 InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, mainRe
sourceLoader()->identifier(), m_response); | 611 InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, mainRe
sourceLoader()->identifier(), m_response); |
| 618 stopLoadingForPolicyChange(); | 612 stopLoadingForPolicyChange(); |
| 619 return; | 613 return; |
| 620 | 614 |
| 621 default: | 615 default: |
| 622 ASSERT_NOT_REACHED(); | 616 ASSERT_NOT_REACHED(); |
| 623 } | 617 } |
| 624 | 618 |
| 625 if (m_response.isHTTP()) { | 619 if (m_response.isHTTP()) { |
| 626 int status = m_response.httpStatusCode(); | 620 int status = m_response.httpStatusCode(); |
| 627 if (status < 200 || status >= 300) { | 621 if (status < 200 || status >= 300) { |
| 628 bool hostedByObject = frameLoader()->isHostedByObjectElement(); | 622 bool hostedByObject = frameLoader()->isHostedByObjectElement(); |
| 629 | 623 |
| 630 frameLoader()->handleFallbackContent(); | 624 frameLoader()->handleFallbackContent(); |
| 631 // object elements are no longer rendered after we fallback, so don'
t | 625 // object elements are no longer rendered after we fallback, so don'
t |
| 632 // keep trying to process data from their load | 626 // keep trying to process data from their load |
| 633 | 627 |
| 634 if (hostedByObject) | 628 if (hostedByObject) |
| 635 cancelMainResourceLoad(frameLoader()->cancelledError(m_request))
; | 629 cancelMainResourceLoad(CancelledResourceError(m_request.url())); |
| 636 } | 630 } |
| 637 } | 631 } |
| 638 | 632 |
| 639 if (!isStopping() && m_substituteData.isValid()) { | 633 if (!isStopping() && m_substituteData.isValid()) { |
| 640 if (m_substituteData.content()->size()) | 634 if (m_substituteData.content()->size()) |
| 641 dataReceived(0, m_substituteData.content()->data(), m_substituteData
.content()->size()); | 635 dataReceived(0, m_substituteData.content()->data(), m_substituteData
.content()->size()); |
| 642 if (isLoadingMainResource()) | 636 if (isLoadingMainResource()) |
| 643 finishedLoading(0); | 637 finishedLoading(0); |
| 644 } | 638 } |
| 645 } | 639 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 658 | 652 |
| 659 commitIfReady(); | 653 commitIfReady(); |
| 660 FrameLoader* frameLoader = DocumentLoader::frameLoader(); | 654 FrameLoader* frameLoader = DocumentLoader::frameLoader(); |
| 661 if (!frameLoader) | 655 if (!frameLoader) |
| 662 return; | 656 return; |
| 663 if (isArchiveMIMEType(response().mimeType())) | 657 if (isArchiveMIMEType(response().mimeType())) |
| 664 return; | 658 return; |
| 665 frameLoader->client()->committedLoad(this, data, length); | 659 frameLoader->client()->committedLoad(this, data, length); |
| 666 } | 660 } |
| 667 | 661 |
| 668 ResourceError DocumentLoader::interruptedForPolicyChangeError() const | |
| 669 { | |
| 670 return frameLoader()->client()->interruptedForPolicyChangeError(request()); | |
| 671 } | |
| 672 | |
| 673 void DocumentLoader::stopLoadingForPolicyChange() | 662 void DocumentLoader::stopLoadingForPolicyChange() |
| 674 { | 663 { |
| 675 ResourceError error = interruptedForPolicyChangeError(); | 664 ResourceError error = frameLoader()->client()->interruptedForPolicyChangeErr
or(m_request); |
| 676 error.setIsCancellation(true); | 665 error.setIsCancellation(true); |
| 677 cancelMainResourceLoad(error); | 666 cancelMainResourceLoad(error); |
| 678 } | 667 } |
| 679 | 668 |
| 680 void DocumentLoader::commitData(const char* bytes, size_t length) | 669 void DocumentLoader::commitData(const char* bytes, size_t length) |
| 681 { | 670 { |
| 682 if (!m_gotFirstByte) { | 671 if (!m_gotFirstByte) { |
| 683 m_gotFirstByte = true; | 672 m_gotFirstByte = true; |
| 684 m_writer.begin(documentURL(), false); | 673 m_writer.begin(documentURL(), false); |
| 685 m_writer.setDocumentWasLoadedAsPartOfNavigation(); | 674 m_writer.setDocumentWasLoadedAsPartOfNavigation(); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 if (m_frame->page()->defersLoading()) | 908 if (m_frame->page()->defersLoading()) |
| 920 return; | 909 return; |
| 921 | 910 |
| 922 SubstituteResourceMap copy; | 911 SubstituteResourceMap copy; |
| 923 copy.swap(m_pendingSubstituteResources); | 912 copy.swap(m_pendingSubstituteResources); |
| 924 | 913 |
| 925 SubstituteResourceMap::const_iterator end = copy.end(); | 914 SubstituteResourceMap::const_iterator end = copy.end(); |
| 926 for (SubstituteResourceMap::const_iterator it = copy.begin(); it != end; ++i
t) { | 915 for (SubstituteResourceMap::const_iterator it = copy.begin(); it != end; ++i
t) { |
| 927 RefPtr<ResourceLoader> loader = it->key; | 916 RefPtr<ResourceLoader> loader = it->key; |
| 928 SubstituteResource* resource = it->value.get(); | 917 SubstituteResource* resource = it->value.get(); |
| 918 ASSERT(resource); |
| 929 | 919 |
| 930 if (resource) { | 920 if (resource) { |
| 931 SharedBuffer* data = resource->data(); | 921 SharedBuffer* data = resource->data(); |
| 932 | 922 |
| 933 loader->didReceiveResponse(0, resource->response()); | 923 loader->didReceiveResponse(0, resource->response()); |
| 934 | 924 |
| 935 // Calling ResourceLoader::didReceiveResponse can end up cancelling
the load, | 925 // Calling ResourceLoader::didReceiveResponse can end up cancelling
the load, |
| 936 // so we need to check if the loader has reached its terminal state. | 926 // so we need to check if the loader has reached its terminal state. |
| 937 if (loader->reachedTerminalState()) | 927 if (loader->reachedTerminalState()) |
| 938 return; | 928 return; |
| 939 | 929 |
| 940 loader->didReceiveData(0, data->data(), data->size(), data->size()); | 930 loader->didReceiveData(0, data->data(), data->size(), data->size()); |
| 941 | 931 |
| 942 // Calling ResourceLoader::didReceiveData can end up cancelling the
load, | 932 // Calling ResourceLoader::didReceiveData can end up cancelling the
load, |
| 943 // so we need to check if the loader has reached its terminal state. | 933 // so we need to check if the loader has reached its terminal state. |
| 944 if (loader->reachedTerminalState()) | 934 if (loader->reachedTerminalState()) |
| 945 return; | 935 return; |
| 946 | 936 |
| 947 loader->didFinishLoading(0, 0); | 937 loader->didFinishLoading(0, 0); |
| 948 } else { | |
| 949 // A null resource means that we should fail the load. | |
| 950 // FIXME: Maybe we should use another error here - something like "n
ot in cache". | |
| 951 loader->didFail(0, loader->cannotShowURLError()); | |
| 952 } | 938 } |
| 953 } | 939 } |
| 954 } | 940 } |
| 955 | 941 |
| 956 #ifndef NDEBUG | 942 #ifndef NDEBUG |
| 957 bool DocumentLoader::isSubstituteLoadPending(ResourceLoader* loader) const | 943 bool DocumentLoader::isSubstituteLoadPending(ResourceLoader* loader) const |
| 958 { | 944 { |
| 959 return m_pendingSubstituteResources.contains(loader); | 945 return m_pendingSubstituteResources.contains(loader); |
| 960 } | 946 } |
| 961 #endif | 947 #endif |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 // If there was a fragment identifier on m_request, the cache will have stri
pped it. m_request should include | 1146 // If there was a fragment identifier on m_request, the cache will have stri
pped it. m_request should include |
| 1161 // the fragment identifier, so add that back in. | 1147 // the fragment identifier, so add that back in. |
| 1162 if (equalIgnoringFragmentIdentifier(m_request.url(), request.url())) | 1148 if (equalIgnoringFragmentIdentifier(m_request.url(), request.url())) |
| 1163 request.setURL(m_request.url()); | 1149 request.setURL(m_request.url()); |
| 1164 setRequest(request); | 1150 setRequest(request); |
| 1165 } | 1151 } |
| 1166 | 1152 |
| 1167 void DocumentLoader::cancelMainResourceLoad(const ResourceError& resourceError) | 1153 void DocumentLoader::cancelMainResourceLoad(const ResourceError& resourceError) |
| 1168 { | 1154 { |
| 1169 RefPtr<DocumentLoader> protect(this); | 1155 RefPtr<DocumentLoader> protect(this); |
| 1170 ResourceError error = resourceError.isNull() ? frameLoader()->cancelledError
(m_request) : resourceError; | 1156 ResourceError error = resourceError.isNull() ? CancelledResourceError(m_requ
est.url()) : resourceError; |
| 1171 | 1157 |
| 1172 m_dataLoadTimer.stop(); | 1158 m_dataLoadTimer.stop(); |
| 1173 if (m_waitingForContentPolicy) { | 1159 if (m_waitingForContentPolicy) { |
| 1174 frameLoader()->policyChecker()->cancelCheck(); | 1160 frameLoader()->policyChecker()->cancelCheck(); |
| 1175 ASSERT(m_waitingForContentPolicy); | 1161 ASSERT(m_waitingForContentPolicy); |
| 1176 m_waitingForContentPolicy = false; | 1162 m_waitingForContentPolicy = false; |
| 1177 } | 1163 } |
| 1178 | 1164 |
| 1179 if (mainResourceLoader()) | 1165 if (mainResourceLoader()) |
| 1180 mainResourceLoader()->cancel(error); | 1166 mainResourceLoader()->cancel(error); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1202 commitLoad(resourceData->data(), resourceData->size()); | 1188 commitLoad(resourceData->data(), resourceData->size()); |
| 1203 } | 1189 } |
| 1204 | 1190 |
| 1205 void DocumentLoader::handledOnloadEvents() | 1191 void DocumentLoader::handledOnloadEvents() |
| 1206 { | 1192 { |
| 1207 m_wasOnloadHandled = true; | 1193 m_wasOnloadHandled = true; |
| 1208 applicationCacheHost()->stopDeferringEvents(); | 1194 applicationCacheHost()->stopDeferringEvents(); |
| 1209 } | 1195 } |
| 1210 | 1196 |
| 1211 } // namespace WebCore | 1197 } // namespace WebCore |
| OLD | NEW |