| 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 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 m_provisionalDocumentLoader->startLoadingMainResource(); | 1417 m_provisionalDocumentLoader->startLoadingMainResource(); |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 void FrameLoader::applyUserAgent(ResourceRequest& request) | 1420 void FrameLoader::applyUserAgent(ResourceRequest& request) |
| 1421 { | 1421 { |
| 1422 String userAgent = this->userAgent(); | 1422 String userAgent = this->userAgent(); |
| 1423 ASSERT(!userAgent.isNull()); | 1423 ASSERT(!userAgent.isNull()); |
| 1424 request.setHTTPUserAgent(AtomicString(userAgent)); | 1424 request.setHTTPUserAgent(AtomicString(userAgent)); |
| 1425 } | 1425 } |
| 1426 | 1426 |
| 1427 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con
st KURL& url, unsigned long requestIdentifier) | |
| 1428 { | |
| 1429 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOption
s); | |
| 1430 | |
| 1431 Frame* topFrame = m_frame->tree().top(); | |
| 1432 if (m_frame == topFrame) | |
| 1433 return false; | |
| 1434 | |
| 1435 XFrameOptionsDisposition disposition = parseXFrameOptionsHeader(content); | |
| 1436 | |
| 1437 switch (disposition) { | |
| 1438 case XFrameOptionsSameOrigin: { | |
| 1439 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOp
tionsSameOrigin); | |
| 1440 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url); | |
| 1441 // Out-of-process ancestors are always a different origin. | |
| 1442 if (!topFrame->isLocalFrame() || !origin->isSameSchemeHostPort(toLocalFr
ame(topFrame)->document()->getSecurityOrigin())) | |
| 1443 return true; | |
| 1444 for (Frame* frame = m_frame->tree().parent(); frame; frame = frame->tree
().parent()) { | |
| 1445 if (!frame->isLocalFrame() || !origin->isSameSchemeHostPort(toLocalF
rame(frame)->document()->getSecurityOrigin())) { | |
| 1446 UseCounter::count(m_frame->domWindow()->document(), UseCounter::
XFrameOptionsSameOriginWithBadAncestorChain); | |
| 1447 break; | |
| 1448 } | |
| 1449 } | |
| 1450 return false; | |
| 1451 } | |
| 1452 case XFrameOptionsDeny: | |
| 1453 return true; | |
| 1454 case XFrameOptionsAllowAll: | |
| 1455 return false; | |
| 1456 case XFrameOptionsConflict: { | |
| 1457 ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource,
ErrorMessageLevel, "Multiple 'X-Frame-Options' headers with conflicting values
('" + content + "') encountered when loading '" + url.elidedString() + "'. Falli
ng back to 'DENY'."); | |
| 1458 consoleMessage->setRequestIdentifier(requestIdentifier); | |
| 1459 m_frame->document()->addConsoleMessage(consoleMessage); | |
| 1460 return true; | |
| 1461 } | |
| 1462 case XFrameOptionsInvalid: { | |
| 1463 ConsoleMessage* consoleMessage = ConsoleMessage::create(JSMessageSource,
ErrorMessageLevel, "Invalid 'X-Frame-Options' header encountered when loading '
" + url.elidedString() + "': '" + content + "' is not a recognized directive. Th
e header will be ignored."); | |
| 1464 consoleMessage->setRequestIdentifier(requestIdentifier); | |
| 1465 m_frame->document()->addConsoleMessage(consoleMessage); | |
| 1466 return false; | |
| 1467 } | |
| 1468 default: | |
| 1469 ASSERT_NOT_REACHED(); | |
| 1470 return false; | |
| 1471 } | |
| 1472 } | |
| 1473 | |
| 1474 bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const | 1427 bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const |
| 1475 { | 1428 { |
| 1476 return m_currentItem && url == m_currentItem->url(); | 1429 return m_currentItem && url == m_currentItem->url(); |
| 1477 } | 1430 } |
| 1478 | 1431 |
| 1479 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const | 1432 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const |
| 1480 { | 1433 { |
| 1481 if (!url.isAboutSrcdocURL()) | 1434 if (!url.isAboutSrcdocURL()) |
| 1482 return false; | 1435 return false; |
| 1483 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 1436 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 // FIXME: We need a way to propagate insecure requests policy flags to | 1524 // FIXME: We need a way to propagate insecure requests policy flags to |
| 1572 // out-of-process frames. For now, we'll always use default behavior. | 1525 // out-of-process frames. For now, we'll always use default behavior. |
| 1573 if (!parentFrame->isLocalFrame()) | 1526 if (!parentFrame->isLocalFrame()) |
| 1574 return nullptr; | 1527 return nullptr; |
| 1575 | 1528 |
| 1576 ASSERT(toLocalFrame(parentFrame)->document()); | 1529 ASSERT(toLocalFrame(parentFrame)->document()); |
| 1577 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1530 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
| 1578 } | 1531 } |
| 1579 | 1532 |
| 1580 } // namespace blink | 1533 } // namespace blink |
| OLD | NEW |