| 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 if (isArchiveMIMEType(response().mimeType())) | 535 if (isArchiveMIMEType(response().mimeType())) |
| 536 return; | 536 return; |
| 537 commitData(data, length); | 537 commitData(data, length); |
| 538 | 538 |
| 539 // If we are sending data to MediaDocument, we should stop here | 539 // If we are sending data to MediaDocument, we should stop here |
| 540 // and cancel the request. | 540 // and cancel the request. |
| 541 if (m_frame && m_frame->document()->isMediaDocument()) | 541 if (m_frame && m_frame->document()->isMediaDocument()) |
| 542 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); | 542 cancelMainResourceLoad(ResourceError::cancelledError(m_request.url())); |
| 543 } | 543 } |
| 544 | 544 |
| 545 void DocumentLoader::checkLoadComplete() | |
| 546 { | |
| 547 if (!m_frame || isLoading() || !m_committed) | |
| 548 return; | |
| 549 m_frame->domWindow()->finishedLoading(); | |
| 550 } | |
| 551 | |
| 552 void DocumentLoader::clearRedirectChain() | 545 void DocumentLoader::clearRedirectChain() |
| 553 { | 546 { |
| 554 m_redirectChain.clear(); | 547 m_redirectChain.clear(); |
| 555 } | 548 } |
| 556 | 549 |
| 557 void DocumentLoader::appendRedirect(const KURL& url) | 550 void DocumentLoader::appendRedirect(const KURL& url) |
| 558 { | 551 { |
| 559 m_redirectChain.append(url); | 552 m_redirectChain.append(url); |
| 560 } | 553 } |
| 561 | 554 |
| 562 void DocumentLoader::detachFromFrame() | 555 void DocumentLoader::detachFromFrame() |
| 563 { | 556 { |
| 564 ASSERT(m_frame); | 557 ASSERT(m_frame); |
| 565 RefPtr<LocalFrame> protectFrame(m_frame); | 558 RefPtr<LocalFrame> protectFrame(m_frame); |
| 566 RefPtr<DocumentLoader> protectLoader(this); | 559 RefPtr<DocumentLoader> protectLoader(this); |
| 567 | 560 |
| 568 // It never makes sense to have a document loader that is detached from its | 561 // It never makes sense to have a document loader that is detached from its |
| 569 // frame have any loads active, so go ahead and kill all the loads. | 562 // frame have any loads active, so go ahead and kill all the loads. |
| 570 stopLoading(); | 563 stopLoading(); |
| 571 | 564 |
| 572 m_applicationCacheHost->setApplicationCache(0); | 565 m_applicationCacheHost->setApplicationCache(0); |
| 573 InspectorInstrumentation::loaderDetachedFromFrame(m_frame, this); | 566 InspectorInstrumentation::loaderDetachedFromFrame(m_frame, this); |
| 574 m_frame = 0; | 567 m_frame = 0; |
| 575 } | 568 } |
| 576 | 569 |
| 577 void DocumentLoader::clearMainResourceLoader() | 570 void DocumentLoader::clearMainResourceLoader() |
| 578 { | 571 { |
| 579 m_loadingMainResource = false; | 572 m_loadingMainResource = false; |
| 580 checkLoadComplete(); | |
| 581 } | 573 } |
| 582 | 574 |
| 583 void DocumentLoader::clearMainResourceHandle() | 575 void DocumentLoader::clearMainResourceHandle() |
| 584 { | 576 { |
| 585 if (!m_mainResource) | 577 if (!m_mainResource) |
| 586 return; | 578 return; |
| 587 m_mainResource->removeClient(this); | 579 m_mainResource->removeClient(this); |
| 588 m_mainResource = 0; | 580 m_mainResource = 0; |
| 589 } | 581 } |
| 590 | 582 |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) | 822 void DocumentLoader::replaceDocument(const String& source, Document* ownerDocume
nt) |
| 831 { | 823 { |
| 832 m_frame->loader().stopAllLoaders(); | 824 m_frame->loader().stopAllLoaders(); |
| 833 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 m_writer = createWriterFor(m_frame, ownerDocument, m_frame->document()->url(
), mimeType(), m_writer ? m_writer->encoding() : emptyAtom, m_writer ? m_writer
->encodingWasChosenByUser() : false, true); |
| 834 if (!source.isNull()) | 826 if (!source.isNull()) |
| 835 m_writer->appendReplacingData(source); | 827 m_writer->appendReplacingData(source); |
| 836 endWriting(m_writer.get()); | 828 endWriting(m_writer.get()); |
| 837 } | 829 } |
| 838 | 830 |
| 839 } // namespace WebCore | 831 } // namespace WebCore |
| OLD | NEW |