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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 void DocumentLoader::setMainDocumentError(const ResourceError& error) | 185 void DocumentLoader::setMainDocumentError(const ResourceError& error) |
186 { | 186 { |
187 m_mainDocumentError = error; | 187 m_mainDocumentError = error; |
188 } | 188 } |
189 | 189 |
190 void DocumentLoader::mainReceivedError(const ResourceError& error) | 190 void DocumentLoader::mainReceivedError(const ResourceError& error) |
191 { | 191 { |
192 ASSERT(!error.isNull()); | 192 ASSERT(!error.isNull()); |
193 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading()); | 193 ASSERT(!mainResourceLoader() || !mainResourceLoader()->defersLoading()); |
194 | |
195 m_applicationCacheHost->failedLoadingMainResource(); | 194 m_applicationCacheHost->failedLoadingMainResource(); |
196 | |
197 if (!frameLoader()) | 195 if (!frameLoader()) |
198 return; | 196 return; |
199 setMainDocumentError(error); | 197 setMainDocumentError(error); |
200 clearMainResourceLoader(); | 198 clearMainResourceLoader(); |
201 frameLoader()->receivedMainResourceError(error); | 199 frameLoader()->receivedMainResourceError(error); |
202 clearMainResourceHandle(); | 200 clearMainResourceHandle(); |
203 } | 201 } |
204 | 202 |
205 // Cancels the data source's pending loads. Conceptually, a data source only lo
ads | 203 // Cancels the data source's pending loads. Conceptually, a data source only lo
ads |
206 // one document at a time, but one document may have many related resources. | 204 // one document at a time, but one document may have many related resources. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 m_frame->fetchContext().dispatchDidReceiveResponse(this, m_identifierFor
LoadWithoutResourceLoader, m_response, 0); | 535 m_frame->fetchContext().dispatchDidReceiveResponse(this, m_identifierFor
LoadWithoutResourceLoader, m_response, 0); |
538 | 536 |
539 if (!shouldContinueForResponse()) { | 537 if (!shouldContinueForResponse()) { |
540 InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, m_main
Resource->identifier(), m_response); | 538 InspectorInstrumentation::continueWithPolicyIgnore(m_frame, this, m_main
Resource->identifier(), m_response); |
541 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); | 539 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); |
542 return; | 540 return; |
543 } | 541 } |
544 | 542 |
545 if (m_response.isHTTP()) { | 543 if (m_response.isHTTP()) { |
546 int status = m_response.httpStatusCode(); | 544 int status = m_response.httpStatusCode(); |
547 if (status < 200 || status >= 300) { | 545 if ((status < 200 || status >= 300) && m_frame->ownerElement() && m_fram
e->ownerElement()->isObjectElement()) { |
548 bool hostedByObject = frameLoader()->isHostedByObjectElement(); | 546 m_frame->ownerElement()->renderFallbackContent(); |
549 | |
550 frameLoader()->handleFallbackContent(); | |
551 // object elements are no longer rendered after we fallback, so don'
t | 547 // object elements are no longer rendered after we fallback, so don'
t |
552 // keep trying to process data from their load | 548 // keep trying to process data from their load |
553 | 549 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url()
)); |
554 if (hostedByObject) | |
555 cancelMainResourceLoad(ResourceError::cancelledError(m_request.u
rl())); | |
556 } | 550 } |
557 } | 551 } |
558 } | 552 } |
559 | 553 |
560 void DocumentLoader::ensureWriter() | 554 void DocumentLoader::ensureWriter() |
561 { | 555 { |
562 ensureWriter(m_response.mimeType()); | 556 ensureWriter(m_response.mimeType()); |
563 } | 557 } |
564 | 558 |
565 void DocumentLoader::ensureWriter(const String& mimeType, const KURL& overriding
URL) | 559 void DocumentLoader::ensureWriter(const String& mimeType, const KURL& overriding
URL) |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 941 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
948 { | 942 { |
949 m_frame->loader()->stopAllLoaders(); | 943 m_frame->loader()->stopAllLoaders(); |
950 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : "", m_writer ? m_writer->encod
ingWasChosenByUser() : false, true); | 944 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : "", m_writer ? m_writer->encod
ingWasChosenByUser() : false, true); |
951 if (!source.isNull()) | 945 if (!source.isNull()) |
952 m_writer->appendReplacingData(source); | 946 m_writer->appendReplacingData(source); |
953 endWriting(m_writer.get()); | 947 endWriting(m_writer.get()); |
954 } | 948 } |
955 | 949 |
956 } // namespace WebCore | 950 } // namespace WebCore |
OLD | NEW |