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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 if (m_committed) { | 181 if (m_committed) { |
182 // Attempt to stop the frame if the document loader is loading, or if it
is done loading but | 182 // Attempt to stop the frame if the document loader is loading, or if it
is done loading but |
183 // still parsing. Failure to do so can cause a world leak. | 183 // still parsing. Failure to do so can cause a world leak. |
184 Document* doc = m_frame->document(); | 184 Document* doc = m_frame->document(); |
185 | 185 |
186 if (loading || doc->parsing()) | 186 if (loading || doc->parsing()) |
187 m_frame->loader().stopLoading(); | 187 m_frame->loader().stopLoading(); |
188 } | 188 } |
189 | 189 |
190 clearArchiveResources(); | |
191 | |
192 if (!loading) | 190 if (!loading) |
193 return; | 191 return; |
194 | 192 |
195 if (m_loadingMainResource) { | 193 if (m_loadingMainResource) { |
196 // Stop the main resource loader and let it send the cancelled message. | 194 // Stop the main resource loader and let it send the cancelled message. |
197 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); | 195 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); |
198 } else if (m_fetcher->isFetching()) { | 196 } else if (m_fetcher->isFetching()) { |
199 // The main resource loader already finished loading. Set the cancelled
error on the | 197 // The main resource loader already finished loading. Set the cancelled
error on the |
200 // document and let the resourceLoaders send individual cancelled messag
es below. | 198 // document and let the resourceLoaders send individual cancelled messag
es below. |
201 setMainDocumentError(ResourceError::cancelledError(m_request.url())); | 199 setMainDocumentError(ResourceError::cancelledError(m_request.url())); |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 m_archive = parentCollection->popSubframeArchive(m_frame->tree().uniqueName(
), m_request.url()); | 630 m_archive = parentCollection->popSubframeArchive(m_frame->tree().uniqueName(
), m_request.url()); |
633 | 631 |
634 if (!m_archive) | 632 if (!m_archive) |
635 return; | 633 return; |
636 addAllArchiveResources(m_archive.get()); | 634 addAllArchiveResources(m_archive.get()); |
637 | 635 |
638 ArchiveResource* mainResource = m_archive->mainResource(); | 636 ArchiveResource* mainResource = m_archive->mainResource(); |
639 m_substituteData = SubstituteData(mainResource->data(), mainResource->mimeTy
pe(), mainResource->textEncoding(), KURL()); | 637 m_substituteData = SubstituteData(mainResource->data(), mainResource->mimeTy
pe(), mainResource->textEncoding(), KURL()); |
640 } | 638 } |
641 | 639 |
642 void DocumentLoader::clearArchiveResources() | |
643 { | |
644 m_archiveResourceCollection.clear(); | |
645 } | |
646 | |
647 bool DocumentLoader::scheduleArchiveLoad(Resource* cachedResource, const Resourc
eRequest& request) | 640 bool DocumentLoader::scheduleArchiveLoad(Resource* cachedResource, const Resourc
eRequest& request) |
648 { | 641 { |
649 if (!m_archive) | 642 if (!m_archive) |
650 return false; | 643 return false; |
651 | 644 |
652 ASSERT(m_archiveResourceCollection); | 645 ASSERT(m_archiveResourceCollection); |
653 ArchiveResource* archiveResource = m_archiveResourceCollection->archiveResou
rceForURL(request.url()); | 646 ArchiveResource* archiveResource = m_archiveResourceCollection->archiveResou
rceForURL(request.url()); |
654 if (!archiveResource) { | 647 if (!archiveResource) { |
655 cachedResource->error(Resource::LoadError); | 648 cachedResource->error(Resource::LoadError); |
656 return true; | 649 return true; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 814 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
822 { | 815 { |
823 m_frame->loader().stopAllLoaders(); | 816 m_frame->loader().stopAllLoaders(); |
824 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); | 817 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); |
825 if (!source.isNull()) | 818 if (!source.isNull()) |
826 m_writer->appendReplacingData(source); | 819 m_writer->appendReplacingData(source); |
827 endWriting(m_writer.get()); | 820 endWriting(m_writer.get()); |
828 } | 821 } |
829 | 822 |
830 } // namespace WebCore | 823 } // namespace WebCore |
OLD | NEW |