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

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, 10 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 visitor->trace(m_documentLoader); 184 visitor->trace(m_documentLoader);
185 visitor->trace(m_provisionalDocumentLoader); 185 visitor->trace(m_provisionalDocumentLoader);
186 visitor->trace(m_currentItem); 186 visitor->trace(m_currentItem);
187 visitor->trace(m_provisionalItem); 187 visitor->trace(m_provisionalItem);
188 visitor->trace(m_deferredHistoryLoad); 188 visitor->trace(m_deferredHistoryLoad);
189 } 189 }
190 190
191 void FrameLoader::init() 191 void FrameLoader::init()
192 { 192 {
193 // init() may dispatch JS events, so protect a reference to m_frame. 193 // init() may dispatch JS events, so protect a reference to m_frame.
194 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 194 RawPtr<LocalFrame> protect(m_frame.get());
195 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString())); 195 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString()));
196 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal); 196 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal);
197 initialRequest.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTyp eTopLevel : WebURLRequest::FrameTypeNested); 197 initialRequest.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTyp eTopLevel : WebURLRequest::FrameTypeNested);
198 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, initia lRequest, SubstituteData()); 198 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, initia lRequest, SubstituteData());
199 m_provisionalDocumentLoader->startLoadingMainResource(); 199 m_provisionalDocumentLoader->startLoadingMainResource();
200 m_frame->document()->cancelParsing(); 200 m_frame->document()->cancelParsing();
201 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu ment); 201 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu ment);
202 } 202 }
203 203
204 FrameLoaderClient* FrameLoader::client() const 204 FrameLoaderClient* FrameLoader::client() const
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // This is only called by ScriptController::executeScriptIfJavaScriptURL 312 // This is only called by ScriptController::executeScriptIfJavaScriptURL
313 // and always contains the result of evaluating a javascript: url. 313 // and always contains the result of evaluating a javascript: url.
314 // This is the <iframe src="javascript:'html'"> case. 314 // This is the <iframe src="javascript:'html'"> case.
315 void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL(const String& sourc e, Document* ownerDocument) 315 void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL(const String& sourc e, Document* ownerDocument)
316 { 316 {
317 if (!m_frame->document()->loader() || m_frame->document()->pageDismissalEven tBeingDispatched() != Document::NoDismissal) 317 if (!m_frame->document()->loader() || m_frame->document()->pageDismissalEven tBeingDispatched() != Document::NoDismissal)
318 return; 318 return;
319 319
320 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the DocumentLoader to get deref'ed and possible destroyed, 320 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the DocumentLoader to get deref'ed and possible destroyed,
321 // so protect it with a RefPtr. 321 // so protect it with a RefPtr.
322 RefPtrWillBeRawPtr<DocumentLoader> documentLoader(m_frame->document()->loade r()); 322 RawPtr<DocumentLoader> documentLoader(m_frame->document()->loader());
323 323
324 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL); 324 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL);
325 325
326 // Prepare a DocumentInit before clearing the frame, because it may need to 326 // Prepare a DocumentInit before clearing the frame, because it may need to
327 // inherit an aliased security context. 327 // inherit an aliased security context.
328 DocumentInit init(m_frame->document()->url(), m_frame); 328 DocumentInit init(m_frame->document()->url(), m_frame);
329 init.withNewRegistrationContext(); 329 init.withNewRegistrationContext();
330 init.withoutInheritingSecurityOrigin(); 330 init.withoutInheritingSecurityOrigin();
331 331
332 stopAllLoaders(); 332 stopAllLoaders();
(...skipping 17 matching lines...) Expand all
350 void FrameLoader::receivedMainResourceRedirect(const KURL& newURL) 350 void FrameLoader::receivedMainResourceRedirect(const KURL& newURL)
351 { 351 {
352 client()->dispatchDidReceiveServerRedirectForProvisionalLoad(); 352 client()->dispatchDidReceiveServerRedirectForProvisionalLoad();
353 // If a back/forward navigation redirects cross-origin, don't reuse any stat e from the HistoryItem. 353 // If a back/forward navigation redirects cross-origin, don't reuse any stat e from the HistoryItem.
354 if (m_provisionalItem && !SecurityOrigin::create(m_provisionalItem->url())-> isSameSchemeHostPort(SecurityOrigin::create(newURL).get())) 354 if (m_provisionalItem && !SecurityOrigin::create(m_provisionalItem->url())-> isSameSchemeHostPort(SecurityOrigin::create(newURL).get()))
355 m_provisionalItem.clear(); 355 m_provisionalItem.clear();
356 } 356 }
357 357
358 void FrameLoader::setHistoryItemStateForCommit(HistoryCommitType historyCommitTy pe, HistoryNavigationType navigationType) 358 void FrameLoader::setHistoryItemStateForCommit(HistoryCommitType historyCommitTy pe, HistoryNavigationType navigationType)
359 { 359 {
360 RefPtrWillBeRawPtr<HistoryItem> oldItem = m_currentItem; 360 RawPtr<HistoryItem> oldItem = m_currentItem;
361 if (historyCommitType == BackForwardCommit && m_provisionalItem) 361 if (historyCommitType == BackForwardCommit && m_provisionalItem)
362 m_currentItem = m_provisionalItem.release(); 362 m_currentItem = m_provisionalItem.release();
363 else 363 else
364 m_currentItem = HistoryItem::create(); 364 m_currentItem = HistoryItem::create();
365 m_currentItem->setURL(m_documentLoader->urlForHistory()); 365 m_currentItem->setURL(m_documentLoader->urlForHistory());
366 m_currentItem->setDocumentState(m_frame->document()->formElementsState()); 366 m_currentItem->setDocumentState(m_frame->document()->formElementsState());
367 m_currentItem->setTarget(m_frame->tree().uniqueName()); 367 m_currentItem->setTarget(m_frame->tree().uniqueName());
368 m_currentItem->setReferrer(SecurityPolicy::generateReferrer(m_documentLoader ->request().referrerPolicy(), m_currentItem->url(), m_documentLoader->request(). httpReferrer())); 368 m_currentItem->setReferrer(SecurityPolicy::generateReferrer(m_documentLoader ->request().referrerPolicy(), m_currentItem->url(), m_documentLoader->request(). httpReferrer()));
369 m_currentItem->setFormInfoFromRequest(m_documentLoader->request()); 369 m_currentItem->setFormInfoFromRequest(m_documentLoader->request());
370 370
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 477 }
478 478
479 void FrameLoader::finishedParsing() 479 void FrameLoader::finishedParsing()
480 { 480 {
481 if (m_stateMachine.creatingInitialEmptyDocument()) 481 if (m_stateMachine.creatingInitialEmptyDocument())
482 return; 482 return;
483 483
484 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves 484 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves
485 // because doing so will cause us to re-enter the destructor when protector goes out of scope. 485 // because doing so will cause us to re-enter the destructor when protector goes out of scope.
486 // Null-checking the FrameView indicates whether or not we're in the destruc tor. 486 // Null-checking the FrameView indicates whether or not we're in the destruc tor.
487 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nul lptr); 487 RawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nullptr);
488 488
489 m_progressTracker->finishedParsing(); 489 m_progressTracker->finishedParsing();
490 490
491 if (client()) 491 if (client())
492 client()->dispatchDidFinishDocumentLoad(m_documentLoader ? m_documentLoa der->isCommittedButEmpty() : true); 492 client()->dispatchDidFinishDocumentLoad(m_documentLoader ? m_documentLoa der->isCommittedButEmpty() : true);
493 493
494 checkCompleted(); 494 checkCompleted();
495 495
496 if (!m_frame->view()) 496 if (!m_frame->view())
497 return; // We are being destroyed by something checkCompleted called. 497 return; // We are being destroyed by something checkCompleted called.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 // FIXME: We might have already sent stop notifications and be re-completing . 560 // FIXME: We might have already sent stop notifications and be re-completing .
561 if (!frame->isLoading()) 561 if (!frame->isLoading())
562 return false; 562 return false;
563 // Only send didStopLoading() if there are no navigations in progress at all , 563 // Only send didStopLoading() if there are no navigations in progress at all ,
564 // whether committed, provisional, or pending. 564 // whether committed, provisional, or pending.
565 return frame->loader().documentLoader()->sentDidFinishLoad() && !frame->load er().provisionalDocumentLoader() && !frame->loader().client()->hasPendingNavigat ion(); 565 return frame->loader().documentLoader()->sentDidFinishLoad() && !frame->load er().provisionalDocumentLoader() && !frame->loader().client()->hasPendingNavigat ion();
566 } 566 }
567 567
568 void FrameLoader::checkCompleted() 568 void FrameLoader::checkCompleted()
569 { 569 {
570 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 570 RawPtr<LocalFrame> protect(m_frame.get());
571 if (!shouldComplete(m_frame->document())) 571 if (!shouldComplete(m_frame->document()))
572 return; 572 return;
573 573
574 // OK, completed. 574 // OK, completed.
575 m_frame->document()->setReadyState(Document::Complete); 575 m_frame->document()->setReadyState(Document::Complete);
576 if (m_frame->document()->loadEventStillNeeded()) 576 if (m_frame->document()->loadEventStillNeeded())
577 m_frame->document()->implicitClose(); 577 m_frame->document()->implicitClose();
578 578
579 m_frame->navigationScheduler().startTimer(); 579 m_frame->navigationScheduler().startTimer();
580 580
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) { 673 if (sameDocumentNavigationSource == SameDocumentNavigationHistoryApi) {
674 m_currentItem->setStateObject(data); 674 m_currentItem->setStateObject(data);
675 m_currentItem->setScrollRestorationType(scrollRestorationType); 675 m_currentItem->setScrollRestorationType(scrollRestorationType);
676 } 676 }
677 client()->dispatchDidNavigateWithinPage(m_currentItem.get(), historyCommitTy pe); 677 client()->dispatchDidNavigateWithinPage(m_currentItem.get(), historyCommitTy pe);
678 client()->dispatchDidReceiveTitle(m_frame->document()->title()); 678 client()->dispatchDidReceiveTitle(m_frame->document()->title());
679 if (m_frame->document()->loadEventFinished()) 679 if (m_frame->document()->loadEventFinished())
680 client()->didStopLoading(); 680 client()->didStopLoading();
681 } 681 }
682 682
683 void FrameLoader::detachDocumentLoader(RefPtrWillBeMember<DocumentLoader>& loade r) 683 void FrameLoader::detachDocumentLoader(Member<DocumentLoader>& loader)
684 { 684 {
685 if (!loader) 685 if (!loader)
686 return; 686 return;
687 687
688 loader->detachFromFrame(); 688 loader->detachFromFrame();
689 loader = nullptr; 689 loader = nullptr;
690 } 690 }
691 691
692 void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip tValue> stateObject, FrameLoadType frameLoadType, HistoryLoadType historyLoadTyp e, ClientRedirectPolicy clientRedirect) 692 void FrameLoader::loadInSameDocument(const KURL& url, PassRefPtr<SerializedScrip tValue> stateObject, FrameLoadType frameLoadType, HistoryLoadType historyLoadTyp e, ClientRedirectPolicy clientRedirect)
693 { 693 {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 navigationPolicyFromMouseEvent(0, gestureEvent->ctrlKey(), gestureEvent- >shiftKey(), gestureEvent->altKey(), gestureEvent->metaKey(), &policy); 869 navigationPolicyFromMouseEvent(0, gestureEvent->ctrlKey(), gestureEvent- >shiftKey(), gestureEvent->altKey(), gestureEvent->metaKey(), &policy);
870 } 870 }
871 return policy; 871 return policy;
872 } 872 }
873 873
874 void FrameLoader::load(const FrameLoadRequest& passedRequest, FrameLoadType fram eLoadType, 874 void FrameLoader::load(const FrameLoadRequest& passedRequest, FrameLoadType fram eLoadType,
875 HistoryItem* historyItem, HistoryLoadType historyLoadType) 875 HistoryItem* historyItem, HistoryLoadType historyLoadType)
876 { 876 {
877 ASSERT(m_frame->document()); 877 ASSERT(m_frame->document());
878 878
879 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 879 RawPtr<LocalFrame> protect(m_frame.get());
880 880
881 if (m_inStopAllLoaders) 881 if (m_inStopAllLoaders)
882 return; 882 return;
883 883
884 if (m_frame->page()->defersLoading() && isBackForwardLoadType(frameLoadType) ) { 884 if (m_frame->page()->defersLoading() && isBackForwardLoadType(frameLoadType) ) {
885 m_deferredHistoryLoad = DeferredHistoryLoad::create(passedRequest.resour ceRequest(), historyItem, frameLoadType, historyLoadType); 885 m_deferredHistoryLoad = DeferredHistoryLoad::create(passedRequest.resour ceRequest(), historyItem, frameLoadType, historyLoadType);
886 return; 886 return;
887 } 887 }
888 888
889 FrameLoadRequest request(passedRequest); 889 FrameLoadRequest request(passedRequest);
890 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing UserGesture()); 890 request.resourceRequest().setHasUserGesture(UserGestureIndicator::processing UserGesture());
891 891
892 if (!prepareRequestForThisFrame(request)) 892 if (!prepareRequestForThisFrame(request))
893 return; 893 return;
894 894
895 RefPtrWillBeRawPtr<Frame> targetFrame = request.form() ? nullptr : m_frame-> findFrameForNavigation(AtomicString(request.frameName()), *m_frame); 895 RawPtr<Frame> targetFrame = request.form() ? nullptr : m_frame->findFrameFor Navigation(AtomicString(request.frameName()), *m_frame);
896 896
897 if (isBackForwardLoadType(frameLoadType)) { 897 if (isBackForwardLoadType(frameLoadType)) {
898 ASSERT(historyItem); 898 ASSERT(historyItem);
899 m_provisionalItem = historyItem; 899 m_provisionalItem = historyItem;
900 } 900 }
901 901
902 if (targetFrame && targetFrame.get() != m_frame) { 902 if (targetFrame && targetFrame.get() != m_frame) {
903 bool wasInSamePage = targetFrame->page() == m_frame->page(); 903 bool wasInSamePage = targetFrame->page() == m_frame->page();
904 904
905 request.setFrameName("_self"); 905 request.setFrameName("_self");
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 { 975 {
976 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) 976 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal)
977 return; 977 return;
978 978
979 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. 979 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this.
980 if (m_inStopAllLoaders) 980 if (m_inStopAllLoaders)
981 return; 981 return;
982 982
983 // Calling stopLoading() on the provisional document loader can blow away 983 // Calling stopLoading() on the provisional document loader can blow away
984 // the frame from underneath. 984 // the frame from underneath.
985 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 985 RawPtr<LocalFrame> protect(m_frame.get());
986 986
987 m_inStopAllLoaders = true; 987 m_inStopAllLoaders = true;
988 988
989 for (RefPtrWillBeRawPtr<Frame> child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { 989 for (RawPtr<Frame> child = m_frame->tree().firstChild(); child; child = chil d->tree().nextSibling()) {
990 if (child->isLocalFrame()) 990 if (child->isLocalFrame())
991 toLocalFrame(child.get())->loader().stopAllLoaders(); 991 toLocalFrame(child.get())->loader().stopAllLoaders();
992 } 992 }
993 993
994 m_frame->document()->suppressLoadEvent(); 994 m_frame->document()->suppressLoadEvent();
995 if (m_provisionalDocumentLoader) 995 if (m_provisionalDocumentLoader)
996 m_provisionalDocumentLoader->stopLoading(); 996 m_provisionalDocumentLoader->stopLoading();
997 if (m_documentLoader) 997 if (m_documentLoader)
998 m_documentLoader->stopLoading(); 998 m_documentLoader->stopLoading();
999 m_frame->document()->cancelParsing(); 999 m_frame->document()->cancelParsing();
(...skipping 26 matching lines...) Expand all
1026 { 1026 {
1027 if (m_didAccessInitialDocumentTimer.isActive()) { 1027 if (m_didAccessInitialDocumentTimer.isActive()) {
1028 m_didAccessInitialDocumentTimer.stop(); 1028 m_didAccessInitialDocumentTimer.stop();
1029 didAccessInitialDocumentTimerFired(0); 1029 didAccessInitialDocumentTimerFired(0);
1030 } 1030 }
1031 } 1031 }
1032 1032
1033 bool FrameLoader::prepareForCommit() 1033 bool FrameLoader::prepareForCommit()
1034 { 1034 {
1035 PluginScriptForbiddenScope forbidPluginDestructorScripting; 1035 PluginScriptForbiddenScope forbidPluginDestructorScripting;
1036 RefPtrWillBeRawPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; 1036 RawPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
1037 1037
1038 if (m_frame->document()) { 1038 if (m_frame->document()) {
1039 unsigned totalNodeCount = InstanceCounters::counterValue(InstanceCounter s::NodeCounter); 1039 unsigned totalNodeCount = InstanceCounters::counterValue(InstanceCounter s::NodeCounter);
1040 int nodeCount = static_cast<int>(totalNodeCount); 1040 int nodeCount = static_cast<int>(totalNodeCount);
1041 for (Document* document : Document::liveDocumentSet()) { 1041 for (Document* document : Document::liveDocumentSet()) {
1042 if (document != m_frame->document()) 1042 if (document != m_frame->document())
1043 nodeCount -= document->nodeCount(); 1043 nodeCount -= document->nodeCount();
1044 } 1044 }
1045 ASSERT(nodeCount >= 0); 1045 ASSERT(nodeCount >= 0);
1046 float ratio = static_cast<float>(nodeCount) / totalNodeCount; 1046 float ratio = static_cast<float>(nodeCount) / totalNodeCount;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 if (m_frame->document()) 1078 if (m_frame->document())
1079 m_frame->document()->detach(); 1079 m_frame->document()->detach();
1080 m_documentLoader = m_provisionalDocumentLoader.release(); 1080 m_documentLoader = m_provisionalDocumentLoader.release();
1081 1081
1082 return true; 1082 return true;
1083 } 1083 }
1084 1084
1085 void FrameLoader::commitProvisionalLoad() 1085 void FrameLoader::commitProvisionalLoad()
1086 { 1086 {
1087 ASSERT(client()->hasWebView()); 1087 ASSERT(client()->hasWebView());
1088 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1088 RawPtr<LocalFrame> protect(m_frame.get());
1089 1089
1090 // Check if the destination page is allowed to access the previous page's ti ming information. 1090 // Check if the destination page is allowed to access the previous page's ti ming information.
1091 if (m_frame->document()) { 1091 if (m_frame->document()) {
1092 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(m_provisi onalDocumentLoader->request().url()); 1092 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(m_provisi onalDocumentLoader->request().url());
1093 m_provisionalDocumentLoader->timing().setHasSameOriginAsPreviousDocument (securityOrigin->canRequest(m_frame->document()->url())); 1093 m_provisionalDocumentLoader->timing().setHasSameOriginAsPreviousDocument (securityOrigin->canRequest(m_frame->document()->url()));
1094 } 1094 }
1095 1095
1096 if (!prepareForCommit()) 1096 if (!prepareForCommit())
1097 return; 1097 return;
1098 1098
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 toLocalFrame(parent)->loader().scheduleCheckCompleted(); 1206 toLocalFrame(parent)->loader().scheduleCheckCompleted();
1207 if (m_progressTracker) { 1207 if (m_progressTracker) {
1208 m_progressTracker->dispose(); 1208 m_progressTracker->dispose();
1209 m_progressTracker.clear(); 1209 m_progressTracker.clear();
1210 } 1210 }
1211 } 1211 }
1212 1212
1213 void FrameLoader::receivedMainResourceError(DocumentLoader* loader, const Resour ceError& error) 1213 void FrameLoader::receivedMainResourceError(DocumentLoader* loader, const Resour ceError& error)
1214 { 1214 {
1215 // Retain because the stop may release the last reference to it. 1215 // Retain because the stop may release the last reference to it.
1216 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1216 RawPtr<LocalFrame> protect(m_frame.get());
1217 RefPtrWillBeRawPtr<DocumentLoader> protectDocumentLoader(loader); 1217 RawPtr<DocumentLoader> protectDocumentLoader(loader);
1218 1218
1219 // FIXME: We really ought to be able to just check for isCancellation() here , but there are some 1219 // FIXME: We really ought to be able to just check for isCancellation() here , but there are some
1220 // ResourceErrors that setIsCancellation() but aren't created by ResourceErr or::cancelledError(). 1220 // ResourceErrors that setIsCancellation() but aren't created by ResourceErr or::cancelledError().
1221 ResourceError c(ResourceError::cancelledError(KURL())); 1221 ResourceError c(ResourceError::cancelledError(KURL()));
1222 if ((error.errorCode() != c.errorCode() || error.domain() != c.domain()) && m_frame->owner()) { 1222 if ((error.errorCode() != c.errorCode() || error.domain() != c.domain()) && m_frame->owner()) {
1223 // FIXME: For now, fallback content doesn't work cross process. 1223 // FIXME: For now, fallback content doesn't work cross process.
1224 if (m_frame->owner()->isLocal()) 1224 if (m_frame->owner()->isLocal())
1225 m_frame->deprecatedLocalOwner()->renderFallbackContent(); 1225 m_frame->deprecatedLocalOwner()->renderFallbackContent();
1226 } 1226 }
1227 1227
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 && !m_frame->document()->isFrameSet(); 1261 && !m_frame->document()->isFrameSet();
1262 } 1262 }
1263 1263
1264 void FrameLoader::processFragment(const KURL& url, LoadStartType loadStartType) 1264 void FrameLoader::processFragment(const KURL& url, LoadStartType loadStartType)
1265 { 1265 {
1266 FrameView* view = m_frame->view(); 1266 FrameView* view = m_frame->view();
1267 if (!view) 1267 if (!view)
1268 return; 1268 return;
1269 1269
1270 // Leaking scroll position to a cross-origin ancestor would permit the so-ca lled "framesniffing" attack. 1270 // Leaking scroll position to a cross-origin ancestor would permit the so-ca lled "framesniffing" attack.
1271 RefPtrWillBeRawPtr<Frame> boundaryFrame = url.hasFragmentIdentifier() ? m_fr ame->findUnsafeParentScrollPropagationBoundary() : 0; 1271 RawPtr<Frame> boundaryFrame = url.hasFragmentIdentifier() ? m_frame->findUns afeParentScrollPropagationBoundary() : 0;
1272 1272
1273 // FIXME: Handle RemoteFrames 1273 // FIXME: Handle RemoteFrames
1274 if (boundaryFrame && boundaryFrame->isLocalFrame()) 1274 if (boundaryFrame && boundaryFrame->isLocalFrame())
1275 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar ent(false); 1275 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar ent(false);
1276 1276
1277 // If scroll position is restored from history fragment then we should not o verride it unless 1277 // If scroll position is restored from history fragment then we should not o verride it unless
1278 // this is a same document reload. 1278 // this is a same document reload.
1279 bool shouldScrollToFragment = (loadStartType == NavigationWithinSameDocument && !isBackForwardLoadType(m_loadType)) 1279 bool shouldScrollToFragment = (loadStartType == NavigationWithinSameDocument && !isBackForwardLoadType(m_loadType))
1280 || (documentLoader() && !documentLoader()->initialScrollState().didResto reFromHistory); 1280 || (documentLoader() && !documentLoader()->initialScrollState().didResto reFromHistory);
1281 1281
1282 view->processUrlFragment(url, shouldScrollToFragment ? 1282 view->processUrlFragment(url, shouldScrollToFragment ?
1283 FrameView::UrlFragmentScroll : FrameView::UrlFragmentDontScroll); 1283 FrameView::UrlFragmentScroll : FrameView::UrlFragmentDontScroll);
1284 1284
1285 if (boundaryFrame && boundaryFrame->isLocalFrame()) 1285 if (boundaryFrame && boundaryFrame->isLocalFrame())
1286 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar ent(true); 1286 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollToPar ent(true);
1287 } 1287 }
1288 1288
1289 bool FrameLoader::shouldClose(bool isReload) 1289 bool FrameLoader::shouldClose(bool isReload)
1290 { 1290 {
1291 Page* page = m_frame->page(); 1291 Page* page = m_frame->page();
1292 if (!page || !page->chromeClient().canOpenBeforeUnloadConfirmPanel()) 1292 if (!page || !page->chromeClient().canOpenBeforeUnloadConfirmPanel())
1293 return true; 1293 return true;
1294 1294
1295 // Store all references to each subframe in advance since beforeunload's eve nt handler may modify frame 1295 // Store all references to each subframe in advance since beforeunload's eve nt handler may modify frame
1296 WillBeHeapVector<RefPtrWillBeMember<LocalFrame>> targetFrames; 1296 HeapVector<Member<LocalFrame>> targetFrames;
1297 targetFrames.append(m_frame); 1297 targetFrames.append(m_frame);
1298 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().traverseNext(m_frame)) { 1298 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().traverseNext(m_frame)) {
1299 // FIXME: There is not yet any way to dispatch events to out-of-process frames. 1299 // FIXME: There is not yet any way to dispatch events to out-of-process frames.
1300 if (child->isLocalFrame()) 1300 if (child->isLocalFrame())
1301 targetFrames.append(toLocalFrame(child)); 1301 targetFrames.append(toLocalFrame(child));
1302 } 1302 }
1303 1303
1304 bool shouldClose = false; 1304 bool shouldClose = false;
1305 { 1305 {
1306 NavigationDisablerForBeforeUnload navigationDisabler; 1306 NavigationDisablerForBeforeUnload navigationDisabler;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processi ngUserGesture()) 1357 if (!LocalDOMWindow::allowPopUp(*m_frame) && !UserGestureIndicator::processi ngUserGesture())
1358 return false; 1358 return false;
1359 client()->loadURLExternally(request, policy, String(), replacesCurrentHistor yItem); 1359 client()->loadURLExternally(request, policy, String(), replacesCurrentHistor yItem);
1360 return false; 1360 return false;
1361 } 1361 }
1362 1362
1363 void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty pe, NavigationPolicy navigationPolicy) 1363 void FrameLoader::startLoad(FrameLoadRequest& frameLoadRequest, FrameLoadType ty pe, NavigationPolicy navigationPolicy)
1364 { 1364 {
1365 ASSERT(client()->hasWebView()); 1365 ASSERT(client()->hasWebView());
1366 // Lots of things in this function can detach the LocalFrame (stopAllLoaders , beforeunload handlers, etc.), so protect the frame. 1366 // Lots of things in this function can detach the LocalFrame (stopAllLoaders , beforeunload handlers, etc.), so protect the frame.
1367 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1367 RawPtr<LocalFrame> protect(m_frame.get());
1368 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) 1368 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal)
1369 return; 1369 return;
1370 1370
1371 NavigationType navigationType = determineNavigationType(type, frameLoadReque st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri ggeringEvent()); 1371 NavigationType navigationType = determineNavigationType(type, frameLoadReque st.resourceRequest().httpBody() || frameLoadRequest.form(), frameLoadRequest.tri ggeringEvent());
1372 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext FromNavigationType(navigationType)); 1372 frameLoadRequest.resourceRequest().setRequestContext(determineRequestContext FromNavigationType(navigationType));
1373 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested); 1373 frameLoadRequest.resourceRequest().setFrameType(m_frame->isMainFrame() ? Web URLRequest::FrameTypeTopLevel : WebURLRequest::FrameTypeNested);
1374 ResourceRequest& request = frameLoadRequest.resourceRequest(); 1374 ResourceRequest& request = frameLoadRequest.resourceRequest();
1375 if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteD ata(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), na vigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLo adRequest.clientRedirect() == ClientRedirect)) 1375 if (!shouldContinueForNavigationPolicy(request, frameLoadRequest.substituteD ata(), nullptr, frameLoadRequest.shouldCheckMainWorldContentSecurityPolicy(), na vigationType, navigationPolicy, type == FrameLoadTypeReplaceCurrentItem, frameLo adRequest.clientRedirect() == ClientRedirect))
1376 return; 1376 return;
1377 if (!shouldClose(navigationType == NavigationTypeReload)) 1377 if (!shouldClose(navigationType == NavigationTypeReload))
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 break; 1444 break;
1445 } 1445 }
1446 } 1446 }
1447 return false; 1447 return false;
1448 } 1448 }
1449 case XFrameOptionsDeny: 1449 case XFrameOptionsDeny:
1450 return true; 1450 return true;
1451 case XFrameOptionsAllowAll: 1451 case XFrameOptionsAllowAll:
1452 return false; 1452 return false;
1453 case XFrameOptionsConflict: { 1453 case XFrameOptionsConflict: {
1454 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'."); 1454 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'.");
1455 consoleMessage->setRequestIdentifier(requestIdentifier); 1455 consoleMessage->setRequestIdentifier(requestIdentifier);
1456 m_frame->document()->addConsoleMessage(consoleMessage.release()); 1456 m_frame->document()->addConsoleMessage(consoleMessage.release());
1457 return true; 1457 return true;
1458 } 1458 }
1459 case XFrameOptionsInvalid: { 1459 case XFrameOptionsInvalid: {
1460 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."); 1460 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.");
1461 consoleMessage->setRequestIdentifier(requestIdentifier); 1461 consoleMessage->setRequestIdentifier(requestIdentifier);
1462 m_frame->document()->addConsoleMessage(consoleMessage.release()); 1462 m_frame->document()->addConsoleMessage(consoleMessage.release());
1463 return false; 1463 return false;
1464 } 1464 }
1465 default: 1465 default:
1466 ASSERT_NOT_REACHED(); 1466 ASSERT_NOT_REACHED();
1467 return false; 1467 return false;
1468 } 1468 }
1469 } 1469 }
1470 1470
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 // FIXME: We need a way to propagate insecure requests policy flags to 1561 // FIXME: We need a way to propagate insecure requests policy flags to
1562 // out-of-process frames. For now, we'll always use default behavior. 1562 // out-of-process frames. For now, we'll always use default behavior.
1563 if (!parentFrame->isLocalFrame()) 1563 if (!parentFrame->isLocalFrame())
1564 return nullptr; 1564 return nullptr;
1565 1565
1566 ASSERT(toLocalFrame(parentFrame)->document()); 1566 ASSERT(toLocalFrame(parentFrame)->document());
1567 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1567 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1568 } 1568 }
1569 1569
1570 } // namespace blink 1570 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698