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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 visitor->trace(m_documentLoader); 188 visitor->trace(m_documentLoader);
189 visitor->trace(m_provisionalDocumentLoader); 189 visitor->trace(m_provisionalDocumentLoader);
190 visitor->trace(m_currentItem); 190 visitor->trace(m_currentItem);
191 visitor->trace(m_provisionalItem); 191 visitor->trace(m_provisionalItem);
192 visitor->trace(m_deferredHistoryLoad); 192 visitor->trace(m_deferredHistoryLoad);
193 } 193 }
194 194
195 void FrameLoader::init() 195 void FrameLoader::init()
196 { 196 {
197 // init() may dispatch JS events, so protect a reference to m_frame. 197 // init() may dispatch JS events, so protect a reference to m_frame.
198 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 198 RawPtr<LocalFrame> protect(m_frame.get());
199 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString())); 199 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString()));
200 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal); 200 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal);
201 initialRequest.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTyp eTopLevel : WebURLRequest::FrameTypeNested); 201 initialRequest.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTyp eTopLevel : WebURLRequest::FrameTypeNested);
202 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, initia lRequest, SubstituteData()); 202 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, initia lRequest, SubstituteData());
203 m_provisionalDocumentLoader->startLoadingMainResource(); 203 m_provisionalDocumentLoader->startLoadingMainResource();
204 m_frame->document()->cancelParsing(); 204 m_frame->document()->cancelParsing();
205 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu ment); 205 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu ment);
206 } 206 }
207 207
208 FrameLoaderClient* FrameLoader::client() const 208 FrameLoaderClient* FrameLoader::client() const
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 // This is only called by ScriptController::executeScriptIfJavaScriptURL 318 // This is only called by ScriptController::executeScriptIfJavaScriptURL
319 // and always contains the result of evaluating a javascript: url. 319 // and always contains the result of evaluating a javascript: url.
320 // This is the <iframe src="javascript:'html'"> case. 320 // This is the <iframe src="javascript:'html'"> case.
321 void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL(const String& sourc e, Document* ownerDocument) 321 void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL(const String& sourc e, Document* ownerDocument)
322 { 322 {
323 if (!m_frame->document()->loader() || m_frame->document()->pageDismissalEven tBeingDispatched() != Document::NoDismissal) 323 if (!m_frame->document()->loader() || m_frame->document()->pageDismissalEven tBeingDispatched() != Document::NoDismissal)
324 return; 324 return;
325 325
326 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the DocumentLoader to get deref'ed and possible destroyed, 326 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the DocumentLoader to get deref'ed and possible destroyed,
327 // so protect it with a RefPtr. 327 // so protect it with a RefPtr.
328 RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loade r()); 328 RawPtr<DocumentLoader> documentLoader(m_frame->document()->loader());
329 329
330 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL); 330 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL);
331 331
332 // Prepare a DocumentInit before clearing the frame, because it may need to 332 // Prepare a DocumentInit before clearing the frame, because it may need to
333 // inherit an aliased security context. 333 // inherit an aliased security context.
334 DocumentInit init(ownerDocument, m_frame->document()->url(), m_frame); 334 DocumentInit init(ownerDocument, m_frame->document()->url(), m_frame);
335 init.withNewRegistrationContext(); 335 init.withNewRegistrationContext();
336 336
337 stopAllLoaders(); 337 stopAllLoaders();
338 // Don't allow any new child frames to load in this frame: attaching a new 338 // Don't allow any new child frames to load in this frame: attaching a new
(...skipping 16 matching lines...) Expand all
355 void FrameLoader::receivedMainResourceRedirect(const KURL& newURL) 355 void FrameLoader::receivedMainResourceRedirect(const KURL& newURL)
356 { 356 {
357 client()->dispatchDidReceiveServerRedirectForProvisionalLoad(); 357 client()->dispatchDidReceiveServerRedirectForProvisionalLoad();
358 // If a back/forward navigation redirects cross-origin, don't reuse any stat e from the HistoryItem. 358 // If a back/forward navigation redirects cross-origin, don't reuse any stat e from the HistoryItem.
359 if (m_provisionalItem && !SecurityOrigin::create(m_provisionalItem->url())-> isSameSchemeHostPort(SecurityOrigin::create(newURL).get())) 359 if (m_provisionalItem && !SecurityOrigin::create(m_provisionalItem->url())-> isSameSchemeHostPort(SecurityOrigin::create(newURL).get()))
360 m_provisionalItem.clear(); 360 m_provisionalItem.clear();
361 } 361 }
362 362
363 void FrameLoader::setHistoryItemStateForCommit(HistoryCommitType historyCommitTy pe, HistoryNavigationType navigationType) 363 void FrameLoader::setHistoryItemStateForCommit(HistoryCommitType historyCommitTy pe, HistoryNavigationType navigationType)
364 { 364 {
365 RefPtrWillBeRawPtr<HistoryItem> oldItem = m_currentItem; 365 RawPtr<HistoryItem> oldItem = m_currentItem;
366 if (historyCommitType == BackForwardCommit && m_provisionalItem) 366 if (historyCommitType == BackForwardCommit && m_provisionalItem)
367 m_currentItem = m_provisionalItem.release(); 367 m_currentItem = m_provisionalItem.release();
368 else 368 else
369 m_currentItem = HistoryItem::create(); 369 m_currentItem = HistoryItem::create();
370 m_currentItem->setURL(m_documentLoader->urlForHistory()); 370 m_currentItem->setURL(m_documentLoader->urlForHistory());
371 m_currentItem->setDocumentState(m_frame->document()->formElementsState()); 371 m_currentItem->setDocumentState(m_frame->document()->formElementsState());
372 m_currentItem->setTarget(m_frame->tree().uniqueName()); 372 m_currentItem->setTarget(m_frame->tree().uniqueName());
373 m_currentItem->setReferrer(SecurityPolicy::generateReferrer(m_documentLoader ->request().getReferrerPolicy(), m_currentItem->url(), m_documentLoader->request ().httpReferrer())); 373 m_currentItem->setReferrer(SecurityPolicy::generateReferrer(m_documentLoader ->request().getReferrerPolicy(), m_currentItem->url(), m_documentLoader->request ().httpReferrer()));
374 m_currentItem->setFormInfoFromRequest(m_documentLoader->request()); 374 m_currentItem->setFormInfoFromRequest(m_documentLoader->request());
375 375
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 } 492 }
493 493
494 void FrameLoader::finishedParsing() 494 void FrameLoader::finishedParsing()
495 { 495 {
496 if (m_stateMachine.creatingInitialEmptyDocument()) 496 if (m_stateMachine.creatingInitialEmptyDocument())
497 return; 497 return;
498 498
499 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves 499 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves
500 // because doing so will cause us to re-enter the destructor when protector goes out of scope. 500 // because doing so will cause us to re-enter the destructor when protector goes out of scope.
501 // Null-checking the FrameView indicates whether or not we're in the destruc tor. 501 // Null-checking the FrameView indicates whether or not we're in the destruc tor.
502 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nul lptr); 502 RawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nullptr);
503 503
504 m_progressTracker->finishedParsing(); 504 m_progressTracker->finishedParsing();
505 505
506 if (client()) { 506 if (client()) {
507 ScriptForbiddenScope forbidScripts; 507 ScriptForbiddenScope forbidScripts;
508 client()->dispatchDidFinishDocumentLoad(); 508 client()->dispatchDidFinishDocumentLoad();
509 } 509 }
510 510
511 if (client()) 511 if (client())
512 client()->runScriptsAtDocumentReady(m_documentLoader ? m_documentLoader- >isCommittedButEmpty() : true); 512 client()->runScriptsAtDocumentReady(m_documentLoader ? m_documentLoader- >isCommittedButEmpty() : true);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 // FIXME: We might have already sent stop notifications and be re-completing . 580 // FIXME: We might have already sent stop notifications and be re-completing .
581 if (!frame->isLoading()) 581 if (!frame->isLoading())
582 return false; 582 return false;
583 // Only send didStopLoading() if there are no navigations in progress at all , 583 // Only send didStopLoading() if there are no navigations in progress at all ,
584 // whether committed, provisional, or pending. 584 // whether committed, provisional, or pending.
585 return frame->loader().documentLoader()->sentDidFinishLoad() && !frame->load er().provisionalDocumentLoader() && !frame->loader().client()->hasPendingNavigat ion(); 585 return frame->loader().documentLoader()->sentDidFinishLoad() && !frame->load er().provisionalDocumentLoader() && !frame->loader().client()->hasPendingNavigat ion();
586 } 586 }
587 587
588 void FrameLoader::checkCompleted() 588 void FrameLoader::checkCompleted()
589 { 589 {
590 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 590 RawPtr<LocalFrame> protect(m_frame.get());
591 if (!shouldComplete(m_frame->document())) 591 if (!shouldComplete(m_frame->document()))
592 return; 592 return;
593 593
594 // OK, completed. 594 // OK, completed.
595 m_frame->document()->setReadyState(Document::Complete); 595 m_frame->document()->setReadyState(Document::Complete);
596 if (m_frame->document()->loadEventStillNeeded()) 596 if (m_frame->document()->loadEventStillNeeded())
597 m_frame->document()->implicitClose(); 597 m_frame->document()->implicitClose();
598 598
599 m_frame->navigationScheduler().startTimer(); 599 m_frame->navigationScheduler().startTimer();
600 600
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { 693 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) {
694 m_currentItem->setStateObject(data); 694 m_currentItem->setStateObject(data);
695 m_currentItem->setScrollRestorationType(scrollRestorationType); 695 m_currentItem->setScrollRestorationType(scrollRestorationType);
696 } 696 }
697 client()->dispatchDidNavigateWithinPage(m_currentItem.get(), historyCommitTy pe); 697 client()->dispatchDidNavigateWithinPage(m_currentItem.get(), historyCommitTy pe);
698 client()->dispatchDidReceiveTitle(m_frame->document()->title()); 698 client()->dispatchDidReceiveTitle(m_frame->document()->title());
699 if (m_frame->document()->loadEventFinished()) 699 if (m_frame->document()->loadEventFinished())
700 client()->didStopLoading(); 700 client()->didStopLoading();
701 } 701 }
702 702
703 void FrameLoader::detachDocumentLoader(RefPtrWillBeMember<DocumentLoader>& loade r) 703 void FrameLoader::detachDocumentLoader(Member<DocumentLoader>& loader)
704 { 704 {
705 if (!loader) 705 if (!loader)
706 return; 706 return;
707 707
708 loader->detachFromFrame(); 708 loader->detachFromFrame();
709 loader = nullptr; 709 loader = nullptr;
710 } 710 }
711 711
712 void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip tValue> stateObject, FrameLoadType frameLoadType, HistoryLoadType historyLoadTyp e, ClientRedirectPolicy clientRedirect) 712 void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip tValue> stateObject, FrameLoadType frameLoadType, HistoryLoadType historyLoadTyp e, ClientRedirectPolicy clientRedirect)
713 { 713 {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 navigationPolicyFromMouseEvent(0, gestureEvent->ctrlKey(), gestureEvent- >shiftKey(), gestureEvent->altKey(), gestureEvent->metaKey(), &policy); 886 navigationPolicyFromMouseEvent(0, gestureEvent->ctrlKey(), gestureEvent- >shiftKey(), gestureEvent->altKey(), gestureEvent->metaKey(), &policy);
887 } 887 }
888 return policy; 888 return policy;
889 } 889 }
890 890
891 void FrameLoader::load(const FrameLoadRequest& passedRequest, FrameLoadType fram eLoadType, 891 void FrameLoader::load(const FrameLoadRequest& passedRequest, FrameLoadType fram eLoadType,
892 HistoryItem* historyItem, HistoryLoadType historyLoadType) 892 HistoryItem* historyItem, HistoryLoadType historyLoadType)
893 { 893 {
894 ASSERT(m_frame->document()); 894 ASSERT(m_frame->document());
895 895
896 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 896 RawPtr<LocalFrame> protect(m_frame.get());
897 897
898 if (m_inStopAllLoaders) 898 if (m_inStopAllLoaders)
899 return; 899 return;
900 900
901 if (m_frame->page()->defersLoading() && isBackForwardLoadType(frameLoadType) ) { 901 if (m_frame->page()->defersLoading() && isBackForwardLoadType(frameLoadType) ) {
902 m_deferredHistoryLoad = DeferredHistoryLoad::create(passedRequest.resour ceRequest(), historyItem, frameLoadType, historyLoadType); 902 m_deferredHistoryLoad = DeferredHistoryLoad::create(passedRequest.resour ceRequest(), historyItem, frameLoadType, historyLoadType);
903 return; 903 return;
904 } 904 }
905 905
906 FrameLoadRequest request(passedRequest); 906 FrameLoadRequest request(passedRequest);
907 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing UserGesture()); 907 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing UserGesture());
908 908
909 if (!prepareRequestForThisFrame(request)) 909 if (!prepareRequestForThisFrame(request))
910 return; 910 return;
911 911
912 RefPtrWillBeRawPtr<Frame> targetFrame = request.form() ? nullptr : m_frame-> findFrameForNavigation(AtomicString(request.frameName()), *m_frame); 912 RawPtr<Frame> targetFrame = request.form() ? nullptr : m_frame->findFrameFor Navigation(AtomicString(request.frameName()), *m_frame);
913 913
914 if (isBackForwardLoadType(frameLoadType)) { 914 if (isBackForwardLoadType(frameLoadType)) {
915 ASSERT(historyItem); 915 ASSERT(historyItem);
916 m_provisionalItem = historyItem; 916 m_provisionalItem = historyItem;
917 } 917 }
918 918
919 if (targetFrame && targetFrame.get() != m_frame) { 919 if (targetFrame && targetFrame.get() != m_frame) {
920 bool wasInSamePage = targetFrame->page() == m_frame->page(); 920 bool wasInSamePage = targetFrame->page() == m_frame->page();
921 921
922 request.setFrameName("_self"); 922 request.setFrameName("_self");
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 void FrameLoader::stopAllLoaders() 991 void FrameLoader::stopAllLoaders()
992 { 992 {
993 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) 993 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal)
994 return; 994 return;
995 995
996 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. 996 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this.
997 if (m_inStopAllLoaders) 997 if (m_inStopAllLoaders)
998 return; 998 return;
999 999
1000 // Stopping a document loader can blow away the frame from underneath. 1000 // Stopping a document loader can blow away the frame from underneath.
1001 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1001 RawPtr<LocalFrame> protect(m_frame.get());
1002 1002
1003 m_inStopAllLoaders = true; 1003 m_inStopAllLoaders = true;
1004 1004
1005 for (RefPtrWillBeRawPtr<Frame> child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { 1005 for (RawPtr<Frame> child = m_frame->tree().firstChild(); child; child = chil d->tree().nextSibling()) {
1006 if (child->isLocalFrame()) 1006 if (child->isLocalFrame())
1007 toLocalFrame(child.get())->loader().stopAllLoaders(); 1007 toLocalFrame(child.get())->loader().stopAllLoaders();
1008 } 1008 }
1009 1009
1010 m_frame->document()->suppressLoadEvent(); 1010 m_frame->document()->suppressLoadEvent();
1011 if (m_documentLoader) 1011 if (m_documentLoader)
1012 m_documentLoader->fetcher()->stopFetching(); 1012 m_documentLoader->fetcher()->stopFetching();
1013 m_frame->document()->cancelParsing(); 1013 m_frame->document()->cancelParsing();
1014 if (!m_protectProvisionalLoader) 1014 if (!m_protectProvisionalLoader)
1015 detachDocumentLoader(m_provisionalDocumentLoader); 1015 detachDocumentLoader(m_provisionalDocumentLoader);
(...skipping 30 matching lines...) Expand all
1046 { 1046 {
1047 if (m_didAccessInitialDocumentTimer.isActive()) { 1047 if (m_didAccessInitialDocumentTimer.isActive()) {
1048 m_didAccessInitialDocumentTimer.stop(); 1048 m_didAccessInitialDocumentTimer.stop();
1049 didAccessInitialDocumentTimerFired(0); 1049 didAccessInitialDocumentTimerFired(0);
1050 } 1050 }
1051 } 1051 }
1052 1052
1053 bool FrameLoader::prepareForCommit() 1053 bool FrameLoader::prepareForCommit()
1054 { 1054 {
1055 PluginScriptForbiddenScope forbidPluginDestructorScripting; 1055 PluginScriptForbiddenScope forbidPluginDestructorScripting;
1056 RefPtrWillBeRawPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; 1056 RawPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
1057 1057
1058 if (m_frame->document()) { 1058 if (m_frame->document()) {
1059 unsigned nodeCount = 0; 1059 unsigned nodeCount = 0;
1060 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext() ) { 1060 for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext() ) {
1061 if (frame->isLocalFrame()) { 1061 if (frame->isLocalFrame()) {
1062 LocalFrame* localFrame = toLocalFrame(frame); 1062 LocalFrame* localFrame = toLocalFrame(frame);
1063 nodeCount += localFrame->document()->nodeCount(); 1063 nodeCount += localFrame->document()->nodeCount();
1064 } 1064 }
1065 } 1065 }
1066 unsigned totalNodeCount = InstanceCounters::counterValue(InstanceCounter s::NodeCounter); 1066 unsigned totalNodeCount = InstanceCounters::counterValue(InstanceCounter s::NodeCounter);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 if (m_frame->document()) 1102 if (m_frame->document())
1103 m_frame->document()->detach(); 1103 m_frame->document()->detach();
1104 m_documentLoader = m_provisionalDocumentLoader.release(); 1104 m_documentLoader = m_provisionalDocumentLoader.release();
1105 1105
1106 return true; 1106 return true;
1107 } 1107 }
1108 1108
1109 void FrameLoader::commitProvisionalLoad() 1109 void FrameLoader::commitProvisionalLoad()
1110 { 1110 {
1111 ASSERT(client()->hasWebView()); 1111 ASSERT(client()->hasWebView());
1112 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1112 RawPtr<LocalFrame> protect(m_frame.get());
1113 1113
1114 // Check if the destination page is allowed to access the previous page's ti ming information. 1114 // Check if the destination page is allowed to access the previous page's ti ming information.
1115 if (m_frame->document()) { 1115 if (m_frame->document()) {
1116 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(m_provisi onalDocumentLoader->request().url()); 1116 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(m_provisi onalDocumentLoader->request().url());
1117 m_provisionalDocumentLoader->timing().setHasSameOriginAsPreviousDocument (securityOrigin->canRequest(m_frame->document()->url())); 1117 m_provisionalDocumentLoader->timing().setHasSameOriginAsPreviousDocument (securityOrigin->canRequest(m_frame->document()->url()));
1118 } 1118 }
1119 1119
1120 if (!prepareForCommit()) 1120 if (!prepareForCommit())
1121 return; 1121 return;
1122 1122
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 toLocalFrame(parent)->loader().scheduleCheckCompleted(); 1230 toLocalFrame(parent)->loader().scheduleCheckCompleted();
1231 if (m_progressTracker) { 1231 if (m_progressTracker) {
1232 m_progressTracker->dispose(); 1232 m_progressTracker->dispose();
1233 m_progressTracker.clear(); 1233 m_progressTracker.clear();
1234 } 1234 }
1235 } 1235 }
1236 1236
1237 void FrameLoader::loadFailed(DocumentLoader* loader, const ResourceError& error) 1237 void FrameLoader::loadFailed(DocumentLoader* loader, const ResourceError& error)
1238 { 1238 {
1239 // Retain because the stop may release the last reference to it. 1239 // Retain because the stop may release the last reference to it.
1240 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1240 RawPtr<LocalFrame> protect(m_frame.get());
1241 RefPtrWillBeRawPtr<DocumentLoader> protectDocumentLoader(loader); 1241 RawPtr<DocumentLoader> protectDocumentLoader(loader);
1242 1242
1243 if (!error.isCancellation() && m_frame->owner()) { 1243 if (!error.isCancellation() && m_frame->owner()) {
1244 // FIXME: For now, fallback content doesn't work cross process. 1244 // FIXME: For now, fallback content doesn't work cross process.
1245 if (m_frame->owner()->isLocal()) 1245 if (m_frame->owner()->isLocal())
1246 m_frame->deprecatedLocalOwner()->renderFallbackContent(); 1246 m_frame->deprecatedLocalOwner()->renderFallbackContent();
1247 } 1247 }
1248 1248
1249 HistoryCommitType historyCommitType = loadTypeToCommitType(m_loadType); 1249 HistoryCommitType historyCommitType = loadTypeToCommitType(m_loadType);
1250 if (loader == m_provisionalDocumentLoader) { 1250 if (loader == m_provisionalDocumentLoader) {
1251 client()->dispatchDidFailProvisionalLoad(error, historyCommitType); 1251 client()->dispatchDidFailProvisionalLoad(error, historyCommitType);
(...skipping 30 matching lines...) Expand all
1282 && !m_frame->document()->isFrameSet(); 1282 && !m_frame->document()->isFrameSet();
1283 } 1283 }
1284 1284
1285 void FrameLoader::processFragment(const KURL& url, LoadStartType loadStartType) 1285 void FrameLoader::processFragment(const KURL& url, LoadStartType loadStartType)
1286 { 1286 {
1287 FrameView* view = m_frame->view(); 1287 FrameView* view = m_frame->view();
1288 if (!view) 1288 if (!view)
1289 return; 1289 return;
1290 1290
1291 // Leaking scroll position to a cross-origin ancestor would permit the so-ca lled "framesniffing" attack. 1291 // Leaking scroll position to a cross-origin ancestor would permit the so-ca lled "framesniffing" attack.
1292 RefPtrWillBeRawPtr<Frame> boundaryFrame = url.hasFragmentIdentifier() ? m_fr ame->findUnsafeParentScrollPropagationBoundary() : 0; 1292 RawPtr<Frame> boundaryFrame = url.hasFragmentIdentifier() ? m_frame->findUns afeParentScrollPropagationBoundary() : 0;
1293 1293
1294 // FIXME: Handle RemoteFrames 1294 // FIXME: Handle RemoteFrames
1295 if (boundaryFrame && boundaryFrame->isLocalFrame()) 1295 if (boundaryFrame && boundaryFrame->isLocalFrame())
1296 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar ent(false); 1296 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar ent(false);
1297 1297
1298 // If scroll position is restored from history fragment then we should not o verride it unless 1298 // If scroll position is restored from history fragment then we should not o verride it unless
1299 // this is a same document reload. 1299 // this is a same document reload.
1300 bool shouldScrollToFragment = (loadStartType == NavigationWithinSameDocument && !isBackForwardLoadType(m_loadType)) 1300 bool shouldScrollToFragment = (loadStartType == NavigationWithinSameDocument && !isBackForwardLoadType(m_loadType))
1301 || (documentLoader() && !documentLoader()->initialScrollState().didResto reFromHistory); 1301 || (documentLoader() && !documentLoader()->initialScrollState().didResto reFromHistory);
1302 1302
1303 view->processUrlFragment(url, shouldScrollToFragment ? 1303 view->processUrlFragment(url, shouldScrollToFragment ?
1304 FrameView::UrlFragmentScroll : FrameView::UrlFragmentDontScroll); 1304 FrameView::UrlFragmentScroll : FrameView::UrlFragmentDontScroll);
1305 1305
1306 if (boundaryFrame && boundaryFrame->isLocalFrame()) 1306 if (boundaryFrame && boundaryFrame->isLocalFrame())
1307 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar ent(true); 1307 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar ent(true);
1308 } 1308 }
1309 1309
1310 bool FrameLoader::shouldClose(bool isReload) 1310 bool FrameLoader::shouldClose(bool isReload)
1311 { 1311 {
1312 Page* page = m_frame->page(); 1312 Page* page = m_frame->page();
1313 if (!page || !page->chromeClient().canOpenBeforeUnloadConfirmPanel()) 1313 if (!page || !page->chromeClient().canOpenBeforeUnloadConfirmPanel())
1314 return true; 1314 return true;
1315 1315
1316 // Store all references to each subframe in advance since beforeunload's eve nt handler may modify frame 1316 // Store all references to each subframe in advance since beforeunload's eve nt handler may modify frame
1317 WillBeHeapVector<RefPtrWillBeMember<LocalFrame>> targetFrames; 1317 HeapVector<Member<LocalFrame>> targetFrames;
1318 targetFrames.append(m_frame); 1318 targetFrames.append(m_frame);
1319 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().traverseNext(m_frame)) { 1319 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().traverseNext(m_frame)) {
1320 // FIXME: There is not yet any way to dispatch events to out-of-process frames. 1320 // FIXME: There is not yet any way to dispatch events to out-of-process frames.
1321 if (child->isLocalFrame()) 1321 if (child->isLocalFrame())
1322 targetFrames.append(toLocalFrame(child)); 1322 targetFrames.append(toLocalFrame(child));
1323 } 1323 }
1324 1324
1325 bool shouldClose = false; 1325 bool shouldClose = false;
1326 { 1326 {
1327 NavigationDisablerForBeforeUnload navigationDisabler; 1327 NavigationDisablerForBeforeUnload navigationDisabler;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processi ngUserGesture()) 1378 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processi ngUserGesture())
1379 return false; 1379 return false;
1380 client()->loadURLExternally(request, policy, String(), replacesCurrentHistor yItem); 1380 client()->loadURLExternally(request, policy, String(), replacesCurrentHistor yItem);
1381 return false; 1381 return false;
1382 } 1382 }
1383 1383
1384 void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty pe, NavigationPolicy navigationPolicy) 1384 void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty pe, NavigationPolicy navigationPolicy)
1385 { 1385 {
1386 ASSERT(client()->hasWebView()); 1386 ASSERT(client()->hasWebView());
1387 // Lots of things in this function can detach the LocalFrame (stopAllLoaders , beforeunload handlers, etc.), so protect the frame. 1387 // Lots of things in this function can detach the LocalFrame (stopAllLoaders , beforeunload handlers, etc.), so protect the frame.
1388 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1388 RawPtr<LocalFrame> protect(m_frame.get());
1389 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) 1389 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal)
1390 return; 1390 return;
1391 1391
1392 NavigationType navigationType = determineNavigationType(type, frameLoadReque st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri ggeringEvent()); 1392 NavigationType navigationType = determineNavigationType(type, frameLoadReque st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri ggeringEvent());
1393 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext FromNavigationType(navigationType)); 1393 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext FromNavigationType(navigationType));
1394 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); 1394 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested);
1395 ResourceRequest& request = frameLoadRequest.resourceRequest(); 1395 ResourceRequest& request = frameLoadRequest.resourceRequest();
1396 if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteD ata(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), na vigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLo adRequest.clientRedirect() == ClientRedirect)) 1396 if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteD ata(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), na vigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLo adRequest.clientRedirect() == ClientRedirect))
1397 return; 1397 return;
1398 if (!shouldClose(navigationType == NavigationTypeReload)) 1398 if (!shouldClose(navigationType == NavigationTypeReload))
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 break; 1461 break;
1462 } 1462 }
1463 } 1463 }
1464 return false; 1464 return false;
1465 } 1465 }
1466 case XFrameOptionsDeny: 1466 case XFrameOptionsDeny:
1467 return true; 1467 return true;
1468 case XFrameOptionsAllowAll: 1468 case XFrameOptionsAllowAll:
1469 return false; 1469 return false;
1470 case XFrameOptionsConflict: { 1470 case XFrameOptionsConflict: {
1471 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::crea te(JSMessageSource, ErrorMessageLevel, "Multiple 'X-Frame-Options' headers with conflicting values ('" + content + "') encountered when loading '" + url.elidedS tring() + "'. Falling back to 'DENY'."); 1471 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessage Source, ErrorMessageLevel, "Multiple 'X-Frame-Options' headers with conflicting values ('" + content + "') encountered when loading '" + url.elidedString() + "' . Falling back to 'DENY'.");
1472 consoleMessage->setRequestIdentifier(requestIdentifier); 1472 consoleMessage->setRequestIdentifier(requestIdentifier);
1473 m_frame->document()->addConsoleMessage(consoleMessage.release()); 1473 m_frame->document()->addConsoleMessage(consoleMessage.release());
1474 return true; 1474 return true;
1475 } 1475 }
1476 case XFrameOptionsInvalid: { 1476 case XFrameOptionsInvalid: {
1477 RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::crea te(JSMessageSource, ErrorMessageLevel, "Invalid 'X-Frame-Options' header encount ered when loading '" + url.elidedString() + "': '" + content + "' is not a recog nized directive. The header will be ignored."); 1477 RawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::create(JSMessage Source, ErrorMessageLevel, "Invalid 'X-Frame-Options' header encountered when lo ading '" + url.elidedString() + "': '" + content + "' is not a recognized direct ive. The header will be ignored.");
1478 consoleMessage->setRequestIdentifier(requestIdentifier); 1478 consoleMessage->setRequestIdentifier(requestIdentifier);
1479 m_frame->document()->addConsoleMessage(consoleMessage.release()); 1479 m_frame->document()->addConsoleMessage(consoleMessage.release());
1480 return false; 1480 return false;
1481 } 1481 }
1482 default: 1482 default:
1483 ASSERT_NOT_REACHED(); 1483 ASSERT_NOT_REACHED();
1484 return false; 1484 return false;
1485 } 1485 }
1486 } 1486 }
1487 1487
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 // FIXME: We need a way to propagate insecure requests policy flags to 1585 // FIXME: We need a way to propagate insecure requests policy flags to
1586 // out-of-process frames. For now, we'll always use default behavior. 1586 // out-of-process frames. For now, we'll always use default behavior.
1587 if (!parentFrame->isLocalFrame()) 1587 if (!parentFrame->isLocalFrame())
1588 return nullptr; 1588 return nullptr;
1589 1589
1590 ASSERT(toLocalFrame(parentFrame)->document()); 1590 ASSERT(toLocalFrame(parentFrame)->document());
1591 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1591 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1592 } 1592 }
1593 1593
1594 } // namespace blink 1594 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/loader/FrameLoader.h ('k') | third_party/WebKit/Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698