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 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1456 takeObjectSnapshot(); | 1456 takeObjectSnapshot(); |
1457 } | 1457 } |
1458 | 1458 |
1459 void FrameLoader::applyUserAgent(ResourceRequest& request) | 1459 void FrameLoader::applyUserAgent(ResourceRequest& request) |
1460 { | 1460 { |
1461 String userAgent = this->userAgent(); | 1461 String userAgent = this->userAgent(); |
1462 ASSERT(!userAgent.isNull()); | 1462 ASSERT(!userAgent.isNull()); |
1463 request.setHTTPUserAgent(AtomicString(userAgent)); | 1463 request.setHTTPUserAgent(AtomicString(userAgent)); |
1464 } | 1464 } |
1465 | 1465 |
1466 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con
st KURL& url, unsigned long requestIdentifier) | |
1467 { | |
1468 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOption
s); | |
1469 | |
1470 Frame* topFrame = m_frame->tree().top(); | |
1471 if (m_frame == topFrame) | |
1472 return false; | |
1473 | |
1474 XFrameOptionsDisposition disposition = parseXFrameOptionsHeader(content); | |
1475 | |
1476 switch (disposition) { | |
1477 case XFrameOptionsSameOrigin: { | |
1478 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOp
tionsSameOrigin); | |
1479 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url); | |
1480 // Out-of-process ancestors are always a different origin. | |
1481 if (!topFrame->isLocalFrame() || !origin->isSameSchemeHostPort(toLocalFr
ame(topFrame)->document()->getSecurityOrigin())) | |
1482 return true; | |
1483 for (Frame* frame = m_frame->tree().parent(); frame; frame = frame->tree
().parent()) { | |
1484 if (!frame->isLocalFrame() || !origin->isSameSchemeHostPort(toLocalF
rame(frame)->document()->getSecurityOrigin())) { | |
1485 UseCounter::count(m_frame->domWindow()->document(), UseCounter::
XFrameOptionsSameOriginWithBadAncestorChain); | |
1486 break; | |
1487 } | |
1488 } | |
1489 return false; | |
1490 } | |
1491 case XFrameOptionsDeny: | |
1492 return true; | |
1493 case XFrameOptionsAllowAll: | |
1494 return false; | |
1495 case XFrameOptionsConflict: { | |
1496 ConsoleMessage* consoleMessage = ConsoleMessage::createForRequest(JSMess
ageSource, ErrorMessageLevel, "Multiple 'X-Frame-Options' headers with conflicti
ng values ('" + content + "') encountered when loading '" + url.elidedString() +
"'. Falling back to 'DENY'.", url, requestIdentifier); | |
1497 m_frame->document()->addConsoleMessage(consoleMessage); | |
1498 return true; | |
1499 } | |
1500 case XFrameOptionsInvalid: { | |
1501 ConsoleMessage* consoleMessage = ConsoleMessage::createForRequest(JSMess
ageSource, ErrorMessageLevel, "Invalid 'X-Frame-Options' header encountered when
loading '" + url.elidedString() + "': '" + content + "' is not a recognized dir
ective. The header will be ignored.", url, requestIdentifier); | |
1502 m_frame->document()->addConsoleMessage(consoleMessage); | |
1503 return false; | |
1504 } | |
1505 default: | |
1506 NOTREACHED(); | |
1507 return false; | |
1508 } | |
1509 } | |
1510 | |
1511 bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const | 1466 bool FrameLoader::shouldTreatURLAsSameAsCurrent(const KURL& url) const |
1512 { | 1467 { |
1513 return m_currentItem && url == m_currentItem->url(); | 1468 return m_currentItem && url == m_currentItem->url(); |
1514 } | 1469 } |
1515 | 1470 |
1516 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const | 1471 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const |
1517 { | 1472 { |
1518 if (!url.isAboutSrcdocURL()) | 1473 if (!url.isAboutSrcdocURL()) |
1519 return false; | 1474 return false; |
1520 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 1475 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa
der->url() : String()); | 1608 tracedValue->setString("documentLoaderURL", m_documentLoader ? m_documentLoa
der->url() : String()); |
1654 return tracedValue; | 1609 return tracedValue; |
1655 } | 1610 } |
1656 | 1611 |
1657 inline void FrameLoader::takeObjectSnapshot() const | 1612 inline void FrameLoader::takeObjectSnapshot() const |
1658 { | 1613 { |
1659 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced
Value()); | 1614 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, toTraced
Value()); |
1660 } | 1615 } |
1661 | 1616 |
1662 } // namespace blink | 1617 } // namespace blink |
OLD | NEW |