| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #include "core/xml/parser/XMLDocumentParser.h" | 82 #include "core/xml/parser/XMLDocumentParser.h" |
| 83 #include "platform/Logging.h" | 83 #include "platform/Logging.h" |
| 84 #include "platform/UserGestureIndicator.h" | 84 #include "platform/UserGestureIndicator.h" |
| 85 #include "platform/geometry/FloatRect.h" | 85 #include "platform/geometry/FloatRect.h" |
| 86 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" | 86 #include "platform/network/ContentSecurityPolicyResponseHeaders.h" |
| 87 #include "platform/network/HTTPParsers.h" | 87 #include "platform/network/HTTPParsers.h" |
| 88 #include "platform/network/ResourceRequest.h" | 88 #include "platform/network/ResourceRequest.h" |
| 89 #include "platform/scroll/ScrollAnimator.h" | 89 #include "platform/scroll/ScrollAnimator.h" |
| 90 #include "platform/weborigin/SecurityOrigin.h" | 90 #include "platform/weborigin/SecurityOrigin.h" |
| 91 #include "platform/weborigin/SecurityPolicy.h" | 91 #include "platform/weborigin/SecurityPolicy.h" |
| 92 #include "public/platform/WebURLRequest.h" |
| 92 #include "wtf/TemporaryChange.h" | 93 #include "wtf/TemporaryChange.h" |
| 93 #include "wtf/text/CString.h" | 94 #include "wtf/text/CString.h" |
| 94 #include "wtf/text/WTFString.h" | 95 #include "wtf/text/WTFString.h" |
| 95 | 96 |
| 96 namespace WebCore { | 97 namespace WebCore { |
| 97 | 98 |
| 98 using namespace HTMLNames; | 99 using namespace HTMLNames; |
| 99 | 100 |
| 100 bool isBackForwardLoadType(FrameLoadType type) | 101 bool isBackForwardLoadType(FrameLoadType type) |
| 101 { | 102 { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 124 , m_willDetachClient(false) | 125 , m_willDetachClient(false) |
| 125 { | 126 { |
| 126 } | 127 } |
| 127 | 128 |
| 128 FrameLoader::~FrameLoader() | 129 FrameLoader::~FrameLoader() |
| 129 { | 130 { |
| 130 } | 131 } |
| 131 | 132 |
| 132 void FrameLoader::init() | 133 void FrameLoader::init() |
| 133 { | 134 { |
| 134 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, Resour
ceRequest(KURL(ParsedURLString, emptyString())), SubstituteData()); | 135 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString())); |
| 136 initialRequest.setRequestContext(blink::WebURLRequest::RequestContextInterna
l); |
| 137 initialRequest.setFrameType(m_frame->isMainFrame() ? blink::WebURLRequest::F
rameTypeTopLevel : blink::WebURLRequest::FrameTypeNested); |
| 138 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, initia
lRequest, SubstituteData()); |
| 135 m_provisionalDocumentLoader->startLoadingMainResource(); | 139 m_provisionalDocumentLoader->startLoadingMainResource(); |
| 136 m_frame->document()->cancelParsing(); | 140 m_frame->document()->cancelParsing(); |
| 137 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu
ment); | 141 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu
ment); |
| 138 } | 142 } |
| 139 | 143 |
| 140 FrameLoaderClient* FrameLoader::client() const | 144 FrameLoaderClient* FrameLoader::client() const |
| 141 { | 145 { |
| 142 return static_cast<FrameLoaderClient*>(m_frame->client()); | 146 return static_cast<FrameLoaderClient*>(m_frame->client()); |
| 143 } | 147 } |
| 144 | 148 |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 return FrameLoadTypeRedirectWithLockedBackForwardList; | 670 return FrameLoadTypeRedirectWithLockedBackForwardList; |
| 667 if (!request.originDocument() && request.resourceRequest().url() == m_docume
ntLoader->urlForHistory()) | 671 if (!request.originDocument() && request.resourceRequest().url() == m_docume
ntLoader->urlForHistory()) |
| 668 return FrameLoadTypeSame; | 672 return FrameLoadTypeSame; |
| 669 if (request.substituteData().failingURL() == m_documentLoader->urlForHistory
() && m_loadType == FrameLoadTypeReload) | 673 if (request.substituteData().failingURL() == m_documentLoader->urlForHistory
() && m_loadType == FrameLoadTypeReload) |
| 670 return FrameLoadTypeReload; | 674 return FrameLoadTypeReload; |
| 671 return FrameLoadTypeStandard; | 675 return FrameLoadTypeStandard; |
| 672 } | 676 } |
| 673 | 677 |
| 674 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) | 678 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) |
| 675 { | 679 { |
| 676 // If no origin Document* was specified, skip security checks and assume the
caller has fully initialized the FrameLoadRequest. | 680 request.resourceRequest().setFrameType(m_frame->isMainFrame() ? blink::WebUR
LRequest::FrameTypeTopLevel : blink::WebURLRequest::FrameTypeNested); |
| 681 |
| 682 // If no origin Document* was specified, skip remaining security checks and
assume the caller has fully initialized the FrameLoadRequest. |
| 677 if (!request.originDocument()) | 683 if (!request.originDocument()) |
| 678 return true; | 684 return true; |
| 679 | 685 |
| 680 KURL url = request.resourceRequest().url(); | 686 KURL url = request.resourceRequest().url(); |
| 681 if (m_frame->script().executeScriptIfJavaScriptURL(url)) | 687 if (m_frame->script().executeScriptIfJavaScriptURL(url)) |
| 682 return false; | 688 return false; |
| 683 | 689 |
| 684 if (!request.originDocument()->securityOrigin()->canDisplay(url)) { | 690 if (!request.originDocument()->securityOrigin()->canDisplay(url)) { |
| 685 reportLocalLoadFailed(m_frame, url.elidedString()); | 691 reportLocalLoadFailed(m_frame, url.elidedString()); |
| 686 return false; | 692 return false; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 return request; | 792 return request; |
| 787 } | 793 } |
| 788 | 794 |
| 789 void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con
st AtomicString& overrideEncoding) | 795 void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con
st AtomicString& overrideEncoding) |
| 790 { | 796 { |
| 791 if (!m_currentItem) | 797 if (!m_currentItem) |
| 792 return; | 798 return; |
| 793 | 799 |
| 794 ResourceRequestCachePolicy cachePolicy = reloadPolicy == EndToEndReload ? Re
loadBypassingCache : ReloadIgnoringCacheData; | 800 ResourceRequestCachePolicy cachePolicy = reloadPolicy == EndToEndReload ? Re
loadBypassingCache : ReloadIgnoringCacheData; |
| 795 ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cacheP
olicy); | 801 ResourceRequest request = requestFromHistoryItem(m_currentItem.get(), cacheP
olicy); |
| 802 request.setFrameType(m_frame->isMainFrame() ? blink::WebURLRequest::FrameTyp
eTopLevel : blink::WebURLRequest::FrameTypeNested); |
| 796 if (!overrideURL.isEmpty()) { | 803 if (!overrideURL.isEmpty()) { |
| 797 request.setURL(overrideURL); | 804 request.setURL(overrideURL); |
| 798 request.clearHTTPReferrer(); | 805 request.clearHTTPReferrer(); |
| 799 } | 806 } |
| 800 | 807 |
| 801 FrameLoadType type = reloadPolicy == EndToEndReload ? FrameLoadTypeReloadFro
mOrigin : FrameLoadTypeReload; | 808 FrameLoadType type = reloadPolicy == EndToEndReload ? FrameLoadTypeReloadFro
mOrigin : FrameLoadTypeReload; |
| 802 loadWithNavigationAction(NavigationAction(request, type), type, nullptr, Sub
stituteData(), CheckContentSecurityPolicy, NotClientRedirect, overrideEncoding); | 809 loadWithNavigationAction(NavigationAction(request, type), type, nullptr, Sub
stituteData(), CheckContentSecurityPolicy, NotClientRedirect, overrideEncoding); |
| 803 } | 810 } |
| 804 | 811 |
| 805 void FrameLoader::stopAllLoaders() | 812 void FrameLoader::stopAllLoaders() |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache
Policy); | 1412 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache
Policy); |
| 1406 return; | 1413 return; |
| 1407 } | 1414 } |
| 1408 | 1415 |
| 1409 m_provisionalItem = item; | 1416 m_provisionalItem = item; |
| 1410 if (historyLoadType == HistorySameDocumentLoad) { | 1417 if (historyLoadType == HistorySameDocumentLoad) { |
| 1411 loadInSameDocument(item->url(), item->stateObject(), FrameLoadTypeBackFo
rward, NotClientRedirect); | 1418 loadInSameDocument(item->url(), item->stateObject(), FrameLoadTypeBackFo
rward, NotClientRedirect); |
| 1412 restoreScrollPositionAndViewState(); | 1419 restoreScrollPositionAndViewState(); |
| 1413 return; | 1420 return; |
| 1414 } | 1421 } |
| 1415 loadWithNavigationAction(NavigationAction(requestFromHistoryItem(item, cache
Policy), FrameLoadTypeBackForward), FrameLoadTypeBackForward, nullptr, Substitut
eData(), CheckContentSecurityPolicy); | 1422 |
| 1423 ResourceRequest request = requestFromHistoryItem(item, cachePolicy); |
| 1424 request.setFrameType(m_frame->isMainFrame() ? blink::WebURLRequest::FrameTyp
eTopLevel : blink::WebURLRequest::FrameTypeNested); |
| 1425 loadWithNavigationAction(NavigationAction(request, FrameLoadTypeBackForward)
, FrameLoadTypeBackForward, nullptr, SubstituteData(), CheckContentSecurityPolic
y); |
| 1416 } | 1426 } |
| 1417 | 1427 |
| 1418 void FrameLoader::dispatchDocumentElementAvailable() | 1428 void FrameLoader::dispatchDocumentElementAvailable() |
| 1419 { | 1429 { |
| 1420 client()->documentElementAvailable(); | 1430 client()->documentElementAvailable(); |
| 1421 } | 1431 } |
| 1422 | 1432 |
| 1423 void FrameLoader::dispatchDidClearDocumentOfWindowObject() | 1433 void FrameLoader::dispatchDidClearDocumentOfWindowObject() |
| 1424 { | 1434 { |
| 1425 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 1435 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1448 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1458 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
| 1449 Frame* parentFrame = m_frame->tree().parent(); | 1459 Frame* parentFrame = m_frame->tree().parent(); |
| 1450 if (parentFrame && parentFrame->isLocalFrame()) | 1460 if (parentFrame && parentFrame->isLocalFrame()) |
| 1451 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1461 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
| 1452 if (FrameOwner* frameOwner = m_frame->owner()) | 1462 if (FrameOwner* frameOwner = m_frame->owner()) |
| 1453 flags |= frameOwner->sandboxFlags(); | 1463 flags |= frameOwner->sandboxFlags(); |
| 1454 return flags; | 1464 return flags; |
| 1455 } | 1465 } |
| 1456 | 1466 |
| 1457 } // namespace WebCore | 1467 } // namespace WebCore |
| OLD | NEW |