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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 } | 414 } |
415 | 415 |
416 void FrameLoader::receivedFirstData() | 416 void FrameLoader::receivedFirstData() |
417 { | 417 { |
418 if (m_stateMachine.creatingInitialEmptyDocument()) | 418 if (m_stateMachine.creatingInitialEmptyDocument()) |
419 return; | 419 return; |
420 | 420 |
421 HistoryCommitType historyCommitType = loadTypeToCommitType(m_loadType); | 421 HistoryCommitType historyCommitType = loadTypeToCommitType(m_loadType); |
422 if (historyCommitType == StandardCommit && (m_documentLoader->urlForHistory(
).isEmpty() || (opener() && !m_currentItem && m_documentLoader->originalRequest(
).url().isEmpty()))) | 422 if (historyCommitType == StandardCommit && (m_documentLoader->urlForHistory(
).isEmpty() || (opener() && !m_currentItem && m_documentLoader->originalRequest(
).url().isEmpty()))) |
423 historyCommitType = HistoryInertCommit; | 423 historyCommitType = HistoryInertCommit; |
424 else if (historyCommitType == InitialCommitInChildFrame && MixedContentCheck
er::isMixedContent(m_frame->tree().top()->securityContext()->securityOrigin(), m
_documentLoader->url())) | 424 else if (historyCommitType == InitialCommitInChildFrame && MixedContentCheck
er::isMixedContent(m_frame->tree().top()->securityContext()->getSecurityOrigin()
, m_documentLoader->url())) |
425 historyCommitType = HistoryInertCommit; | 425 historyCommitType = HistoryInertCommit; |
426 setHistoryItemStateForCommit(historyCommitType, HistoryNavigationType::Diffe
rentDocument); | 426 setHistoryItemStateForCommit(historyCommitType, HistoryNavigationType::Diffe
rentDocument); |
427 | 427 |
428 if (!m_stateMachine.committedMultipleRealLoads() && m_loadType == FrameLoadT
ypeStandard) | 428 if (!m_stateMachine.committedMultipleRealLoads() && m_loadType == FrameLoadT
ypeStandard) |
429 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedMultipleRealL
oads); | 429 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedMultipleRealL
oads); |
430 | 430 |
431 client()->dispatchDidCommitLoad(m_currentItem.get(), historyCommitType); | 431 client()->dispatchDidCommitLoad(m_currentItem.get(), historyCommitType); |
432 | 432 |
433 TRACE_EVENT1("devtools.timeline", "CommitLoad", "data", InspectorCommitLoadE
vent::data(m_frame)); | 433 TRACE_EVENT1("devtools.timeline", "CommitLoad", "data", InspectorCommitLoadE
vent::data(m_frame)); |
434 InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get()); | 434 InspectorInstrumentation::didCommitLoad(m_frame, m_documentLoader.get()); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) | 790 bool FrameLoader::prepareRequestForThisFrame(FrameLoadRequest& request) |
791 { | 791 { |
792 // If no origin Document* was specified, skip remaining security checks and
assume the caller has fully initialized the FrameLoadRequest. | 792 // If no origin Document* was specified, skip remaining security checks and
assume the caller has fully initialized the FrameLoadRequest. |
793 if (!request.originDocument()) | 793 if (!request.originDocument()) |
794 return true; | 794 return true; |
795 | 795 |
796 KURL url = request.resourceRequest().url(); | 796 KURL url = request.resourceRequest().url(); |
797 if (m_frame->script().executeScriptIfJavaScriptURL(url)) | 797 if (m_frame->script().executeScriptIfJavaScriptURL(url)) |
798 return false; | 798 return false; |
799 | 799 |
800 if (!request.originDocument()->securityOrigin()->canDisplay(url)) { | 800 if (!request.originDocument()->getSecurityOrigin()->canDisplay(url)) { |
801 reportLocalLoadFailed(m_frame, url.elidedString()); | 801 reportLocalLoadFailed(m_frame, url.elidedString()); |
802 return false; | 802 return false; |
803 } | 803 } |
804 | 804 |
805 if (!request.form() && request.frameName().isEmpty()) | 805 if (!request.form() && request.frameName().isEmpty()) |
806 request.setFrameName(m_frame->document()->baseTarget()); | 806 request.setFrameName(m_frame->document()->baseTarget()); |
807 return true; | 807 return true; |
808 } | 808 } |
809 | 809 |
810 static bool shouldOpenInNewWindow(Frame* targetFrame, const FrameLoadRequest& re
quest, NavigationPolicy policy) | 810 static bool shouldOpenInNewWindow(Frame* targetFrame, const FrameLoadRequest& re
quest, NavigationPolicy policy) |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 if (m_frame == topFrame) | 1442 if (m_frame == topFrame) |
1443 return false; | 1443 return false; |
1444 | 1444 |
1445 XFrameOptionsDisposition disposition = parseXFrameOptionsHeader(content); | 1445 XFrameOptionsDisposition disposition = parseXFrameOptionsHeader(content); |
1446 | 1446 |
1447 switch (disposition) { | 1447 switch (disposition) { |
1448 case XFrameOptionsSameOrigin: { | 1448 case XFrameOptionsSameOrigin: { |
1449 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOp
tionsSameOrigin); | 1449 UseCounter::count(m_frame->domWindow()->document(), UseCounter::XFrameOp
tionsSameOrigin); |
1450 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url); | 1450 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url); |
1451 // Out-of-process ancestors are always a different origin. | 1451 // Out-of-process ancestors are always a different origin. |
1452 if (!topFrame->isLocalFrame() || !origin->isSameSchemeHostPort(toLocalFr
ame(topFrame)->document()->securityOrigin())) | 1452 if (!topFrame->isLocalFrame() || !origin->isSameSchemeHostPort(toLocalFr
ame(topFrame)->document()->getSecurityOrigin())) |
1453 return true; | 1453 return true; |
1454 for (Frame* frame = m_frame->tree().parent(); frame; frame = frame->tree
().parent()) { | 1454 for (Frame* frame = m_frame->tree().parent(); frame; frame = frame->tree
().parent()) { |
1455 if (!frame->isLocalFrame() || !origin->isSameSchemeHostPort(toLocalF
rame(frame)->document()->securityOrigin())) { | 1455 if (!frame->isLocalFrame() || !origin->isSameSchemeHostPort(toLocalF
rame(frame)->document()->getSecurityOrigin())) { |
1456 UseCounter::count(m_frame->domWindow()->document(), UseCounter::
XFrameOptionsSameOriginWithBadAncestorChain); | 1456 UseCounter::count(m_frame->domWindow()->document(), UseCounter::
XFrameOptionsSameOriginWithBadAncestorChain); |
1457 break; | 1457 break; |
1458 } | 1458 } |
1459 } | 1459 } |
1460 return false; | 1460 return false; |
1461 } | 1461 } |
1462 case XFrameOptionsDeny: | 1462 case XFrameOptionsDeny: |
1463 return true; | 1463 return true; |
1464 case XFrameOptionsAllowAll: | 1464 case XFrameOptionsAllowAll: |
1465 return false; | 1465 return false; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1574 // FIXME: We need a way to propagate insecure requests policy flags to | 1574 // FIXME: We need a way to propagate insecure requests policy flags to |
1575 // out-of-process frames. For now, we'll always use default behavior. | 1575 // out-of-process frames. For now, we'll always use default behavior. |
1576 if (!parentFrame->isLocalFrame()) | 1576 if (!parentFrame->isLocalFrame()) |
1577 return nullptr; | 1577 return nullptr; |
1578 | 1578 |
1579 ASSERT(toLocalFrame(parentFrame)->document()); | 1579 ASSERT(toLocalFrame(parentFrame)->document()); |
1580 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; | 1580 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade()
; |
1581 } | 1581 } |
1582 | 1582 |
1583 } // namespace blink | 1583 } // namespace blink |
OLD | NEW |