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 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get()
, cachePolicy); | 140 ResourceRequest request = resourceRequestFromHistoryItem(m_currentItem.get()
, cachePolicy); |
141 | 141 |
142 // ClientRedirectPolicy is an indication that this load was triggered by | 142 // ClientRedirectPolicy is an indication that this load was triggered by |
143 // some direct interaction with the page. If this reload is not a client | 143 // some direct interaction with the page. If this reload is not a client |
144 // redirect, we should reuse the referrer from the original load of the | 144 // redirect, we should reuse the referrer from the original load of the |
145 // current document. If this reload is a client redirect (e.g., location.rel
oad()), | 145 // current document. If this reload is a client redirect (e.g., location.rel
oad()), |
146 // it was initiated by something in the current document and should | 146 // it was initiated by something in the current document and should |
147 // therefore show the current document's url as the referrer. | 147 // therefore show the current document's url as the referrer. |
148 if (clientRedirectPolicy == ClientRedirect) { | 148 if (clientRedirectPolicy == ClientRedirect) { |
149 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer()
, | 149 request.setHTTPReferrer(Referrer(m_frame->document()->outgoingReferrer()
, |
150 m_frame->document()->referrerPolicy())); | 150 m_frame->document()->getReferrerPolicy())); |
151 } | 151 } |
152 | 152 |
153 if (!overrideURL.isEmpty()) { | 153 if (!overrideURL.isEmpty()) { |
154 request.setURL(overrideURL); | 154 request.setURL(overrideURL); |
155 request.clearHTTPReferrer(); | 155 request.clearHTTPReferrer(); |
156 } | 156 } |
157 request.setSkipServiceWorker(frameLoadType == FrameLoadTypeReloadFromOrigin)
; | 157 request.setSkipServiceWorker(frameLoadType == FrameLoadTypeReloadFromOrigin)
; |
158 return request; | 158 return request; |
159 } | 159 } |
160 | 160 |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 // Anchor elements with the 'referrerpolicy' attribute will have | 735 // Anchor elements with the 'referrerpolicy' attribute will have |
736 // already set the referrer on the request. | 736 // already set the referrer on the request. |
737 if (request.didSetHTTPReferrer()) | 737 if (request.didSetHTTPReferrer()) |
738 return; | 738 return; |
739 if (shouldSendReferrer == NeverSendReferrer) | 739 if (shouldSendReferrer == NeverSendReferrer) |
740 return; | 740 return; |
741 | 741 |
742 // Always use the initiating document to generate the referrer. | 742 // Always use the initiating document to generate the referrer. |
743 // We need to generateReferrer(), because we haven't enforced ReferrerPolicy
or https->http | 743 // We need to generateReferrer(), because we haven't enforced ReferrerPolicy
or https->http |
744 // referrer suppression yet. | 744 // referrer suppression yet. |
745 Referrer referrer = SecurityPolicy::generateReferrer(originDocument->referre
rPolicy(), request.url(), originDocument->outgoingReferrer()); | 745 Referrer referrer = SecurityPolicy::generateReferrer(originDocument->getRefe
rrerPolicy(), request.url(), originDocument->outgoingReferrer()); |
746 | 746 |
747 request.setHTTPReferrer(referrer); | 747 request.setHTTPReferrer(referrer); |
748 RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString(ref
errer.referrer); | 748 RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString(ref
errer.referrer); |
749 request.addHTTPOriginIfNeeded(referrerOrigin); | 749 request.addHTTPOriginIfNeeded(referrerOrigin); |
750 } | 750 } |
751 | 751 |
752 FrameLoadType FrameLoader::determineFrameLoadType(const FrameLoadRequest& reques
t) | 752 FrameLoadType FrameLoader::determineFrameLoadType(const FrameLoadRequest& reques
t) |
753 { | 753 { |
754 if (m_frame->tree().parent() && !m_stateMachine.committedFirstRealDocumentLo
ad()) | 754 if (m_frame->tree().parent() && !m_stateMachine.committedFirstRealDocumentLo
ad()) |
755 return FrameLoadTypeInitialInChildFrame; | 755 return FrameLoadTypeInitialInChildFrame; |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 return; | 1513 return; |
1514 TemporaryChange<bool> | 1514 TemporaryChange<bool> |
1515 inDidClearWindowObject(m_dispatchingDidClearWindowObjectInMainWorld, tru
e); | 1515 inDidClearWindowObject(m_dispatchingDidClearWindowObjectInMainWorld, tru
e); |
1516 client()->dispatchDidClearWindowObjectInMainWorld(); | 1516 client()->dispatchDidClearWindowObjectInMainWorld(); |
1517 } | 1517 } |
1518 | 1518 |
1519 SandboxFlags FrameLoader::effectiveSandboxFlags() const | 1519 SandboxFlags FrameLoader::effectiveSandboxFlags() const |
1520 { | 1520 { |
1521 SandboxFlags flags = m_forcedSandboxFlags; | 1521 SandboxFlags flags = m_forcedSandboxFlags; |
1522 if (FrameOwner* frameOwner = m_frame->owner()) | 1522 if (FrameOwner* frameOwner = m_frame->owner()) |
1523 flags |= frameOwner->sandboxFlags(); | 1523 flags |= frameOwner->getSandboxFlags(); |
1524 // Frames need to inherit the sandbox flags of their parent frame. | 1524 // Frames need to inherit the sandbox flags of their parent frame. |
1525 if (Frame* parentFrame = m_frame->tree().parent()) | 1525 if (Frame* parentFrame = m_frame->tree().parent()) |
1526 flags |= parentFrame->securityContext()->sandboxFlags(); | 1526 flags |= parentFrame->securityContext()->getSandboxFlags(); |
1527 return flags; | 1527 return flags; |
1528 } | 1528 } |
1529 | 1529 |
1530 bool FrameLoader::shouldEnforceStrictMixedContentChecking() const | 1530 bool FrameLoader::shouldEnforceStrictMixedContentChecking() const |
1531 { | 1531 { |
1532 Frame* parentFrame = m_frame->tree().parent(); | 1532 Frame* parentFrame = m_frame->tree().parent(); |
1533 if (!parentFrame) | 1533 if (!parentFrame) |
1534 return false; | 1534 return false; |
1535 | 1535 |
1536 return parentFrame->securityContext()->shouldEnforceStrictMixedContentChecki
ng(); | 1536 return parentFrame->securityContext()->shouldEnforceStrictMixedContentChecki
ng(); |
1537 } | 1537 } |
1538 | 1538 |
1539 SecurityContext::InsecureRequestsPolicy FrameLoader::insecureRequestsPolicy() co
nst | 1539 SecurityContext::InsecureRequestsPolicy FrameLoader::getInsecureRequestsPolicy()
const |
1540 { | 1540 { |
1541 Frame* parentFrame = m_frame->tree().parent(); | 1541 Frame* parentFrame = m_frame->tree().parent(); |
1542 if (!parentFrame) | 1542 if (!parentFrame) |
1543 return SecurityContext::InsecureRequestsDoNotUpgrade; | 1543 return SecurityContext::InsecureRequestsDoNotUpgrade; |
1544 | 1544 |
1545 // FIXME: We need a way to propagate insecure requests policy flags to | 1545 // FIXME: We need a way to propagate insecure requests policy flags to |
1546 // out-of-process frames. For now, we'll always use default behavior. | 1546 // out-of-process frames. For now, we'll always use default behavior. |
1547 if (!parentFrame->isLocalFrame()) | 1547 if (!parentFrame->isLocalFrame()) |
1548 return SecurityContext::InsecureRequestsDoNotUpgrade; | 1548 return SecurityContext::InsecureRequestsDoNotUpgrade; |
1549 | 1549 |
1550 ASSERT(toLocalFrame(parentFrame)->document()); | 1550 ASSERT(toLocalFrame(parentFrame)->document()); |
1551 return toLocalFrame(parentFrame)->document()->insecureRequestsPolicy(); | 1551 return toLocalFrame(parentFrame)->document()->getInsecureRequestsPolicy(); |
1552 } | 1552 } |
1553 | 1553 |
1554 SecurityContext::InsecureNavigationsSet* FrameLoader::insecureNavigationsToUpgra
de() const | 1554 SecurityContext::InsecureNavigationsSet* FrameLoader::insecureNavigationsToUpgra
de() const |
1555 { | 1555 { |
1556 ASSERT(m_frame); | 1556 ASSERT(m_frame); |
1557 Frame* parentFrame = m_frame->tree().parent(); | 1557 Frame* parentFrame = m_frame->tree().parent(); |
1558 if (!parentFrame) | 1558 if (!parentFrame) |
1559 return nullptr; | 1559 return nullptr; |
1560 | 1560 |
1561 // FIXME: We need a way to propagate insecure requests policy flags to | 1561 // 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. | 1562 // out-of-process frames. For now, we'll always use default behavior. |
1563 if (!parentFrame->isLocalFrame()) | 1563 if (!parentFrame->isLocalFrame()) |
1564 return nullptr; | 1564 return nullptr; |
1565 | 1565 |
1566 ASSERT(toLocalFrame(parentFrame)->document()); | 1566 ASSERT(toLocalFrame(parentFrame)->document()); |
1567 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1567 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
1568 } | 1568 } |
1569 | 1569 |
1570 } // namespace blink | 1570 } // namespace blink |
OLD | NEW |