Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Side by Side Diff: Source/core/loader/FrameLoader.cpp

Issue 799923006: Make canNavigate() OOPI-friendly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 739
740 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 740 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
741 741
742 if (m_inStopAllLoaders) 742 if (m_inStopAllLoaders)
743 return; 743 return;
744 744
745 FrameLoadRequest request(passedRequest); 745 FrameLoadRequest request(passedRequest);
746 if (!prepareRequestForThisFrame(request)) 746 if (!prepareRequestForThisFrame(request))
747 return; 747 return;
748 748
749 RefPtrWillBeRawPtr<LocalFrame> targetFrame = request.formState() ? 0 : findF rameForNavigation(AtomicString(request.frameName()), request.formState() ? reque st.formState()->sourceDocument() : m_frame->document()); 749 RefPtrWillBeRawPtr<LocalFrame> targetFrame = toLocalFrame(request.formState( ) ? 0 : m_frame->findFrameForNavigation(AtomicString(request.frameName()), m_fra me));
dcheng 2014/12/13 01:55:49 Since this is changing anyway, let's use nullptr i
Nate Chapin 2014/12/20 00:09:14 Done.
750 if (targetFrame && targetFrame.get() != m_frame) { 750 if (targetFrame && targetFrame.get() != m_frame) {
751 request.setFrameName("_self"); 751 request.setFrameName("_self");
752 targetFrame->loader().load(request); 752 targetFrame->loader().load(request);
753 if (Page* page = targetFrame->page()) 753 if (Page* page = targetFrame->page())
754 page->chrome().focus(); 754 page->chrome().focus();
755 return; 755 return;
756 } 756 }
757 757
758 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe rrer(), request.originDocument()); 758 setReferrerForFrameRequest(request.resourceRequest(), request.shouldSendRefe rrer(), request.originDocument());
759 759
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const 1393 bool FrameLoader::shouldTreatURLAsSrcdocDocument(const KURL& url) const
1394 { 1394 {
1395 if (!equalIgnoringCase(url.string(), "about:srcdoc")) 1395 if (!equalIgnoringCase(url.string(), "about:srcdoc"))
1396 return false; 1396 return false;
1397 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); 1397 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
1398 if (!isHTMLIFrameElement(ownerElement)) 1398 if (!isHTMLIFrameElement(ownerElement))
1399 return false; 1399 return false;
1400 return ownerElement->fastHasAttribute(srcdocAttr); 1400 return ownerElement->fastHasAttribute(srcdocAttr);
1401 } 1401 }
1402 1402
1403 LocalFrame* FrameLoader::findFrameForNavigation(const AtomicString& name, Docume nt* activeDocument)
1404 {
1405 ASSERT(activeDocument);
1406 Frame* frame = m_frame->tree().find(name);
1407 if (!frame || !frame->isLocalFrame() || !activeDocument->canNavigate(toLocal Frame(*frame)))
1408 return 0;
1409 return toLocalFrame(frame);
1410 }
1411
1412 void FrameLoader::loadHistoryItem(HistoryItem* item, FrameLoadType frameLoadType , HistoryLoadType historyLoadType, ResourceRequestCachePolicy cachePolicy) 1403 void FrameLoader::loadHistoryItem(HistoryItem* item, FrameLoadType frameLoadType , HistoryLoadType historyLoadType, ResourceRequestCachePolicy cachePolicy)
1413 { 1404 {
1414 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1405 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
1415 if (m_frame->page()->defersLoading()) { 1406 if (m_frame->page()->defersLoading()) {
1416 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache Policy); 1407 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache Policy);
1417 return; 1408 return;
1418 } 1409 }
1419 1410
1420 m_provisionalItem = item; 1411 m_provisionalItem = item;
1421 if (historyLoadType == HistorySameDocumentLoad) { 1412 if (historyLoadType == HistorySameDocumentLoad) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript)) 1445 if (!m_frame->script().canExecuteScripts(NotAboutToExecuteScript))
1455 return; 1446 return;
1456 1447
1457 client()->dispatchDidClearWindowObjectInMainWorld(); 1448 client()->dispatchDidClearWindowObjectInMainWorld();
1458 } 1449 }
1459 1450
1460 SandboxFlags FrameLoader::effectiveSandboxFlags() const 1451 SandboxFlags FrameLoader::effectiveSandboxFlags() const
1461 { 1452 {
1462 SandboxFlags flags = m_forcedSandboxFlags; 1453 SandboxFlags flags = m_forcedSandboxFlags;
1463 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. 1454 // FIXME: We need a way to propagate sandbox flags to out-of-process frames.
1464 Frame* parentFrame = m_frame->tree().parent();
1465 if (parentFrame && parentFrame->isLocalFrame())
1466 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags();
1467 if (FrameOwner* frameOwner = m_frame->owner()) 1455 if (FrameOwner* frameOwner = m_frame->owner())
1468 flags |= frameOwner->sandboxFlags(); 1456 flags |= frameOwner->sandboxFlags();
1469 return flags; 1457 return flags;
1470 } 1458 }
1471 1459
1472 } // namespace blink 1460 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698