| 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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 | 781 |
| 782 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 782 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
| 783 | 783 |
| 784 if (m_inStopAllLoaders) | 784 if (m_inStopAllLoaders) |
| 785 return; | 785 return; |
| 786 | 786 |
| 787 FrameLoadRequest request(passedRequest); | 787 FrameLoadRequest request(passedRequest); |
| 788 if (!prepareRequestForThisFrame(request)) | 788 if (!prepareRequestForThisFrame(request)) |
| 789 return; | 789 return; |
| 790 | 790 |
| 791 RefPtrWillBeRawPtr<LocalFrame> targetFrame = request.formState() ? 0 : findF
rameForNavigation(AtomicString(request.frameName()), request.formState() ? reque
st.formState()->sourceDocument() : m_frame->document()); | 791 RefPtrWillBeRawPtr<LocalFrame> targetFrame = toLocalFrame(request.formState(
) ? nullptr : m_frame->findFrameForNavigation(AtomicString(request.frameName()),
*m_frame)); |
| 792 if (targetFrame && targetFrame.get() != m_frame) { | 792 if (targetFrame && targetFrame.get() != m_frame) { |
| 793 request.setFrameName("_self"); | 793 request.setFrameName("_self"); |
| 794 targetFrame->loader().load(request); | 794 targetFrame->loader().load(request); |
| 795 if (Page* page = targetFrame->page()) | 795 if (Page* page = targetFrame->page()) |
| 796 page->chrome().focus(); | 796 page->chrome().focus(); |
| 797 return; | 797 return; |
| 798 } | 798 } |
| 799 | 799 |
| 800 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe
rrer(), request.originDocument()); | 800 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe
rrer(), request.originDocument()); |
| 801 | 801 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 && !m_frame->document()->isFrameSet(); | 1188 && !m_frame->document()->isFrameSet(); |
| 1189 } | 1189 } |
| 1190 | 1190 |
| 1191 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) | 1191 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) |
| 1192 { | 1192 { |
| 1193 FrameView* view = m_frame->view(); | 1193 FrameView* view = m_frame->view(); |
| 1194 if (!view) | 1194 if (!view) |
| 1195 return; | 1195 return; |
| 1196 | 1196 |
| 1197 // Leaking scroll position to a cross-origin ancestor would permit the so-ca
lled "framesniffing" attack. | 1197 // Leaking scroll position to a cross-origin ancestor would permit the so-ca
lled "framesniffing" attack. |
| 1198 RefPtrWillBeRawPtr<LocalFrame> boundaryFrame = url.hasFragmentIdentifier() ?
m_frame->document()->findUnsafeParentScrollPropagationBoundary() : 0; | 1198 RefPtrWillBeRawPtr<Frame> boundaryFrame = url.hasFragmentIdentifier() ? m_fr
ame->findUnsafeParentScrollPropagationBoundary() : 0; |
| 1199 | 1199 |
| 1200 if (boundaryFrame) | 1200 // FIXME: Handle RemoteFrames |
| 1201 boundaryFrame->view()->setSafeToPropagateScrollToParent(false); | 1201 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
| 1202 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar
ent(false); |
| 1202 | 1203 |
| 1203 view->scrollToFragment(url); | 1204 view->scrollToFragment(url); |
| 1204 | 1205 |
| 1205 if (boundaryFrame) | 1206 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
| 1206 boundaryFrame->view()->setSafeToPropagateScrollToParent(true); | 1207 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar
ent(true); |
| 1207 } | 1208 } |
| 1208 | 1209 |
| 1209 bool FrameLoader::shouldClose() | 1210 bool FrameLoader::shouldClose() |
| 1210 { | 1211 { |
| 1211 Page* page = m_frame->page(); | 1212 Page* page = m_frame->page(); |
| 1212 if (!page || !page->chrome().canRunBeforeUnloadConfirmPanel()) | 1213 if (!page || !page->chrome().canRunBeforeUnloadConfirmPanel()) |
| 1213 return true; | 1214 return true; |
| 1214 | 1215 |
| 1215 // Store all references to each subframe in advance since beforeunload's eve
nt handler may modify frame | 1216 // Store all references to each subframe in advance since beforeunload's eve
nt handler may modify frame |
| 1216 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > targetFrames; | 1217 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > targetFrames; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1400 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const | 1401 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const |
| 1401 { | 1402 { |
| 1402 if (!equalIgnoringCase(url.string(), "about:srcdoc")) | 1403 if (!equalIgnoringCase(url.string(), "about:srcdoc")) |
| 1403 return false; | 1404 return false; |
| 1404 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 1405 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
| 1405 if (!isHTMLIFrameElement(ownerElement)) | 1406 if (!isHTMLIFrameElement(ownerElement)) |
| 1406 return false; | 1407 return false; |
| 1407 return ownerElement->fastHasAttribute(srcdocAttr); | 1408 return ownerElement->fastHasAttribute(srcdocAttr); |
| 1408 } | 1409 } |
| 1409 | 1410 |
| 1410 LocalFrame* FrameLoader::findFrameForNavigation(const AtomicString& name, Docume
nt* activeDocument) | |
| 1411 { | |
| 1412 ASSERT(activeDocument); | |
| 1413 Frame* frame = m_frame->tree().find(name); | |
| 1414 if (!frame || !frame->isLocalFrame() || !activeDocument->canNavigate(toLocal
Frame(*frame))) | |
| 1415 return 0; | |
| 1416 return toLocalFrame(frame); | |
| 1417 } | |
| 1418 | |
| 1419 void FrameLoader::loadHistoryItem(HistoryItem* item, FrameLoadType frameLoadType
, HistoryLoadType historyLoadType, ResourceRequestCachePolicy cachePolicy) | 1411 void FrameLoader::loadHistoryItem(HistoryItem* item, FrameLoadType frameLoadType
, HistoryLoadType historyLoadType, ResourceRequestCachePolicy cachePolicy) |
| 1420 { | 1412 { |
| 1421 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 1413 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
| 1422 if (m_frame->page()->defersLoading()) { | 1414 if (m_frame->page()->defersLoading()) { |
| 1423 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache
Policy); | 1415 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache
Policy); |
| 1424 return; | 1416 return; |
| 1425 } | 1417 } |
| 1426 | 1418 |
| 1427 m_provisionalItem = item; | 1419 m_provisionalItem = item; |
| 1428 if (historyLoadType == HistorySameDocumentLoad) { | 1420 if (historyLoadType == HistorySameDocumentLoad) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1458 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 1450 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
| 1459 return; | 1451 return; |
| 1460 | 1452 |
| 1461 client()->dispatchDidClearWindowObjectInMainWorld(); | 1453 client()->dispatchDidClearWindowObjectInMainWorld(); |
| 1462 } | 1454 } |
| 1463 | 1455 |
| 1464 SandboxFlags FrameLoader::effectiveSandboxFlags() const | 1456 SandboxFlags FrameLoader::effectiveSandboxFlags() const |
| 1465 { | 1457 { |
| 1466 SandboxFlags flags = m_forcedSandboxFlags; | 1458 SandboxFlags flags = m_forcedSandboxFlags; |
| 1467 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1459 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
| 1468 Frame* parentFrame = m_frame->tree().parent(); | |
| 1469 if (parentFrame && parentFrame->isLocalFrame()) | |
| 1470 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | |
| 1471 if (FrameOwner* frameOwner = m_frame->owner()) | 1460 if (FrameOwner* frameOwner = m_frame->owner()) |
| 1472 flags |= frameOwner->sandboxFlags(); | 1461 flags |= frameOwner->sandboxFlags(); |
| 1473 return flags; | 1462 return flags; |
| 1474 } | 1463 } |
| 1475 | 1464 |
| 1476 bool FrameLoader::shouldEnforceStrictMixedContentChecking() const | 1465 bool FrameLoader::shouldEnforceStrictMixedContentChecking() const |
| 1477 { | 1466 { |
| 1478 Frame* parentFrame = m_frame->tree().parent(); | 1467 Frame* parentFrame = m_frame->tree().parent(); |
| 1479 if (!parentFrame) | 1468 if (!parentFrame) |
| 1480 return false; | 1469 return false; |
| 1481 | 1470 |
| 1482 // FIXME: We need a way to propagate strict mixed content checking flags to | 1471 // FIXME: We need a way to propagate strict mixed content checking flags to |
| 1483 // out-of-process frames. For now, we'll always enforce. | 1472 // out-of-process frames. For now, we'll always enforce. |
| 1484 if (!parentFrame->isLocalFrame()) | 1473 if (!parentFrame->isLocalFrame()) |
| 1485 return true; | 1474 return true; |
| 1486 | 1475 |
| 1487 return toLocalFrame(parentFrame)->document()->shouldEnforceStrictMixedConten
tChecking(); | 1476 return toLocalFrame(parentFrame)->document()->shouldEnforceStrictMixedConten
tChecking(); |
| 1488 } | 1477 } |
| 1489 | 1478 |
| 1490 } // namespace blink | 1479 } // namespace blink |
| OLD | NEW |