| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
| 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
| 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
| 8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 27 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 33 */ | 33 */ |
| 34 | 34 |
| 35 #include "core/loader/FrameLoader.h" | 35 #include "core/loader/FrameLoader.h" |
| 36 | 36 |
| 37 #include "base/debug/stack_trace.h" |
| 38 |
| 37 #include "bindings/core/v8/DOMWrapperWorld.h" | 39 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 38 #include "bindings/core/v8/ScriptController.h" | 40 #include "bindings/core/v8/ScriptController.h" |
| 39 #include "bindings/core/v8/SerializedScriptValue.h" | 41 #include "bindings/core/v8/SerializedScriptValue.h" |
| 40 #include "core/HTMLNames.h" | 42 #include "core/HTMLNames.h" |
| 41 #include "core/dom/Document.h" | 43 #include "core/dom/Document.h" |
| 42 #include "core/dom/Element.h" | 44 #include "core/dom/Element.h" |
| 43 #include "core/dom/ViewportDescription.h" | 45 #include "core/dom/ViewportDescription.h" |
| 44 #include "core/editing/Editor.h" | 46 #include "core/editing/Editor.h" |
| 45 #include "core/editing/commands/UndoStack.h" | 47 #include "core/editing/commands/UndoStack.h" |
| 46 #include "core/events/GestureEvent.h" | 48 #include "core/events/GestureEvent.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 223 } |
| 222 | 224 |
| 223 if (!defers) { | 225 if (!defers) { |
| 224 if (m_deferredHistoryLoad) { | 226 if (m_deferredHistoryLoad) { |
| 225 load(FrameLoadRequest(nullptr, m_deferredHistoryLoad->m_request), | 227 load(FrameLoadRequest(nullptr, m_deferredHistoryLoad->m_request), |
| 226 m_deferredHistoryLoad->m_loadType, m_deferredHistoryLoad->m_item
.get(), | 228 m_deferredHistoryLoad->m_loadType, m_deferredHistoryLoad->m_item
.get(), |
| 227 m_deferredHistoryLoad->m_historyLoadType); | 229 m_deferredHistoryLoad->m_historyLoadType); |
| 228 m_deferredHistoryLoad.clear(); | 230 m_deferredHistoryLoad.clear(); |
| 229 } | 231 } |
| 230 m_frame->navigationScheduler().startTimer(); | 232 m_frame->navigationScheduler().startTimer(); |
| 231 scheduleCheckCompleted(); | 233 checkCompleted(0); |
| 232 } | 234 } |
| 233 } | 235 } |
| 234 | 236 |
| 235 void FrameLoader::saveScrollState() | 237 void FrameLoader::saveScrollState() |
| 236 { | 238 { |
| 237 if (!m_currentItem || !m_frame->view()) | 239 if (!m_currentItem || !m_frame->view()) |
| 238 return; | 240 return; |
| 239 | 241 |
| 240 // Shouldn't clobber anything if we might still restore later. | 242 // Shouldn't clobber anything if we might still restore later. |
| 241 if (needsHistoryItemRestore(m_loadType) && m_documentLoader && !m_documentLo
ader->initialScrollState().wasScrolledByUser) | 243 if (needsHistoryItemRestore(m_loadType) && m_documentLoader && !m_documentLo
ader->initialScrollState().wasScrolledByUser) |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 // This can be called from the LocalFrame's destructor, in which case we sho
uldn't protect ourselves | 486 // This can be called from the LocalFrame's destructor, in which case we sho
uldn't protect ourselves |
| 485 // because doing so will cause us to re-enter the destructor when protector
goes out of scope. | 487 // because doing so will cause us to re-enter the destructor when protector
goes out of scope. |
| 486 // Null-checking the FrameView indicates whether or not we're in the destruc
tor. | 488 // Null-checking the FrameView indicates whether or not we're in the destruc
tor. |
| 487 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nul
lptr); | 489 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nul
lptr); |
| 488 | 490 |
| 489 m_progressTracker->finishedParsing(); | 491 m_progressTracker->finishedParsing(); |
| 490 | 492 |
| 491 if (client()) | 493 if (client()) |
| 492 client()->dispatchDidFinishDocumentLoad(m_documentLoader ? m_documentLoa
der->isCommittedButEmpty() : true); | 494 client()->dispatchDidFinishDocumentLoad(m_documentLoader ? m_documentLoa
der->isCommittedButEmpty() : true); |
| 493 | 495 |
| 494 checkCompleted(); | 496 checkCompleted(1); |
| 495 | 497 |
| 496 if (!m_frame->view()) | 498 if (!m_frame->view()) |
| 497 return; // We are being destroyed by something checkCompleted called. | 499 return; // We are being destroyed by something checkCompleted called. |
| 498 | 500 |
| 499 // Check if the scrollbars are really needed for the content. | 501 // Check if the scrollbars are really needed for the content. |
| 500 // If not, remove them, relayout, and repaint. | 502 // If not, remove them, relayout, and repaint. |
| 501 m_frame->view()->restoreScrollbar(); | 503 m_frame->view()->restoreScrollbar(); |
| 502 processFragment(m_frame->document()->url(), NavigationToDifferentDocument); | 504 processFragment(m_frame->document()->url(), NavigationToDifferentDocument); |
| 503 } | 505 } |
| 504 | 506 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 static bool shouldSendCompleteNotification(LocalFrame* frame) | 560 static bool shouldSendCompleteNotification(LocalFrame* frame) |
| 559 { | 561 { |
| 560 // FIXME: We might have already sent stop notifications and be re-completing
. | 562 // FIXME: We might have already sent stop notifications and be re-completing
. |
| 561 if (!frame->isLoading()) | 563 if (!frame->isLoading()) |
| 562 return false; | 564 return false; |
| 563 // Only send didStopLoading() if there are no navigations in progress at all
, | 565 // Only send didStopLoading() if there are no navigations in progress at all
, |
| 564 // whether committed, provisional, or pending. | 566 // whether committed, provisional, or pending. |
| 565 return frame->loader().documentLoader()->sentDidFinishLoad() && !frame->load
er().provisionalDocumentLoader() && !frame->loader().client()->hasPendingNavigat
ion(); | 567 return frame->loader().documentLoader()->sentDidFinishLoad() && !frame->load
er().provisionalDocumentLoader() && !frame->loader().client()->hasPendingNavigat
ion(); |
| 566 } | 568 } |
| 567 | 569 |
| 568 void FrameLoader::checkCompleted() | 570 void FrameLoader::checkCompletedNow(int) |
| 569 { | 571 { |
| 572 // fprintf(stderr, "checkCompletedNow(%p)\n", this); |
| 573 // base::debug::StackTrace().Print(); |
| 570 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 574 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
| 571 if (!shouldComplete(m_frame->document())) | 575 if (!shouldComplete(m_frame->document())) { |
| 576 // fprintf(stderr, "checkCompletedNow(%p): not shouldComplete(0\n", this
); |
| 572 return; | 577 return; |
| 578 } |
| 573 | 579 |
| 574 // OK, completed. | 580 // OK, completed. |
| 575 m_frame->document()->setReadyState(Document::Complete); | 581 m_frame->document()->setReadyState(Document::Complete); |
| 576 if (m_frame->document()->loadEventStillNeeded()) | 582 if (m_frame->document()->loadEventStillNeeded()) { |
| 583 // fprintf(stderr, "checkCompletedNow(%p): implicitClose()\n", this); |
| 577 m_frame->document()->implicitClose(); | 584 m_frame->document()->implicitClose(); |
| 585 } |
| 578 | 586 |
| 579 m_frame->navigationScheduler().startTimer(); | 587 m_frame->navigationScheduler().startTimer(); |
| 580 | 588 |
| 581 if (m_frame->view()) | 589 if (m_frame->view()) { |
| 590 // fprintf(stderr, "checkCompletedNow(%p): handleLoadCompleted()\n", thi
s); |
| 582 m_frame->view()->handleLoadCompleted(); | 591 m_frame->view()->handleLoadCompleted(); |
| 592 } |
| 583 | 593 |
| 584 // The readystatechanged or load event may have disconnected this frame. | 594 // The readystatechanged or load event may have disconnected this frame. |
| 585 if (!m_frame->client()) | 595 if (!m_frame->client()) |
| 586 return; | 596 return; |
| 587 | 597 |
| 588 if (shouldSendFinishNotification(m_frame)) { | 598 if (shouldSendFinishNotification(m_frame)) { |
| 589 // Report mobile vs. desktop page statistics. This will only report on A
ndroid. | 599 // Report mobile vs. desktop page statistics. This will only report on A
ndroid. |
| 600 // fprintf(stderr, "checkCompletedNow(%p): Finish Notification\n", this)
; |
| 590 if (m_frame->isMainFrame()) | 601 if (m_frame->isMainFrame()) |
| 591 m_frame->document()->viewportDescription().reportMobilePageStats(m_f
rame); | 602 m_frame->document()->viewportDescription().reportMobilePageStats(m_f
rame); |
| 592 m_documentLoader->setSentDidFinishLoad(); | 603 m_documentLoader->setSentDidFinishLoad(); |
| 593 client()->dispatchDidFinishLoad(); | 604 client()->dispatchDidFinishLoad(); |
| 594 // Finishing the load can detach the frame when running layout tests. | 605 // Finishing the load can detach the frame when running layout tests. |
| 595 if (!m_frame->client()) | 606 if (!m_frame->client()) |
| 596 return; | 607 return; |
| 597 } | 608 } |
| 598 | 609 |
| 599 if (shouldSendCompleteNotification(m_frame)) { | 610 if (shouldSendCompleteNotification(m_frame)) { |
| 611 // fprintf(stderr, "checkCompletedNow(%p): Complete Notification\n", thi
s); |
| 600 m_progressTracker->progressCompleted(); | 612 m_progressTracker->progressCompleted(); |
| 601 // Retry restoring scroll offset since finishing loading disables conten
t | 613 // Retry restoring scroll offset since finishing loading disables conten
t |
| 602 // size clamping. | 614 // size clamping. |
| 603 restoreScrollPositionAndViewState(); | 615 restoreScrollPositionAndViewState(); |
| 604 | 616 |
| 605 m_loadType = FrameLoadTypeStandard; | 617 m_loadType = FrameLoadTypeStandard; |
| 606 m_frame->localDOMWindow()->finishedLoading(); | 618 m_frame->localDOMWindow()->finishedLoading(); |
| 607 } | 619 } |
| 608 | 620 |
| 621 // fprintf(stderr, "checkCompletedNow(%p): Check Parent Notification\n", thi
s); |
| 609 Frame* parent = m_frame->tree().parent(); | 622 Frame* parent = m_frame->tree().parent(); |
| 610 if (parent && parent->isLocalFrame()) | 623 if (parent && parent->isLocalFrame()) |
| 611 toLocalFrame(parent)->loader().checkCompleted(); | 624 toLocalFrame(parent)->loader().checkCompleted(2); |
| 612 } | 625 } |
| 613 | 626 |
| 614 void FrameLoader::checkTimerFired(Timer<FrameLoader>*) | 627 void FrameLoader::checkTimerFired(Timer<FrameLoader>*) |
| 615 { | 628 { |
| 616 if (Page* page = m_frame->page()) { | 629 if (Page* page = m_frame->page()) { |
| 617 if (page->defersLoading()) | 630 if (page->defersLoading()) |
| 618 return; | 631 return; |
| 619 } | 632 } |
| 620 checkCompleted(); | 633 checkCompletedNow(-1); |
| 621 } | 634 } |
| 622 | 635 |
| 623 void FrameLoader::scheduleCheckCompleted() | 636 void FrameLoader::checkCompleted(int n) |
| 624 { | 637 { |
| 638 /* |
| 639 ID Can be sync? |
| 640 0 ? FrameLoader::setDefersLoading(bool defers) |
| 641 1 N FrameLoader::finishedParsing() |
| 642 2 Y FrameLoader::checkCompletedNow |
| 643 3 Y? FrameLoader::loadInSameDocument |
| 644 4 Y? FrameLoader::detach |
| 645 5 N FrameLoader::receivedMainResourceError |
| 646 6 N FrameFetchContext::didLoadResource() - matters |
| 647 7 ? Document::close() |
| 648 8 ? Document::loadEventDelayTimerFired |
| 649 9 ? WebRemoteFrameImpl::didStopLoading() |
| 650 10 ? HTMLImportTreeRoot::stateDidChange() |
| 651 |
| 652 */ |
| 653 /* |
| 654 fprintf(stderr, "checkCompleted(%d)\n", n); |
| 655 if (n == 6) |
| 656 base::debug::StackTrace().Print(); |
| 657 */ |
| 658 if ((1<<2) & (1<<n)) { |
| 659 checkCompletedNow(-1); |
| 660 } else { |
| 625 if (!m_checkTimer.isActive()) | 661 if (!m_checkTimer.isActive()) |
| 626 m_checkTimer.startOneShot(0, BLINK_FROM_HERE); | 662 m_checkTimer.startOneShot(0, BLINK_FROM_HERE); |
| 663 } |
| 627 } | 664 } |
| 628 | 665 |
| 629 Frame* FrameLoader::opener() | 666 Frame* FrameLoader::opener() |
| 630 { | 667 { |
| 631 return client() ? client()->opener() : 0; | 668 return client() ? client()->opener() : 0; |
| 632 } | 669 } |
| 633 | 670 |
| 634 void FrameLoader::setOpener(LocalFrame* opener) | 671 void FrameLoader::setOpener(LocalFrame* opener) |
| 635 { | 672 { |
| 636 // If the frame is already detached, the opener has already been cleared. | 673 // If the frame is already detached, the opener has already been cleared. |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 if (hashChange) { | 746 if (hashChange) { |
| 710 // If we were in the autoscroll/panScroll mode we want to stop it before
following the link to the anchor | 747 // If we were in the autoscroll/panScroll mode we want to stop it before
following the link to the anchor |
| 711 m_frame->eventHandler().stopAutoscroll(); | 748 m_frame->eventHandler().stopAutoscroll(); |
| 712 m_frame->localDOMWindow()->enqueueHashchangeEvent(oldURL, url); | 749 m_frame->localDOMWindow()->enqueueHashchangeEvent(oldURL, url); |
| 713 } | 750 } |
| 714 m_documentLoader->setIsClientRedirect(clientRedirect == ClientRedirect); | 751 m_documentLoader->setIsClientRedirect(clientRedirect == ClientRedirect); |
| 715 updateForSameDocumentNavigation(url, SameDocumentNavigationDefault, nullptr,
ScrollRestorationAuto, frameLoadType); | 752 updateForSameDocumentNavigation(url, SameDocumentNavigationDefault, nullptr,
ScrollRestorationAuto, frameLoadType); |
| 716 | 753 |
| 717 m_documentLoader->initialScrollState().wasScrolledByUser = false; | 754 m_documentLoader->initialScrollState().wasScrolledByUser = false; |
| 718 | 755 |
| 719 checkCompleted(); | 756 checkCompleted(3); |
| 720 | 757 |
| 721 m_frame->localDOMWindow()->statePopped(stateObject ? stateObject : Serialize
dScriptValue::nullValue()); | 758 m_frame->localDOMWindow()->statePopped(stateObject ? stateObject : Serialize
dScriptValue::nullValue()); |
| 722 | 759 |
| 723 if (historyLoadType == HistorySameDocumentLoad) | 760 if (historyLoadType == HistorySameDocumentLoad) |
| 724 restoreScrollPositionAndViewState(); | 761 restoreScrollPositionAndViewState(); |
| 725 | 762 |
| 726 // We need to scroll to the fragment whether or not a hash change occurred,
since | 763 // We need to scroll to the fragment whether or not a hash change occurred,
since |
| 727 // the user might have scrolled since the previous navigation. | 764 // the user might have scrolled since the previous navigation. |
| 728 processFragment(url, NavigationWithinSameDocument); | 765 processFragment(url, NavigationWithinSameDocument); |
| 729 } | 766 } |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 | 1030 |
| 994 m_frame->document()->suppressLoadEvent(); | 1031 m_frame->document()->suppressLoadEvent(); |
| 995 if (m_provisionalDocumentLoader) | 1032 if (m_provisionalDocumentLoader) |
| 996 m_provisionalDocumentLoader->stopLoading(); | 1033 m_provisionalDocumentLoader->stopLoading(); |
| 997 if (m_documentLoader) | 1034 if (m_documentLoader) |
| 998 m_documentLoader->stopLoading(); | 1035 m_documentLoader->stopLoading(); |
| 999 m_frame->document()->cancelParsing(); | 1036 m_frame->document()->cancelParsing(); |
| 1000 | 1037 |
| 1001 detachDocumentLoader(m_provisionalDocumentLoader); | 1038 detachDocumentLoader(m_provisionalDocumentLoader); |
| 1002 | 1039 |
| 1040 if (m_checkTimer.isActive()) |
| 1041 checkCompletedNow(-1); |
| 1003 m_checkTimer.stop(); | 1042 m_checkTimer.stop(); |
| 1004 m_frame->navigationScheduler().cancel(); | 1043 m_frame->navigationScheduler().cancel(); |
| 1005 | 1044 |
| 1006 m_inStopAllLoaders = false; | 1045 m_inStopAllLoaders = false; |
| 1046 // checkCompletedNow(); |
| 1007 } | 1047 } |
| 1008 | 1048 |
| 1009 void FrameLoader::didAccessInitialDocument() | 1049 void FrameLoader::didAccessInitialDocument() |
| 1010 { | 1050 { |
| 1011 // We only need to notify the client once, and only for the main frame. | 1051 // We only need to notify the client once, and only for the main frame. |
| 1012 if (isLoadingMainFrame() && !m_didAccessInitialDocument) { | 1052 if (isLoadingMainFrame() && !m_didAccessInitialDocument) { |
| 1013 m_didAccessInitialDocument = true; | 1053 m_didAccessInitialDocument = true; |
| 1014 // Notify asynchronously, since this is called within a JavaScript secur
ity check. | 1054 // Notify asynchronously, since this is called within a JavaScript secur
ity check. |
| 1015 m_didAccessInitialDocumentTimer.startOneShot(0, BLINK_FROM_HERE); | 1055 m_didAccessInitialDocumentTimer.startOneShot(0, BLINK_FROM_HERE); |
| 1016 } | 1056 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 { | 1236 { |
| 1197 #if !ENABLE(OILPAN) | 1237 #if !ENABLE(OILPAN) |
| 1198 // The caller must protect a reference to m_frame. | 1238 // The caller must protect a reference to m_frame. |
| 1199 ASSERT(m_frame->refCount() > 1); | 1239 ASSERT(m_frame->refCount() > 1); |
| 1200 #endif | 1240 #endif |
| 1201 detachDocumentLoader(m_documentLoader); | 1241 detachDocumentLoader(m_documentLoader); |
| 1202 detachDocumentLoader(m_provisionalDocumentLoader); | 1242 detachDocumentLoader(m_provisionalDocumentLoader); |
| 1203 | 1243 |
| 1204 Frame* parent = m_frame->tree().parent(); | 1244 Frame* parent = m_frame->tree().parent(); |
| 1205 if (parent && parent->isLocalFrame()) | 1245 if (parent && parent->isLocalFrame()) |
| 1206 toLocalFrame(parent)->loader().scheduleCheckCompleted(); | 1246 toLocalFrame(parent)->loader().checkCompleted(4); |
| 1207 if (m_progressTracker) { | 1247 if (m_progressTracker) { |
| 1208 m_progressTracker->dispose(); | 1248 m_progressTracker->dispose(); |
| 1209 m_progressTracker.clear(); | 1249 m_progressTracker.clear(); |
| 1210 } | 1250 } |
| 1211 } | 1251 } |
| 1212 | 1252 |
| 1213 void FrameLoader::receivedMainResourceError(DocumentLoader* loader, const Resour
ceError& error) | 1253 void FrameLoader::receivedMainResourceError(DocumentLoader* loader, const Resour
ceError& error) |
| 1214 { | 1254 { |
| 1215 // Retain because the stop may release the last reference to it. | 1255 // Retain because the stop may release the last reference to it. |
| 1216 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 1256 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1235 } else { | 1275 } else { |
| 1236 ASSERT(loader == m_documentLoader); | 1276 ASSERT(loader == m_documentLoader); |
| 1237 if (m_frame->document()->parser()) | 1277 if (m_frame->document()->parser()) |
| 1238 m_frame->document()->parser()->stopParsing(); | 1278 m_frame->document()->parser()->stopParsing(); |
| 1239 m_documentLoader->setSentDidFinishLoad(); | 1279 m_documentLoader->setSentDidFinishLoad(); |
| 1240 if (!m_provisionalDocumentLoader && m_frame->isLoading()) { | 1280 if (!m_provisionalDocumentLoader && m_frame->isLoading()) { |
| 1241 client()->dispatchDidFailLoad(error, historyCommitType); | 1281 client()->dispatchDidFailLoad(error, historyCommitType); |
| 1242 m_progressTracker->progressCompleted(); | 1282 m_progressTracker->progressCompleted(); |
| 1243 } | 1283 } |
| 1244 } | 1284 } |
| 1245 checkCompleted(); | 1285 checkCompleted(5); |
| 1246 } | 1286 } |
| 1247 | 1287 |
| 1248 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S
tring& httpMethod, FrameLoadType loadType, const KURL& url) | 1288 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S
tring& httpMethod, FrameLoadType loadType, const KURL& url) |
| 1249 { | 1289 { |
| 1250 // We don't do this if we are submitting a form with method other than "GET"
, explicitly reloading, | 1290 // We don't do this if we are submitting a form with method other than "GET"
, explicitly reloading, |
| 1251 // currently displaying a frameset, or if the URL does not have a fragment. | 1291 // currently displaying a frameset, or if the URL does not have a fragment. |
| 1252 return (!isFormSubmission || equalIgnoringCase(httpMethod, HTTPNames::GET)) | 1292 return (!isFormSubmission || equalIgnoringCase(httpMethod, HTTPNames::GET)) |
| 1253 && loadType != FrameLoadTypeReload | 1293 && loadType != FrameLoadTypeReload |
| 1254 && loadType != FrameLoadTypeReloadFromOrigin | 1294 && loadType != FrameLoadTypeReloadFromOrigin |
| 1255 && loadType != FrameLoadTypeSame | 1295 && loadType != FrameLoadTypeSame |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 if (!shouldClose(navigationType == NavigationTypeReload)) | 1417 if (!shouldClose(navigationType == NavigationTypeReload)) |
| 1378 return; | 1418 return; |
| 1379 | 1419 |
| 1380 m_frame->document()->cancelParsing(); | 1420 m_frame->document()->cancelParsing(); |
| 1381 | 1421 |
| 1382 if (m_provisionalDocumentLoader) { | 1422 if (m_provisionalDocumentLoader) { |
| 1383 m_provisionalDocumentLoader->stopLoading(); | 1423 m_provisionalDocumentLoader->stopLoading(); |
| 1384 detachDocumentLoader(m_provisionalDocumentLoader); | 1424 detachDocumentLoader(m_provisionalDocumentLoader); |
| 1385 } | 1425 } |
| 1386 | 1426 |
| 1427 if (m_checkTimer.isActive()) |
| 1428 checkCompletedNow(-1); |
| 1429 m_checkTimer.stop(); |
| 1430 |
| 1387 // beforeunload fired above, and detaching a DocumentLoader can fire | 1431 // beforeunload fired above, and detaching a DocumentLoader can fire |
| 1388 // events, which can detach this frame. | 1432 // events, which can detach this frame. |
| 1389 if (!m_frame->host()) | 1433 if (!m_frame->host()) |
| 1390 return; | 1434 return; |
| 1391 | 1435 |
| 1392 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, reques
t, frameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData
() : defaultSubstituteDataForURL(request.url())); | 1436 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, reques
t, frameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData
() : defaultSubstituteDataForURL(request.url())); |
| 1393 m_provisionalDocumentLoader->setNavigationType(navigationType); | 1437 m_provisionalDocumentLoader->setNavigationType(navigationType); |
| 1394 m_provisionalDocumentLoader->setReplacesCurrentHistoryItem(type == FrameLoad
TypeReplaceCurrentItem); | 1438 m_provisionalDocumentLoader->setReplacesCurrentHistoryItem(type == FrameLoad
TypeReplaceCurrentItem); |
| 1395 m_provisionalDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedi
rect() == ClientRedirect); | 1439 m_provisionalDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedi
rect() == ClientRedirect); |
| 1396 | 1440 |
| 1397 InspectorInstrumentation::didStartProvisionalLoad(m_frame); | 1441 InspectorInstrumentation::didStartProvisionalLoad(m_frame); |
| 1398 | 1442 |
| 1399 m_frame->navigationScheduler().cancel(); | 1443 m_frame->navigationScheduler().cancel(); |
| 1444 |
| 1445 if (m_checkTimer.isActive()) |
| 1446 checkCompletedNow(-1); |
| 1400 m_checkTimer.stop(); | 1447 m_checkTimer.stop(); |
| 1401 | 1448 |
| 1402 m_loadType = type; | 1449 m_loadType = type; |
| 1403 | 1450 |
| 1404 if (frameLoadRequest.form()) | 1451 if (frameLoadRequest.form()) |
| 1405 client()->dispatchWillSubmitForm(frameLoadRequest.form()); | 1452 client()->dispatchWillSubmitForm(frameLoadRequest.form()); |
| 1406 | 1453 |
| 1407 m_progressTracker->progressStarted(); | 1454 m_progressTracker->progressStarted(); |
| 1408 if (m_provisionalDocumentLoader->isClientRedirect()) | 1455 if (m_provisionalDocumentLoader->isClientRedirect()) |
| 1409 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); | 1456 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1561 // FIXME: We need a way to propagate insecure requests policy flags to | 1608 // FIXME: We need a way to propagate insecure requests policy flags to |
| 1562 // out-of-process frames. For now, we'll always use default behavior. | 1609 // out-of-process frames. For now, we'll always use default behavior. |
| 1563 if (!parentFrame->isLocalFrame()) | 1610 if (!parentFrame->isLocalFrame()) |
| 1564 return nullptr; | 1611 return nullptr; |
| 1565 | 1612 |
| 1566 ASSERT(toLocalFrame(parentFrame)->document()); | 1613 ASSERT(toLocalFrame(parentFrame)->document()); |
| 1567 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1614 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
| 1568 } | 1615 } |
| 1569 | 1616 |
| 1570 } // namespace blink | 1617 } // namespace blink |
| OLD | NEW |