| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 181 |
| 182 if (m_committed) { | 182 if (m_committed) { |
| 183 // Attempt to stop the frame if the document loader is loading, or if it
is done loading but | 183 // Attempt to stop the frame if the document loader is loading, or if it
is done loading but |
| 184 // still parsing. Failure to do so can cause a world leak. | 184 // still parsing. Failure to do so can cause a world leak. |
| 185 Document* doc = m_frame->document(); | 185 Document* doc = m_frame->document(); |
| 186 | 186 |
| 187 if (loading || doc->parsing()) | 187 if (loading || doc->parsing()) |
| 188 m_frame->loader().stopLoading(); | 188 m_frame->loader().stopLoading(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 m_fetcher->stopFetching(); |
| 192 |
| 191 if (!loading) | 193 if (!loading) |
| 192 return; | 194 return; |
| 193 | 195 |
| 194 if (m_loadingMainResource) { | 196 if (m_loadingMainResource) { |
| 195 // Stop the main resource loader and let it send the cancelled message. | 197 // Stop the main resource loader and let it send the cancelled message. |
| 196 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); | 198 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); |
| 197 } else if (m_fetcher->isFetching()) { | 199 } else if (m_fetcher->isFetching()) { |
| 198 // The main resource loader already finished loading. Set the cancelled
error on the | 200 // The main resource loader already finished loading. Set the cancelled
error on the |
| 199 // document and let the resourceLoaders send individual cancelled messag
es below. | 201 // document and let the resourceLoaders send individual cancelled messag
es below. |
| 200 setMainDocumentError(ResourceError::cancelledError(m_request.url())); | 202 setMainDocumentError(ResourceError::cancelledError(m_request.url())); |
| 201 } else { | 203 } else { |
| 202 // If there are no resource loaders, we need to manufacture a cancelled
message. | 204 // If there are no resource loaders, we need to manufacture a cancelled
message. |
| 203 // (A back/forward navigation has no resource loaders because its resour
ces are cached.) | 205 // (A back/forward navigation has no resource loaders because its resour
ces are cached.) |
| 204 mainReceivedError(ResourceError::cancelledError(m_request.url())); | 206 mainReceivedError(ResourceError::cancelledError(m_request.url())); |
| 205 } | 207 } |
| 206 | |
| 207 m_fetcher->stopFetching(); | |
| 208 } | 208 } |
| 209 | 209 |
| 210 void DocumentLoader::commitIfReady() | 210 void DocumentLoader::commitIfReady() |
| 211 { | 211 { |
| 212 if (!m_committed) { | 212 if (!m_committed) { |
| 213 m_committed = true; | 213 m_committed = true; |
| 214 frameLoader()->commitProvisionalLoad(); | 214 frameLoader()->commitProvisionalLoad(); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 828 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
| 829 { | 829 { |
| 830 m_frame->loader().stopAllLoaders(); | 830 m_frame->loader().stopAllLoaders(); |
| 831 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); | 831 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); |
| 832 if (!source.isNull()) | 832 if (!source.isNull()) |
| 833 m_writer->appendReplacingData(source); | 833 m_writer->appendReplacingData(source); |
| 834 endWriting(m_writer.get()); | 834 endWriting(m_writer.get()); |
| 835 } | 835 } |
| 836 | 836 |
| 837 } // namespace WebCore | 837 } // namespace WebCore |
| OLD | NEW |