| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 if (!m_currentItem) | 140 if (!m_currentItem) |
| 141 return ResourceRequest(); | 141 return ResourceRequest(); |
| 142 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get()
, cachePolicy); | 142 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get()
, cachePolicy); |
| 143 | 143 |
| 144 // ClientRedirectPolicy is an indication that this load was triggered by | 144 // ClientRedirectPolicy is an indication that this load was triggered by |
| 145 // some direct interaction with the page. If this reload is not a client | 145 // some direct interaction with the page. If this reload is not a client |
| 146 // redirect, we should reuse the referrer from the original load of the | 146 // redirect, we should reuse the referrer from the original load of the |
| 147 // current document. If this reload is a client redirect (e.g., location.rel
oad()), | 147 // current document. If this reload is a client redirect (e.g., location.rel
oad()), |
| 148 // it was initiated by something in the current document and should | 148 // it was initiated by something in the current document and should |
| 149 // therefore show the current document's url as the referrer. | 149 // therefore show the current document's url as the referrer. |
| 150 if (clientRedirectPolicy == ClientRedirect) { | 150 if (clientRedirectPolicy == ClientRedirectPolicy::ClientRedirect) { |
| 151 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer()
, | 151 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer()
, |
| 152 m_frame->document()->getReferrerPolicy())); | 152 m_frame->document()->getReferrerPolicy())); |
| 153 } | 153 } |
| 154 | 154 |
| 155 if (!overrideURL.isEmpty()) { | 155 if (!overrideURL.isEmpty()) { |
| 156 request.setURL(overrideURL); | 156 request.setURL(overrideURL); |
| 157 request.clearHTTPReferrer(); | 157 request.clearHTTPReferrer(); |
| 158 } | 158 } |
| 159 request.setSkipServiceWorker(frameLoadType == FrameLoadTypeReloadBypassingCa
che); | 159 request.setSkipServiceWorker(frameLoadType == FrameLoadTypeReloadBypassingCa
che); |
| 160 return request; | 160 return request; |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 TemporaryChange<FrameLoadType> loadTypeChange(m_loadType, frameLoadType); | 720 TemporaryChange<FrameLoadType> loadTypeChange(m_loadType, frameLoadType); |
| 721 saveScrollState(); | 721 saveScrollState(); |
| 722 | 722 |
| 723 KURL oldURL = m_frame->document()->url(); | 723 KURL oldURL = m_frame->document()->url(); |
| 724 bool hashChange = equalIgnoringFragmentIdentifier(url, oldURL) && url.fragme
ntIdentifier() != oldURL.fragmentIdentifier(); | 724 bool hashChange = equalIgnoringFragmentIdentifier(url, oldURL) && url.fragme
ntIdentifier() != oldURL.fragmentIdentifier(); |
| 725 if (hashChange) { | 725 if (hashChange) { |
| 726 // If we were in the autoscroll/panScroll mode we want to stop it before
following the link to the anchor | 726 // If we were in the autoscroll/panScroll mode we want to stop it before
following the link to the anchor |
| 727 m_frame->eventHandler().stopAutoscroll(); | 727 m_frame->eventHandler().stopAutoscroll(); |
| 728 m_frame->localDOMWindow()->enqueueHashchangeEvent(oldURL, url); | 728 m_frame->localDOMWindow()->enqueueHashchangeEvent(oldURL, url); |
| 729 } | 729 } |
| 730 m_documentLoader->setIsClientRedirect(clientRedirect == ClientRedirect); | 730 m_documentLoader->setIsClientRedirect(clientRedirect == ClientRedirectPolicy
::ClientRedirect); |
| 731 updateForSameDocumentNavigation(url, SameDocumentNavigationDefault, nullptr,
ScrollRestorationAuto, frameLoadType); | 731 updateForSameDocumentNavigation(url, SameDocumentNavigationDefault, nullptr,
ScrollRestorationAuto, frameLoadType); |
| 732 | 732 |
| 733 m_documentLoader->initialScrollState().wasScrolledByUser = false; | 733 m_documentLoader->initialScrollState().wasScrolledByUser = false; |
| 734 | 734 |
| 735 checkCompleted(); | 735 checkCompleted(); |
| 736 | 736 |
| 737 m_frame->localDOMWindow()->statePopped(stateObject ? stateObject : Serialize
dScriptValue::nullValue()); | 737 m_frame->localDOMWindow()->statePopped(stateObject ? stateObject : Serialize
dScriptValue::nullValue()); |
| 738 | 738 |
| 739 if (historyLoadType == HistorySameDocumentLoad) | 739 if (historyLoadType == HistorySameDocumentLoad) |
| 740 restoreScrollPositionAndViewState(); | 740 restoreScrollPositionAndViewState(); |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1385 ASSERT(client()->hasWebView()); | 1385 ASSERT(client()->hasWebView()); |
| 1386 // Lots of things in this function can detach the LocalFrame (stopAllLoaders
, beforeunload handlers, etc.), so protect the frame. | 1386 // Lots of things in this function can detach the LocalFrame (stopAllLoaders
, beforeunload handlers, etc.), so protect the frame. |
| 1387 RawPtr<LocalFrame> protect(m_frame.get()); | 1387 RawPtr<LocalFrame> protect(m_frame.get()); |
| 1388 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) | 1388 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No
Dismissal) |
| 1389 return; | 1389 return; |
| 1390 | 1390 |
| 1391 NavigationType navigationType = determineNavigationType(type, frameLoadReque
st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri
ggeringEvent()); | 1391 NavigationType navigationType = determineNavigationType(type, frameLoadReque
st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri
ggeringEvent()); |
| 1392 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext
FromNavigationType(navigationType)); | 1392 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext
FromNavigationType(navigationType)); |
| 1393 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web
URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); | 1393 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web
URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); |
| 1394 ResourceRequest& request = frameLoadRequest.resourceRequest(); | 1394 ResourceRequest& request = frameLoadRequest.resourceRequest(); |
| 1395 if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteD
ata(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), na
vigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLo
adRequest.clientRedirect() == ClientRedirect)) | 1395 if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteD
ata(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), na
vigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLo
adRequest.clientRedirect() == ClientRedirectPolicy::ClientRedirect)) |
| 1396 return; | 1396 return; |
| 1397 if (!shouldClose(navigationType == NavigationTypeReload)) | 1397 if (!shouldClose(navigationType == NavigationTypeReload)) |
| 1398 return; | 1398 return; |
| 1399 | 1399 |
| 1400 m_frame->document()->cancelParsing(); | 1400 m_frame->document()->cancelParsing(); |
| 1401 detachDocumentLoader(m_provisionalDocumentLoader); | 1401 detachDocumentLoader(m_provisionalDocumentLoader); |
| 1402 | 1402 |
| 1403 // beforeunload fired above, and detaching a DocumentLoader can fire | 1403 // beforeunload fired above, and detaching a DocumentLoader can fire |
| 1404 // events, which can detach this frame. | 1404 // events, which can detach this frame. |
| 1405 if (!m_frame->host()) | 1405 if (!m_frame->host()) |
| 1406 return; | 1406 return; |
| 1407 | 1407 |
| 1408 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, reques
t, frameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData
() : defaultSubstituteDataForURL(request.url())); | 1408 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, reques
t, frameLoadRequest.substituteData().isValid() ? frameLoadRequest.substituteData
() : defaultSubstituteDataForURL(request.url())); |
| 1409 m_provisionalDocumentLoader->setNavigationType(navigationType); | 1409 m_provisionalDocumentLoader->setNavigationType(navigationType); |
| 1410 m_provisionalDocumentLoader->setReplacesCurrentHistoryItem(type == FrameLoad
TypeReplaceCurrentItem); | 1410 m_provisionalDocumentLoader->setReplacesCurrentHistoryItem(type == FrameLoad
TypeReplaceCurrentItem); |
| 1411 m_provisionalDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedi
rect() == ClientRedirect); | 1411 m_provisionalDocumentLoader->setIsClientRedirect(frameLoadRequest.clientRedi
rect() == ClientRedirectPolicy::ClientRedirect); |
| 1412 | 1412 |
| 1413 InspectorInstrumentation::didStartProvisionalLoad(m_frame); | 1413 InspectorInstrumentation::didStartProvisionalLoad(m_frame); |
| 1414 | 1414 |
| 1415 m_frame->navigationScheduler().cancel(); | 1415 m_frame->navigationScheduler().cancel(); |
| 1416 m_checkTimer.stop(); | 1416 m_checkTimer.stop(); |
| 1417 | 1417 |
| 1418 m_loadType = type; | 1418 m_loadType = type; |
| 1419 | 1419 |
| 1420 if (frameLoadRequest.form()) | 1420 if (frameLoadRequest.form()) |
| 1421 client()->dispatchWillSubmitForm(frameLoadRequest.form()); | 1421 client()->dispatchWillSubmitForm(frameLoadRequest.form()); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1584 // FIXME: We need a way to propagate insecure requests policy flags to | 1584 // FIXME: We need a way to propagate insecure requests policy flags to |
| 1585 // out-of-process frames. For now, we'll always use default behavior. | 1585 // out-of-process frames. For now, we'll always use default behavior. |
| 1586 if (!parentFrame->isLocalFrame()) | 1586 if (!parentFrame->isLocalFrame()) |
| 1587 return nullptr; | 1587 return nullptr; |
| 1588 | 1588 |
| 1589 ASSERT(toLocalFrame(parentFrame)->document()); | 1589 ASSERT(toLocalFrame(parentFrame)->document()); |
| 1590 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1590 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 } // namespace blink | 1593 } // namespace blink |
| OLD | NEW |