OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
6 * (http://www.torchmobile.com/) | 6 * (http://www.torchmobile.com/) |
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 } | 386 } |
387 | 387 |
388 void FrameLoader::clearProvisionalHistoryItem() { | 388 void FrameLoader::clearProvisionalHistoryItem() { |
389 m_provisionalItem.clear(); | 389 m_provisionalItem.clear(); |
390 } | 390 } |
391 | 391 |
392 void FrameLoader::setHistoryItemStateForCommit( | 392 void FrameLoader::setHistoryItemStateForCommit( |
393 FrameLoadType loadType, | 393 FrameLoadType loadType, |
394 HistoryCommitType historyCommitType, | 394 HistoryCommitType historyCommitType, |
395 HistoryNavigationType navigationType) { | 395 HistoryNavigationType navigationType) { |
396 if (m_frame->settings()->historyEntryRequiresUserGesture() && | |
397 historyCommitType == StandardCommit) | |
398 UserGestureIndicator::clearProcessedUserGestureSinceLoad(); | |
399 | |
400 HistoryItem* oldItem = m_currentItem; | 396 HistoryItem* oldItem = m_currentItem; |
401 if (isBackForwardLoadType(loadType) && m_provisionalItem) | 397 if (isBackForwardLoadType(loadType) && m_provisionalItem) |
402 m_currentItem = m_provisionalItem.release(); | 398 m_currentItem = m_provisionalItem.release(); |
403 else | 399 else |
404 m_currentItem = HistoryItem::create(); | 400 m_currentItem = HistoryItem::create(); |
405 m_currentItem->setURL(m_documentLoader->urlForHistory()); | 401 m_currentItem->setURL(m_documentLoader->urlForHistory()); |
406 m_currentItem->setDocumentState(m_frame->document()->formElementsState()); | 402 m_currentItem->setDocumentState(m_frame->document()->formElementsState()); |
407 m_currentItem->setTarget(m_frame->tree().uniqueName()); | 403 m_currentItem->setTarget(m_frame->tree().uniqueName()); |
408 m_currentItem->setReferrer(SecurityPolicy::generateReferrer( | 404 m_currentItem->setReferrer(SecurityPolicy::generateReferrer( |
409 m_documentLoader->request().getReferrerPolicy(), m_currentItem->url(), | 405 m_documentLoader->request().getReferrerPolicy(), m_currentItem->url(), |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 | 778 |
783 // Generate start and stop notifications only when loader is completed so that | 779 // Generate start and stop notifications only when loader is completed so that |
784 // we don't fire them for fragment redirection that happens in window.onload | 780 // we don't fire them for fragment redirection that happens in window.onload |
785 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 | 781 // handler. See https://bugs.webkit.org/show_bug.cgi?id=31838 |
786 if (m_frame->document()->loadEventFinished()) | 782 if (m_frame->document()->loadEventFinished()) |
787 client()->didStartLoading(NavigationWithinSameDocument); | 783 client()->didStartLoading(NavigationWithinSameDocument); |
788 | 784 |
789 HistoryCommitType historyCommitType = loadTypeToCommitType(type); | 785 HistoryCommitType historyCommitType = loadTypeToCommitType(type); |
790 if (!m_currentItem) | 786 if (!m_currentItem) |
791 historyCommitType = HistoryInertCommit; | 787 historyCommitType = HistoryInertCommit; |
792 if (m_frame->settings()->historyEntryRequiresUserGesture() && | 788 if (m_frame->settings()->historyEntryRequiresUserGesture()) { |
793 !UserGestureIndicator::processedUserGestureSinceLoad() && | 789 if (initiatingDocument && !initiatingDocument->hasReceivedUserGesture()) |
794 initiatingDocument) | 790 historyCommitType = HistoryInertCommit; |
795 historyCommitType = HistoryInertCommit; | 791 else if (historyCommitType == StandardCommit) |
| 792 m_frame->document()->clearHasReceivedUserGesture(); |
| 793 } |
796 | 794 |
797 setHistoryItemStateForCommit( | 795 setHistoryItemStateForCommit( |
798 type, historyCommitType, | 796 type, historyCommitType, |
799 sameDocumentNavigationSource == SameDocumentNavigationHistoryApi | 797 sameDocumentNavigationSource == SameDocumentNavigationHistoryApi |
800 ? HistoryNavigationType::HistoryApi | 798 ? HistoryNavigationType::HistoryApi |
801 : HistoryNavigationType::Fragment); | 799 : HistoryNavigationType::Fragment); |
802 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { | 800 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { |
803 m_currentItem->setStateObject(std::move(data)); | 801 m_currentItem->setStateObject(std::move(data)); |
804 m_currentItem->setScrollRestorationType(scrollRestorationType); | 802 m_currentItem->setScrollRestorationType(scrollRestorationType); |
805 } | 803 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 ? FrameLoadTypeStandard | 928 ? FrameLoadTypeStandard |
931 : FrameLoadTypeReplaceCurrentItem; | 929 : FrameLoadTypeReplaceCurrentItem; |
932 } | 930 } |
933 | 931 |
934 if (request.substituteData().failingURL() == | 932 if (request.substituteData().failingURL() == |
935 m_documentLoader->urlForHistory() && | 933 m_documentLoader->urlForHistory() && |
936 m_loadType == FrameLoadTypeReload) | 934 m_loadType == FrameLoadTypeReload) |
937 return FrameLoadTypeReload; | 935 return FrameLoadTypeReload; |
938 | 936 |
939 if (m_frame->settings()->historyEntryRequiresUserGesture() && | 937 if (m_frame->settings()->historyEntryRequiresUserGesture() && |
940 !UserGestureIndicator::processedUserGestureSinceLoad() && | 938 request.originDocument() && |
941 request.originDocument()) | 939 !request.originDocument()->hasReceivedUserGesture()) |
942 return FrameLoadTypeReplaceCurrentItem; | 940 return FrameLoadTypeReplaceCurrentItem; |
943 | 941 |
944 return FrameLoadTypeStandard; | 942 return FrameLoadTypeStandard; |
945 } | 943 } |
946 | 944 |
947 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) { | 945 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) { |
948 // If no origin Document* was specified, skip remaining security checks and | 946 // If no origin Document* was specified, skip remaining security checks and |
949 // assume the caller has fully initialized the FrameLoadRequest. | 947 // assume the caller has fully initialized the FrameLoadRequest. |
950 if (!request.originDocument()) | 948 if (!request.originDocument()) |
951 return true; | 949 return true; |
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1938 m_documentLoader ? m_documentLoader->url() : String()); | 1936 m_documentLoader ? m_documentLoader->url() : String()); |
1939 return tracedValue; | 1937 return tracedValue; |
1940 } | 1938 } |
1941 | 1939 |
1942 inline void FrameLoader::takeObjectSnapshot() const { | 1940 inline void FrameLoader::takeObjectSnapshot() const { |
1943 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, | 1941 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, |
1944 toTracedValue()); | 1942 toTracedValue()); |
1945 } | 1943 } |
1946 | 1944 |
1947 } // namespace blink | 1945 } // namespace blink |
OLD | NEW |