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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 } | 1359 } |
1360 | 1360 |
1361 bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque
st, const SubstituteData& substituteData, | 1361 bool FrameLoader::shouldContinueForNavigationPolicy(const ResourceRequest& reque
st, const SubstituteData& substituteData, |
1362 DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorl
dContentSecurityPolicy, | 1362 DocumentLoader* loader, ContentSecurityPolicyDisposition shouldCheckMainWorl
dContentSecurityPolicy, |
1363 NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryIte
m, bool isClientRedirect) | 1363 NavigationType type, NavigationPolicy policy, bool replacesCurrentHistoryIte
m, bool isClientRedirect) |
1364 { | 1364 { |
1365 // Don't ask if we are loading an empty URL. | 1365 // Don't ask if we are loading an empty URL. |
1366 if (request.url().isEmpty() || substituteData.isValid()) | 1366 if (request.url().isEmpty() || substituteData.isValid()) |
1367 return true; | 1367 return true; |
1368 | 1368 |
1369 // If we're loading content into a subframe, check against the parent's Cont
ent Security Policy | 1369 // TODO(mkwst): Look into moving this to 'FrameFetchContext::canRequestInter
nal' alongside the |
1370 // and kill the load if that check fails, unless we should bypass the main w
orld's CSP. | 1370 // 'frame-src' checks. |
1371 if (shouldCheckMainWorldContentSecurityPolicy == CheckContentSecurityPolicy)
{ | |
1372 Frame* parentFrame = m_frame->tree().parent(); | |
1373 if (parentFrame) { | |
1374 ContentSecurityPolicy* parentPolicy = parentFrame->securityContext()
->contentSecurityPolicy(); | |
1375 if (!parentPolicy->allowChildFrameFromSource(request.url(), request.
redirectStatus())) { | |
1376 // Fire a load event, as timing attacks would otherwise reveal t
hat the | |
1377 // frame was blocked. This way, it looks like every other cross-
origin | |
1378 // page load. | |
1379 m_frame->document()->enforceSandboxFlags(SandboxOrigin); | |
1380 m_frame->owner()->dispatchLoad(); | |
1381 return false; | |
1382 } | |
1383 } | |
1384 } | |
1385 | |
1386 bool isFormSubmission = type == NavigationTypeFormSubmitted || type == Navig
ationTypeFormResubmitted; | 1371 bool isFormSubmission = type == NavigationTypeFormSubmitted || type == Navig
ationTypeFormResubmitted; |
1387 if (isFormSubmission && !m_frame->document()->contentSecurityPolicy()->allow
FormAction(request.url())) | 1372 if (isFormSubmission && !m_frame->document()->contentSecurityPolicy()->allow
FormAction(request.url())) |
1388 return false; | 1373 return false; |
1389 | 1374 |
1390 policy = client()->decidePolicyForNavigation(request, loader, type, policy,
replacesCurrentHistoryItem, isClientRedirect); | 1375 policy = client()->decidePolicyForNavigation(request, loader, type, policy,
replacesCurrentHistoryItem, isClientRedirect); |
1391 if (policy == NavigationPolicyCurrentTab) | 1376 if (policy == NavigationPolicyCurrentTab) |
1392 return true; | 1377 return true; |
1393 if (policy == NavigationPolicyIgnore) | 1378 if (policy == NavigationPolicyIgnore) |
1394 return false; | 1379 return false; |
1395 if (policy == NavigationPolicyHandledByClient) { | 1380 if (policy == NavigationPolicyHandledByClient) { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa
der->url() : String()); | 1609 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa
der->url() : String()); |
1625 return tracedValue; | 1610 return tracedValue; |
1626 } | 1611 } |
1627 | 1612 |
1628 inline void FrameLoader::takeObjectSnapshot() const | 1613 inline void FrameLoader::takeObjectSnapshot() const |
1629 { | 1614 { |
1630 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced
Value()); | 1615 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced
Value()); |
1631 } | 1616 } |
1632 | 1617 |
1633 } // namespace blink | 1618 } // namespace blink |
OLD | NEW |