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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 | 765 |
766 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 766 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
767 | 767 |
768 if (m_inStopAllLoaders) | 768 if (m_inStopAllLoaders) |
769 return; | 769 return; |
770 | 770 |
771 FrameLoadRequest request(passedRequest); | 771 FrameLoadRequest request(passedRequest); |
772 if (!prepareRequestForThisFrame(request)) | 772 if (!prepareRequestForThisFrame(request)) |
773 return; | 773 return; |
774 | 774 |
775 RefPtrWillBeRawPtr<LocalFrame> targetFrame = request.formState() ? 0 : findF
rameForNavigation(AtomicString(request.frameName()), request.formState() ? reque
st.formState()->sourceDocument() : m_frame->document()); | 775 RefPtrWillBeRawPtr<LocalFrame> targetFrame = toLocalFrame(request.formState(
) ? nullptr : m_frame->findFrameForNavigation(AtomicString(request.frameName()),
*m_frame)); |
776 if (targetFrame && targetFrame.get() != m_frame) { | 776 if (targetFrame && targetFrame.get() != m_frame) { |
777 request.setFrameName("_self"); | 777 request.setFrameName("_self"); |
778 targetFrame->loader().load(request); | 778 targetFrame->loader().load(request); |
779 if (Page* page = targetFrame->page()) | 779 if (Page* page = targetFrame->page()) |
780 page->chrome().focus(); | 780 page->chrome().focus(); |
781 return; | 781 return; |
782 } | 782 } |
783 | 783 |
784 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe
rrer(), request.originDocument()); | 784 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe
rrer(), request.originDocument()); |
785 | 785 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 && !m_frame->document()->isFrameSet(); | 1156 && !m_frame->document()->isFrameSet(); |
1157 } | 1157 } |
1158 | 1158 |
1159 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) | 1159 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) |
1160 { | 1160 { |
1161 FrameView* view = m_frame->view(); | 1161 FrameView* view = m_frame->view(); |
1162 if (!view) | 1162 if (!view) |
1163 return; | 1163 return; |
1164 | 1164 |
1165 // Leaking scroll position to a cross-origin ancestor would permit the so-ca
lled "framesniffing" attack. | 1165 // Leaking scroll position to a cross-origin ancestor would permit the so-ca
lled "framesniffing" attack. |
1166 RefPtrWillBeRawPtr<LocalFrame> boundaryFrame = url.hasFragmentIdentifier() ?
m_frame->document()->findUnsafeParentScrollPropagationBoundary() : 0; | 1166 RefPtrWillBeRawPtr<Frame> boundaryFrame = url.hasFragmentIdentifier() ? m_fr
ame->findUnsafeParentScrollPropagationBoundary() : 0; |
1167 | 1167 |
1168 if (boundaryFrame) | 1168 // FIXME: Handle RemoteFrames |
1169 boundaryFrame->view()->setSafeToPropagateScrollToParent(false); | 1169 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
| 1170 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar
ent(false); |
1170 | 1171 |
1171 view->scrollToFragment(url); | 1172 view->scrollToFragment(url); |
1172 | 1173 |
1173 if (boundaryFrame) | 1174 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
1174 boundaryFrame->view()->setSafeToPropagateScrollToParent(true); | 1175 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar
ent(true); |
1175 } | 1176 } |
1176 | 1177 |
1177 bool FrameLoader::shouldClose() | 1178 bool FrameLoader::shouldClose() |
1178 { | 1179 { |
1179 Page* page = m_frame->page(); | 1180 Page* page = m_frame->page(); |
1180 if (!page || !page->chrome().canRunBeforeUnloadConfirmPanel()) | 1181 if (!page || !page->chrome().canRunBeforeUnloadConfirmPanel()) |
1181 return true; | 1182 return true; |
1182 | 1183 |
1183 // Store all references to each subframe in advance since beforeunload's eve
nt handler may modify frame | 1184 // Store all references to each subframe in advance since beforeunload's eve
nt handler may modify frame |
1184 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > targetFrames; | 1185 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > targetFrames; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const | 1365 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const |
1365 { | 1366 { |
1366 if (!equalIgnoringCase(url.string(), "about:srcdoc")) | 1367 if (!equalIgnoringCase(url.string(), "about:srcdoc")) |
1367 return false; | 1368 return false; |
1368 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); | 1369 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
1369 if (!isHTMLIFrameElement(ownerElement)) | 1370 if (!isHTMLIFrameElement(ownerElement)) |
1370 return false; | 1371 return false; |
1371 return ownerElement->fastHasAttribute(srcdocAttr); | 1372 return ownerElement->fastHasAttribute(srcdocAttr); |
1372 } | 1373 } |
1373 | 1374 |
1374 LocalFrame* FrameLoader::findFrameForNavigation(const AtomicString& name, Docume
nt* activeDocument) | |
1375 { | |
1376 ASSERT(activeDocument); | |
1377 Frame* frame = m_frame->tree().find(name); | |
1378 if (!frame || !frame->isLocalFrame() || !activeDocument->canNavigate(toLocal
Frame(*frame))) | |
1379 return 0; | |
1380 return toLocalFrame(frame); | |
1381 } | |
1382 | |
1383 void FrameLoader::loadHistoryItem(HistoryItem* item, FrameLoadType frameLoadType
, HistoryLoadType historyLoadType, ResourceRequestCachePolicy cachePolicy) | 1375 void FrameLoader::loadHistoryItem(HistoryItem* item, FrameLoadType frameLoadType
, HistoryLoadType historyLoadType, ResourceRequestCachePolicy cachePolicy) |
1384 { | 1376 { |
1385 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); | 1377 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
1386 if (m_frame->page()->defersLoading()) { | 1378 if (m_frame->page()->defersLoading()) { |
1387 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache
Policy); | 1379 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache
Policy); |
1388 return; | 1380 return; |
1389 } | 1381 } |
1390 | 1382 |
1391 m_provisionalItem = item; | 1383 m_provisionalItem = item; |
1392 if (historyLoadType == HistorySameDocumentLoad) { | 1384 if (historyLoadType == HistorySameDocumentLoad) { |
(...skipping 29 matching lines...) Expand all Loading... |
1422 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) | 1414 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) |
1423 return; | 1415 return; |
1424 | 1416 |
1425 client()->dispatchDidClearWindowObjectInMainWorld(); | 1417 client()->dispatchDidClearWindowObjectInMainWorld(); |
1426 } | 1418 } |
1427 | 1419 |
1428 SandboxFlags FrameLoader::effectiveSandboxFlags() const | 1420 SandboxFlags FrameLoader::effectiveSandboxFlags() const |
1429 { | 1421 { |
1430 SandboxFlags flags = m_forcedSandboxFlags; | 1422 SandboxFlags flags = m_forcedSandboxFlags; |
1431 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1423 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
1432 Frame* parentFrame = m_frame->tree().parent(); | |
1433 if (parentFrame && parentFrame->isLocalFrame()) | |
1434 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | |
1435 if (FrameOwner* frameOwner = m_frame->owner()) | 1424 if (FrameOwner* frameOwner = m_frame->owner()) |
1436 flags |= frameOwner->sandboxFlags(); | 1425 flags |= frameOwner->sandboxFlags(); |
1437 return flags; | 1426 return flags; |
1438 } | 1427 } |
1439 | 1428 |
1440 bool FrameLoader::shouldEnforceStrictMixedContentChecking() const | 1429 bool FrameLoader::shouldEnforceStrictMixedContentChecking() const |
1441 { | 1430 { |
1442 Frame* parentFrame = m_frame->tree().parent(); | 1431 Frame* parentFrame = m_frame->tree().parent(); |
1443 if (!parentFrame) | 1432 if (!parentFrame) |
1444 return false; | 1433 return false; |
1445 | 1434 |
1446 // FIXME: We need a way to propagate strict mixed content checking flags to | 1435 // FIXME: We need a way to propagate strict mixed content checking flags to |
1447 // out-of-process frames. For now, we'll always enforce. | 1436 // out-of-process frames. For now, we'll always enforce. |
1448 if (!parentFrame->isLocalFrame()) | 1437 if (!parentFrame->isLocalFrame()) |
1449 return true; | 1438 return true; |
1450 | 1439 |
1451 return toLocalFrame(parentFrame)->document()->shouldEnforceStrictMixedConten
tChecking(); | 1440 return toLocalFrame(parentFrame)->document()->shouldEnforceStrictMixedConten
tChecking(); |
1452 } | 1441 } |
1453 | 1442 |
1454 } // namespace blink | 1443 } // namespace blink |
OLD | NEW |