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

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

Issue 31063004: Have Frame::loader() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « Source/core/loader/FrameFetchContext.cpp ('k') | Source/core/loader/HistoryController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 , m_forcedSandboxFlags(SandboxNone) 172 , m_forcedSandboxFlags(SandboxNone)
173 { 173 {
174 } 174 }
175 175
176 FrameLoader::~FrameLoader() 176 FrameLoader::~FrameLoader()
177 { 177 {
178 setOpener(0); 178 setOpener(0);
179 179
180 HashSet<Frame*>::iterator end = m_openedFrames.end(); 180 HashSet<Frame*>::iterator end = m_openedFrames.end();
181 for (HashSet<Frame*>::iterator it = m_openedFrames.begin(); it != end; ++it) 181 for (HashSet<Frame*>::iterator it = m_openedFrames.begin(); it != end; ++it)
182 (*it)->loader()->m_opener = 0; 182 (*it)->loader().m_opener = 0;
183 183
184 m_client->frameLoaderDestroyed(); 184 m_client->frameLoaderDestroyed();
185 } 185 }
186 186
187 void FrameLoader::init() 187 void FrameLoader::init()
188 { 188 {
189 // This somewhat odd set of steps gives the frame an initial empty document. 189 // This somewhat odd set of steps gives the frame an initial empty document.
190 m_provisionalDocumentLoader = m_client->createDocumentLoader(ResourceRequest (KURL(ParsedURLString, emptyString())), SubstituteData()); 190 m_provisionalDocumentLoader = m_client->createDocumentLoader(ResourceRequest (KURL(ParsedURLString, emptyString())), SubstituteData());
191 m_provisionalDocumentLoader->setFrame(m_frame); 191 m_provisionalDocumentLoader->setFrame(m_frame);
192 m_provisionalDocumentLoader->startLoadingMainResource(); 192 m_provisionalDocumentLoader->startLoadingMainResource();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 } 384 }
385 385
386 void FrameLoader::loadDone() 386 void FrameLoader::loadDone()
387 { 387 {
388 checkCompleted(); 388 checkCompleted();
389 } 389 }
390 390
391 bool FrameLoader::allChildrenAreComplete() const 391 bool FrameLoader::allChildrenAreComplete() const
392 { 392 {
393 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { 393 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
394 if (!child->loader()->m_isComplete) 394 if (!child->loader().m_isComplete)
395 return false; 395 return false;
396 } 396 }
397 return true; 397 return true;
398 } 398 }
399 399
400 bool FrameLoader::allAncestorsAreComplete() const 400 bool FrameLoader::allAncestorsAreComplete() const
401 { 401 {
402 for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree().parent ()) { 402 for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree().parent ()) {
403 if (!ancestor->document()->loadEventFinished()) 403 if (!ancestor->document()->loadEventFinished())
404 return false; 404 return false;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 { 481 {
482 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources 482 // See http://www.whatwg.org/specs/web-apps/current-work/#fetching-resources
483 // for why we walk the parent chain for srcdoc documents. 483 // for why we walk the parent chain for srcdoc documents.
484 Frame* frame = m_frame; 484 Frame* frame = m_frame;
485 while (frame->document()->isSrcdocDocument()) { 485 while (frame->document()->isSrcdocDocument()) {
486 frame = frame->tree().parent(); 486 frame = frame->tree().parent();
487 // Srcdoc documents cannot be top-level documents, by definition, 487 // Srcdoc documents cannot be top-level documents, by definition,
488 // because they need to be contained in iframes with the srcdoc. 488 // because they need to be contained in iframes with the srcdoc.
489 ASSERT(frame); 489 ASSERT(frame);
490 } 490 }
491 return frame->loader()->m_outgoingReferrer; 491 return frame->loader().m_outgoingReferrer;
492 } 492 }
493 493
494 String FrameLoader::outgoingOrigin() const 494 String FrameLoader::outgoingOrigin() const
495 { 495 {
496 return m_frame->document()->securityOrigin()->toString(); 496 return m_frame->document()->securityOrigin()->toString();
497 } 497 }
498 498
499 Frame* FrameLoader::opener() 499 Frame* FrameLoader::opener()
500 { 500 {
501 return m_opener; 501 return m_opener;
502 } 502 }
503 503
504 void FrameLoader::setOpener(Frame* opener) 504 void FrameLoader::setOpener(Frame* opener)
505 { 505 {
506 if (m_opener && !opener) 506 if (m_opener && !opener)
507 m_client->didDisownOpener(); 507 m_client->didDisownOpener();
508 508
509 if (m_opener) 509 if (m_opener)
510 m_opener->loader()->m_openedFrames.remove(m_frame); 510 m_opener->loader().m_openedFrames.remove(m_frame);
511 if (opener) 511 if (opener)
512 opener->loader()->m_openedFrames.add(m_frame); 512 opener->loader().m_openedFrames.add(m_frame);
513 m_opener = opener; 513 m_opener = opener;
514 514
515 if (m_frame->document()) 515 if (m_frame->document())
516 m_frame->document()->initSecurityContext(); 516 m_frame->document()->initSecurityContext();
517 } 517 }
518 518
519 bool FrameLoader::allowPlugins(ReasonForCallingAllowPlugins reason) 519 bool FrameLoader::allowPlugins(ReasonForCallingAllowPlugins reason)
520 { 520 {
521 Settings* settings = m_frame->settings(); 521 Settings* settings = m_frame->settings();
522 bool allowed = m_client->allowPlugins(settings && settings->arePluginsEnable d()); 522 bool allowed = m_client->allowPlugins(settings && settings->arePluginsEnable d());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 } 601 }
602 602
603 void FrameLoader::completed() 603 void FrameLoader::completed()
604 { 604 {
605 RefPtr<Frame> protect(m_frame); 605 RefPtr<Frame> protect(m_frame);
606 606
607 for (Frame* descendant = m_frame->tree().traverseNext(m_frame); descendant; descendant = descendant->tree().traverseNext(m_frame)) 607 for (Frame* descendant = m_frame->tree().traverseNext(m_frame); descendant; descendant = descendant->tree().traverseNext(m_frame))
608 descendant->navigationScheduler().startTimer(); 608 descendant->navigationScheduler().startTimer();
609 609
610 if (Frame* parent = m_frame->tree().parent()) 610 if (Frame* parent = m_frame->tree().parent())
611 parent->loader()->checkCompleted(); 611 parent->loader().checkCompleted();
612 612
613 if (m_frame->view()) 613 if (m_frame->view())
614 m_frame->view()->maintainScrollPositionAtAnchor(0); 614 m_frame->view()->maintainScrollPositionAtAnchor(0);
615 } 615 }
616 616
617 void FrameLoader::started() 617 void FrameLoader::started()
618 { 618 {
619 for (Frame* frame = m_frame; frame; frame = frame->tree().parent()) 619 for (Frame* frame = m_frame; frame; frame = frame->tree().parent())
620 frame->loader()->m_isComplete = false; 620 frame->loader().m_isComplete = false;
621 } 621 }
622 622
623 void FrameLoader::prepareForHistoryNavigation() 623 void FrameLoader::prepareForHistoryNavigation()
624 { 624 {
625 // If there is no currentItem, but we still want to engage in 625 // If there is no currentItem, but we still want to engage in
626 // history navigation we need to manufacture one, and update 626 // history navigation we need to manufacture one, and update
627 // the state machine of this frame to impersonate having 627 // the state machine of this frame to impersonate having
628 // loaded it. 628 // loaded it.
629 RefPtr<HistoryItem> currentItem = history()->currentItem(); 629 RefPtr<HistoryItem> currentItem = history()->currentItem();
630 if (!currentItem) { 630 if (!currentItem) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 if (m_inStopAllLoaders) 726 if (m_inStopAllLoaders)
727 return; 727 return;
728 728
729 FrameLoadRequest request(passedRequest); 729 FrameLoadRequest request(passedRequest);
730 if (!prepareRequestForThisFrame(request)) 730 if (!prepareRequestForThisFrame(request))
731 return; 731 return;
732 732
733 RefPtr<Frame> targetFrame = findFrameForNavigation(request.frameName(), requ est.formState() ? request.formState()->sourceDocument() : m_frame->document()); 733 RefPtr<Frame> targetFrame = findFrameForNavigation(request.frameName(), requ est.formState() ? request.formState()->sourceDocument() : m_frame->document());
734 if (targetFrame && targetFrame != m_frame) { 734 if (targetFrame && targetFrame != m_frame) {
735 request.setFrameName("_self"); 735 request.setFrameName("_self");
736 targetFrame->loader()->load(request); 736 targetFrame->loader().load(request);
737 if (Page* page = targetFrame->page()) 737 if (Page* page = targetFrame->page())
738 page->chrome().focus(); 738 page->chrome().focus();
739 return; 739 return;
740 } 740 }
741 741
742 FrameLoadType newLoadType = determineFrameLoadType(request); 742 FrameLoadType newLoadType = determineFrameLoadType(request);
743 NavigationAction action(request.resourceRequest(), newLoadType, request.form State(), request.triggeringEvent()); 743 NavigationAction action(request.resourceRequest(), newLoadType, request.form State(), request.triggeringEvent());
744 if (shouldOpenInNewWindow(targetFrame.get(), request, action)) { 744 if (shouldOpenInNewWindow(targetFrame.get(), request, action)) {
745 TemporaryChange<bool> changeOpener(m_suppressOpenerInNewFrame, request.s houldSendReferrer() == NeverSendReferrer); 745 TemporaryChange<bool> changeOpener(m_suppressOpenerInNewFrame, request.s houldSendReferrer() == NeverSendReferrer);
746 checkNewWindowPolicyAndContinue(request.formState(), request.frameName() , action); 746 checkNewWindowPolicyAndContinue(request.formState(), request.frameName() , action);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 if (m_inStopAllLoaders) 812 if (m_inStopAllLoaders)
813 return; 813 return;
814 814
815 // Calling stopLoading() on the provisional document loader can blow away 815 // Calling stopLoading() on the provisional document loader can blow away
816 // the frame from underneath. 816 // the frame from underneath.
817 RefPtr<Frame> protect(m_frame); 817 RefPtr<Frame> protect(m_frame);
818 818
819 m_inStopAllLoaders = true; 819 m_inStopAllLoaders = true;
820 820
821 for (RefPtr<Frame> child = m_frame->tree().firstChild(); child; child = chil d->tree().nextSibling()) 821 for (RefPtr<Frame> child = m_frame->tree().firstChild(); child; child = chil d->tree().nextSibling())
822 child->loader()->stopAllLoaders(); 822 child->loader().stopAllLoaders();
823 if (m_provisionalDocumentLoader) 823 if (m_provisionalDocumentLoader)
824 m_provisionalDocumentLoader->stopLoading(); 824 m_provisionalDocumentLoader->stopLoading();
825 if (m_documentLoader) 825 if (m_documentLoader)
826 m_documentLoader->stopLoading(); 826 m_documentLoader->stopLoading();
827 827
828 if (m_provisionalDocumentLoader) 828 if (m_provisionalDocumentLoader)
829 m_provisionalDocumentLoader->detachFromFrame(); 829 m_provisionalDocumentLoader->detachFromFrame();
830 m_provisionalDocumentLoader = 0; 830 m_provisionalDocumentLoader = 0;
831 831
832 m_checkTimer.stop(); 832 m_checkTimer.stop();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 } 923 }
924 started(); 924 started();
925 } 925 }
926 926
927 void FrameLoader::closeOldDataSources() 927 void FrameLoader::closeOldDataSources()
928 { 928 {
929 // FIXME: Is it important for this traversal to be postorder instead of preo rder? 929 // FIXME: Is it important for this traversal to be postorder instead of preo rder?
930 // If so, add helpers for postorder traversal, and use them. If not, then le ts not 930 // If so, add helpers for postorder traversal, and use them. If not, then le ts not
931 // use a recursive algorithm here. 931 // use a recursive algorithm here.
932 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) 932 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling())
933 child->loader()->closeOldDataSources(); 933 child->loader().closeOldDataSources();
934 934
935 if (m_documentLoader) 935 if (m_documentLoader)
936 m_client->dispatchWillClose(); 936 m_client->dispatchWillClose();
937 } 937 }
938 938
939 bool FrameLoader::isLoadingMainFrame() const 939 bool FrameLoader::isLoadingMainFrame() const
940 { 940 {
941 Page* page = m_frame->page(); 941 Page* page = m_frame->page();
942 return page && m_frame == page->mainFrame(); 942 return page && m_frame == page->mainFrame();
943 } 943 }
944 944
945 bool FrameLoader::subframeIsLoading() const 945 bool FrameLoader::subframeIsLoading() const
946 { 946 {
947 // It's most likely that the last added frame is the last to load so we walk backwards. 947 // It's most likely that the last added frame is the last to load so we walk backwards.
948 for (Frame* child = m_frame->tree().lastChild(); child; child = child->tree( ).previousSibling()) { 948 for (Frame* child = m_frame->tree().lastChild(); child; child = child->tree( ).previousSibling()) {
949 FrameLoader* childLoader = child->loader(); 949 const FrameLoader& childLoader = child->loader();
950 DocumentLoader* documentLoader = childLoader->documentLoader(); 950 DocumentLoader* documentLoader = childLoader.documentLoader();
951 if (documentLoader && documentLoader->isLoadingInAPISense()) 951 if (documentLoader && documentLoader->isLoadingInAPISense())
952 return true; 952 return true;
953 documentLoader = childLoader->provisionalDocumentLoader(); 953 documentLoader = childLoader.provisionalDocumentLoader();
954 if (documentLoader && documentLoader->isLoadingInAPISense()) 954 if (documentLoader && documentLoader->isLoadingInAPISense())
955 return true; 955 return true;
956 documentLoader = childLoader->policyDocumentLoader(); 956 documentLoader = childLoader.policyDocumentLoader();
957 if (documentLoader) 957 if (documentLoader)
958 return true; 958 return true;
959 } 959 }
960 return false; 960 return false;
961 } 961 }
962 962
963 FrameLoadType FrameLoader::loadType() const 963 FrameLoadType FrameLoader::loadType() const
964 { 964 {
965 return m_loadType; 965 return m_loadType;
966 } 966 }
967 967
968 CachePolicy FrameLoader::subresourceCachePolicy() const 968 CachePolicy FrameLoader::subresourceCachePolicy() const
969 { 969 {
970 if (m_frame->document()->loadEventFinished()) 970 if (m_frame->document()->loadEventFinished())
971 return CachePolicyVerify; 971 return CachePolicyVerify;
972 972
973 if (m_loadType == FrameLoadTypeReloadFromOrigin) 973 if (m_loadType == FrameLoadTypeReloadFromOrigin)
974 return CachePolicyReload; 974 return CachePolicyReload;
975 975
976 if (Frame* parentFrame = m_frame->tree().parent()) { 976 if (Frame* parentFrame = m_frame->tree().parent()) {
977 CachePolicy parentCachePolicy = parentFrame->loader()->subresourceCacheP olicy(); 977 CachePolicy parentCachePolicy = parentFrame->loader().subresourceCachePo licy();
978 if (parentCachePolicy != CachePolicyVerify) 978 if (parentCachePolicy != CachePolicyVerify)
979 return parentCachePolicy; 979 return parentCachePolicy;
980 } 980 }
981 981
982 if (m_loadType == FrameLoadTypeReload) 982 if (m_loadType == FrameLoadTypeReload)
983 return CachePolicyRevalidate; 983 return CachePolicyRevalidate;
984 984
985 const ResourceRequest& request(documentLoader()->request()); 985 const ResourceRequest& request(documentLoader()->request());
986 986
987 if (request.cachePolicy() == ReturnCacheDataElseLoad) 987 if (request.cachePolicy() == ReturnCacheDataElseLoad)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 1047
1048 void FrameLoader::detachChildren() 1048 void FrameLoader::detachChildren()
1049 { 1049 {
1050 typedef Vector<RefPtr<Frame> > FrameVector; 1050 typedef Vector<RefPtr<Frame> > FrameVector;
1051 FrameVector childrenToDetach; 1051 FrameVector childrenToDetach;
1052 childrenToDetach.reserveCapacity(m_frame->tree().childCount()); 1052 childrenToDetach.reserveCapacity(m_frame->tree().childCount());
1053 for (Frame* child = m_frame->tree().lastChild(); child; child = child->tree( ).previousSibling()) 1053 for (Frame* child = m_frame->tree().lastChild(); child; child = child->tree( ).previousSibling())
1054 childrenToDetach.append(child); 1054 childrenToDetach.append(child);
1055 FrameVector::iterator end = childrenToDetach.end(); 1055 FrameVector::iterator end = childrenToDetach.end();
1056 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; it++) 1056 for (FrameVector::iterator it = childrenToDetach.begin(); it != end; it++)
1057 (*it)->loader()->detachFromParent(); 1057 (*it)->loader().detachFromParent();
1058 } 1058 }
1059 1059
1060 void FrameLoader::closeAndRemoveChild(Frame* child) 1060 void FrameLoader::closeAndRemoveChild(Frame* child)
1061 { 1061 {
1062 child->tree().detachFromParent(); 1062 child->tree().detachFromParent();
1063 1063
1064 child->setView(0); 1064 child->setView(0);
1065 if (child->ownerElement() && child->page()) 1065 if (child->ownerElement() && child->page())
1066 child->page()->decrementSubframeCount(); 1066 child->page()->decrementSubframeCount();
1067 child->willDetachPage(); 1067 child->willDetachPage();
1068 child->detachFromPage(); 1068 child->detachFromPage();
1069 1069
1070 m_frame->tree().removeChild(child); 1070 m_frame->tree().removeChild(child);
1071 } 1071 }
1072 1072
1073 // Called every time a resource is completely loaded or an error is received. 1073 // Called every time a resource is completely loaded or an error is received.
1074 void FrameLoader::checkLoadComplete() 1074 void FrameLoader::checkLoadComplete()
1075 { 1075 {
1076 ASSERT(m_client->hasWebView()); 1076 ASSERT(m_client->hasWebView());
1077 1077
1078 // FIXME: Always traversing the entire frame tree is a bit inefficient, but 1078 // FIXME: Always traversing the entire frame tree is a bit inefficient, but
1079 // is currently needed in order to null out the previous history item for al l frames. 1079 // is currently needed in order to null out the previous history item for al l frames.
1080 if (Page* page = m_frame->page()) { 1080 if (Page* page = m_frame->page()) {
1081 Vector<RefPtr<Frame>, 10> frames; 1081 Vector<RefPtr<Frame>, 10> frames;
1082 for (RefPtr<Frame> frame = page->mainFrame(); frame; frame = frame->tree ().traverseNext()) 1082 for (RefPtr<Frame> frame = page->mainFrame(); frame; frame = frame->tree ().traverseNext())
1083 frames.append(frame); 1083 frames.append(frame);
1084 // To process children before their parents, iterate the vector backward s. 1084 // To process children before their parents, iterate the vector backward s.
1085 for (size_t i = frames.size(); i; --i) 1085 for (size_t i = frames.size(); i; --i)
1086 frames[i - 1]->loader()->checkLoadCompleteForThisFrame(); 1086 frames[i - 1]->loader().checkLoadCompleteForThisFrame();
1087 } 1087 }
1088 } 1088 }
1089 1089
1090 void FrameLoader::checkLoadComplete(DocumentLoader* documentLoader) 1090 void FrameLoader::checkLoadComplete(DocumentLoader* documentLoader)
1091 { 1091 {
1092 if (documentLoader) 1092 if (documentLoader)
1093 documentLoader->checkLoadComplete(); 1093 documentLoader->checkLoadComplete();
1094 checkLoadComplete(); 1094 checkLoadComplete();
1095 } 1095 }
1096 1096
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 InspectorInstrumentation::frameDetachedFromParent(m_frame); 1135 InspectorInstrumentation::frameDetachedFromParent(m_frame);
1136 1136
1137 if (m_documentLoader) 1137 if (m_documentLoader)
1138 m_documentLoader->detachFromFrame(); 1138 m_documentLoader->detachFromFrame();
1139 m_documentLoader = 0; 1139 m_documentLoader = 0;
1140 m_client->detachedFromParent(); 1140 m_client->detachedFromParent();
1141 1141
1142 m_progressTracker.clear(); 1142 m_progressTracker.clear();
1143 1143
1144 if (Frame* parent = m_frame->tree().parent()) { 1144 if (Frame* parent = m_frame->tree().parent()) {
1145 parent->loader()->closeAndRemoveChild(m_frame); 1145 parent->loader().closeAndRemoveChild(m_frame);
1146 parent->loader()->scheduleCheckCompleted(); 1146 parent->loader().scheduleCheckCompleted();
1147 } else { 1147 } else {
1148 m_frame->setView(0); 1148 m_frame->setView(0);
1149 m_frame->willDetachPage(); 1149 m_frame->willDetachPage();
1150 m_frame->detachFromPage(); 1150 m_frame->detachFromPage();
1151 } 1151 }
1152 } 1152 }
1153 1153
1154 void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request) 1154 void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request)
1155 { 1155 {
1156 bool isMainResource = (request.targetType() == ResourceRequest::TargetIsMain Frame) || (request.targetType() == ResourceRequest::TargetIsSubframe); 1156 bool isMainResource = (request.targetType() == ResourceRequest::TargetIsMain Frame) || (request.targetType() == ResourceRequest::TargetIsSubframe);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 replacesCurrentHistoryItem = true; 1342 replacesCurrentHistoryItem = true;
1343 } 1343 }
1344 1344
1345 m_policyDocumentLoader = m_client->createDocumentLoader(request, substituteD ata.isValid() ? substituteData : defaultSubstituteDataForURL(request.url())); 1345 m_policyDocumentLoader = m_client->createDocumentLoader(request, substituteD ata.isValid() ? substituteData : defaultSubstituteDataForURL(request.url()));
1346 m_policyDocumentLoader->setFrame(m_frame); 1346 m_policyDocumentLoader->setFrame(m_frame);
1347 m_policyDocumentLoader->setTriggeringAction(action); 1347 m_policyDocumentLoader->setTriggeringAction(action);
1348 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory Item); 1348 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory Item);
1349 m_policyDocumentLoader->setIsClientRedirect(m_startingClientRedirect); 1349 m_policyDocumentLoader->setIsClientRedirect(m_startingClientRedirect);
1350 1350
1351 if (Frame* parent = m_frame->tree().parent()) 1351 if (Frame* parent = m_frame->tree().parent())
1352 m_policyDocumentLoader->setOverrideEncoding(parent->loader()->documentLo ader()->overrideEncoding()); 1352 m_policyDocumentLoader->setOverrideEncoding(parent->loader().documentLoa der()->overrideEncoding());
1353 else if (!overrideEncoding.isEmpty()) 1353 else if (!overrideEncoding.isEmpty())
1354 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); 1354 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding);
1355 else if (m_documentLoader) 1355 else if (m_documentLoader)
1356 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding()); 1356 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding());
1357 1357
1358 // stopAllLoaders can detach the Frame, so protect it. 1358 // stopAllLoaders can detach the Frame, so protect it.
1359 RefPtr<Frame> protect(m_frame); 1359 RefPtr<Frame> protect(m_frame);
1360 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, Doc umentLoader::PolicyCheckStandard) || !shouldClose()) && m_policyDocumentLoader) { 1360 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, Doc umentLoader::PolicyCheckStandard) || !shouldClose()) && m_policyDocumentLoader) {
1361 m_policyDocumentLoader->detachFromFrame(); 1361 m_policyDocumentLoader->detachFromFrame();
1362 m_policyDocumentLoader = 0; 1362 m_policyDocumentLoader = 0;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 return; 1423 return;
1424 mainFrame = newPage->mainFrame(); 1424 mainFrame = newPage->mainFrame();
1425 } 1425 }
1426 1426
1427 if (frameName != "_blank") 1427 if (frameName != "_blank")
1428 mainFrame->tree().setName(frameName); 1428 mainFrame->tree().setName(frameName);
1429 1429
1430 mainFrame->page()->setOpenedByDOM(); 1430 mainFrame->page()->setOpenedByDOM();
1431 mainFrame->page()->chrome().show(navigationPolicy); 1431 mainFrame->page()->chrome().show(navigationPolicy);
1432 if (!m_suppressOpenerInNewFrame) { 1432 if (!m_suppressOpenerInNewFrame) {
1433 mainFrame->loader()->setOpener(frame.get()); 1433 mainFrame->loader().setOpener(frame.get());
1434 mainFrame->document()->setReferrerPolicy(frame->document()->referrerPoli cy()); 1434 mainFrame->document()->setReferrerPolicy(frame->document()->referrerPoli cy());
1435 } 1435 }
1436 1436
1437 // FIXME: We can't just send our NavigationAction to the new FrameLoader's l oadWithNavigationAction(), we need to 1437 // FIXME: We can't just send our NavigationAction to the new FrameLoader's l oadWithNavigationAction(), we need to
1438 // create a new one with a default NavigationType and no triggering event. W e should figure out why. 1438 // create a new one with a default NavigationType and no triggering event. W e should figure out why.
1439 mainFrame->loader()->loadWithNavigationAction(action.resourceRequest(), Navi gationAction(action.resourceRequest()), FrameLoadTypeStandard, formState, Substi tuteData()); 1439 mainFrame->loader().loadWithNavigationAction(action.resourceRequest(), Navig ationAction(action.resourceRequest()), FrameLoadTypeStandard, formState, Substit uteData());
1440 } 1440 }
1441 1441
1442 void FrameLoader::applyUserAgent(ResourceRequest& request) 1442 void FrameLoader::applyUserAgent(ResourceRequest& request)
1443 { 1443 {
1444 String userAgent = this->userAgent(request.url()); 1444 String userAgent = this->userAgent(request.url());
1445 ASSERT(!userAgent.isNull()); 1445 ASSERT(!userAgent.isNull());
1446 request.setHTTPUserAgent(userAgent); 1446 request.setHTTPUserAgent(userAgent);
1447 } 1447 }
1448 1448
1449 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con st KURL& url, unsigned long requestIdentifier) 1449 bool FrameLoader::shouldInterruptLoadForXFrameOptions(const String& content, con st KURL& url, unsigned long requestIdentifier)
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 { 1600 {
1601 SandboxFlags flags = m_forcedSandboxFlags; 1601 SandboxFlags flags = m_forcedSandboxFlags;
1602 if (Frame* parentFrame = m_frame->tree().parent()) 1602 if (Frame* parentFrame = m_frame->tree().parent())
1603 flags |= parentFrame->document()->sandboxFlags(); 1603 flags |= parentFrame->document()->sandboxFlags();
1604 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement()) 1604 if (HTMLFrameOwnerElement* ownerElement = m_frame->ownerElement())
1605 flags |= ownerElement->sandboxFlags(); 1605 flags |= ownerElement->sandboxFlags();
1606 return flags; 1606 return flags;
1607 } 1607 }
1608 1608
1609 } // namespace WebCore 1609 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/FrameFetchContext.cpp ('k') | Source/core/loader/HistoryController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698