OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. |
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> | 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> |
8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
9 * | 9 * |
10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 #include "core/editing/UndoStack.h" | 46 #include "core/editing/UndoStack.h" |
47 #include "core/events/PageTransitionEvent.h" | 47 #include "core/events/PageTransitionEvent.h" |
48 #include "core/fetch/FetchContext.h" | 48 #include "core/fetch/FetchContext.h" |
49 #include "core/fetch/ResourceFetcher.h" | 49 #include "core/fetch/ResourceFetcher.h" |
50 #include "core/fetch/ResourceLoader.h" | 50 #include "core/fetch/ResourceLoader.h" |
51 #include "core/frame/LocalDOMWindow.h" | 51 #include "core/frame/LocalDOMWindow.h" |
52 #include "core/frame/FrameHost.h" | 52 #include "core/frame/FrameHost.h" |
53 #include "core/frame/FrameView.h" | 53 #include "core/frame/FrameView.h" |
54 #include "core/frame/LocalFrame.h" | 54 #include "core/frame/LocalFrame.h" |
55 #include "core/frame/PinchViewport.h" | 55 #include "core/frame/PinchViewport.h" |
56 #include "core/frame/Settings.h" | |
56 #include "core/frame/csp/ContentSecurityPolicy.h" | 57 #include "core/frame/csp/ContentSecurityPolicy.h" |
57 #include "core/html/HTMLFormElement.h" | 58 #include "core/html/HTMLFormElement.h" |
58 #include "core/html/HTMLFrameOwnerElement.h" | 59 #include "core/html/HTMLFrameOwnerElement.h" |
59 #include "core/html/parser/HTMLParserIdioms.h" | 60 #include "core/html/parser/HTMLParserIdioms.h" |
60 #include "core/inspector/ConsoleMessage.h" | 61 #include "core/inspector/ConsoleMessage.h" |
61 #include "core/inspector/InspectorController.h" | 62 #include "core/inspector/InspectorController.h" |
62 #include "core/inspector/InspectorInstrumentation.h" | 63 #include "core/inspector/InspectorInstrumentation.h" |
63 #include "core/loader/DocumentLoadTiming.h" | 64 #include "core/loader/DocumentLoadTiming.h" |
64 #include "core/loader/DocumentLoader.h" | 65 #include "core/loader/DocumentLoader.h" |
65 #include "core/loader/FormState.h" | 66 #include "core/loader/FormState.h" |
66 #include "core/loader/FormSubmission.h" | 67 #include "core/loader/FormSubmission.h" |
67 #include "core/loader/FrameFetchContext.h" | 68 #include "core/loader/FrameFetchContext.h" |
68 #include "core/loader/FrameLoadRequest.h" | 69 #include "core/loader/FrameLoadRequest.h" |
69 #include "core/loader/FrameLoaderClient.h" | 70 #include "core/loader/FrameLoaderClient.h" |
70 #include "core/loader/MixedContentChecker.h" | 71 #include "core/loader/MixedContentChecker.h" |
71 #include "core/loader/ProgressTracker.h" | 72 #include "core/loader/ProgressTracker.h" |
72 #include "core/loader/UniqueIdentifier.h" | 73 #include "core/loader/UniqueIdentifier.h" |
73 #include "core/loader/appcache/ApplicationCacheHost.h" | 74 #include "core/loader/appcache/ApplicationCacheHost.h" |
74 #include "core/page/BackForwardClient.h" | 75 #include "core/page/BackForwardClient.h" |
75 #include "core/page/Chrome.h" | 76 #include "core/page/Chrome.h" |
76 #include "core/page/ChromeClient.h" | 77 #include "core/page/ChromeClient.h" |
77 #include "core/page/CreateWindow.h" | 78 #include "core/page/CreateWindow.h" |
78 #include "core/page/EventHandler.h" | 79 #include "core/page/EventHandler.h" |
79 #include "core/page/FrameTree.h" | 80 #include "core/page/FrameTree.h" |
80 #include "core/page/Page.h" | 81 #include "core/page/Page.h" |
81 #include "core/frame/Settings.h" | |
82 #include "core/page/WindowFeatures.h" | 82 #include "core/page/WindowFeatures.h" |
83 #include "core/page/scrolling/ScrollingCoordinator.h" | 83 #include "core/page/scrolling/ScrollingCoordinator.h" |
84 #include "core/xml/parser/XMLDocumentParser.h" | 84 #include "core/xml/parser/XMLDocumentParser.h" |
85 #include "platform/Logging.h" | 85 #include "platform/Logging.h" |
86 #include "platform/UserGestureIndicator.h" | 86 #include "platform/UserGestureIndicator.h" |
87 #include "platform/geometry/FloatRect.h" | 87 #include "platform/geometry/FloatRect.h" |
88 #include "platform/network/HTTPParsers.h" | 88 #include "platform/network/HTTPParsers.h" |
89 #include "platform/network/ResourceRequest.h" | 89 #include "platform/network/ResourceRequest.h" |
90 #include "platform/scroll/ScrollAnimator.h" | 90 #include "platform/scroll/ScrollAnimator.h" |
91 #include "platform/weborigin/SecurityOrigin.h" | 91 #include "platform/weborigin/SecurityOrigin.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
122 , m_didAccessInitialDocument(false) | 122 , m_didAccessInitialDocument(false) |
123 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired) | 123 , m_didAccessInitialDocumentTimer(this, &FrameLoader::didAccessInitialDocume ntTimerFired) |
124 , m_forcedSandboxFlags(SandboxNone) | 124 , m_forcedSandboxFlags(SandboxNone) |
125 { | 125 { |
126 } | 126 } |
127 | 127 |
128 FrameLoader::~FrameLoader() | 128 FrameLoader::~FrameLoader() |
129 { | 129 { |
130 } | 130 } |
131 | 131 |
132 void FrameLoader::trace(Visitor* visitor) | |
133 { | |
134 visitor->trace(m_frame); | |
135 visitor->trace(m_fetchContext); | |
136 } | |
137 | |
132 void FrameLoader::init() | 138 void FrameLoader::init() |
133 { | 139 { |
134 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString())); | 140 ResourceRequest initialRequest(KURL(ParsedURLString, emptyString())); |
135 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal); | 141 initialRequest.setRequestContext(WebURLRequest::RequestContextInternal); |
136 initialRequest.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTyp eTopLevel : WebURLRequest::FrameTypeNested); | 142 initialRequest.setFrameType(m_frame->isMainFrame() ? WebURLRequest::FrameTyp eTopLevel : WebURLRequest::FrameTypeNested); |
137 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, initia lRequest, SubstituteData()); | 143 m_provisionalDocumentLoader = client()->createDocumentLoader(m_frame, initia lRequest, SubstituteData()); |
138 m_provisionalDocumentLoader->startLoadingMainResource(); | 144 m_provisionalDocumentLoader->startLoadingMainResource(); |
139 m_frame->document()->cancelParsing(); | 145 m_frame->document()->cancelParsing(); |
140 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu ment); | 146 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu ment); |
141 } | 147 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 | 240 |
235 // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results | 241 // Prevent window.open(url) -- eg window.open("about:blank") -- from blowing away results |
236 // from a subsequent window.document.open / window.document.write call. | 242 // from a subsequent window.document.open / window.document.write call. |
237 // Canceling redirection here works for all cases because document.open | 243 // Canceling redirection here works for all cases because document.open |
238 // implicitly precedes document.write. | 244 // implicitly precedes document.write. |
239 m_frame->navigationScheduler().cancel(); | 245 m_frame->navigationScheduler().cancel(); |
240 } | 246 } |
241 | 247 |
242 void FrameLoader::clear() | 248 void FrameLoader::clear() |
243 { | 249 { |
250 // clear() is called during (Local)Frame finalization and when creating | |
251 // a new Document within it (DocumentLoader::createWriterFor().) | |
haraken
2014/09/22 05:35:23
This comment looks out-dated. FrameLoader::clear()
sof
2014/09/22 10:03:54
Yes, thanks - refreshed the comment via https://co
| |
244 if (m_stateMachine.creatingInitialEmptyDocument()) | 252 if (m_stateMachine.creatingInitialEmptyDocument()) |
245 return; | 253 return; |
246 | 254 |
247 m_frame->editor().clear(); | 255 m_frame->editor().clear(); |
248 m_frame->document()->cancelParsing(); | 256 m_frame->document()->cancelParsing(); |
249 m_frame->document()->prepareForDestruction(); | 257 m_frame->document()->prepareForDestruction(); |
250 m_frame->document()->removeFocusedElementOfSubtree(m_frame->document()); | 258 m_frame->document()->removeFocusedElementOfSubtree(m_frame->document()); |
251 | |
252 m_frame->selection().prepareForDestruction(); | 259 m_frame->selection().prepareForDestruction(); |
253 m_frame->eventHandler().clear(); | 260 m_frame->eventHandler().clear(); |
254 if (m_frame->view()) | 261 if (m_frame->view()) |
255 m_frame->view()->clear(); | 262 m_frame->view()->clear(); |
256 | 263 |
257 m_frame->script().enableEval(); | 264 m_frame->script().enableEval(); |
258 | 265 |
259 m_frame->navigationScheduler().cancel(); | 266 m_frame->navigationScheduler().cancel(); |
260 | 267 |
261 m_checkTimer.stop(); | 268 m_checkTimer.stop(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 } | 398 } |
392 | 399 |
393 void FrameLoader::finishedParsing() | 400 void FrameLoader::finishedParsing() |
394 { | 401 { |
395 if (m_stateMachine.creatingInitialEmptyDocument()) | 402 if (m_stateMachine.creatingInitialEmptyDocument()) |
396 return; | 403 return; |
397 | 404 |
398 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves | 405 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves |
399 // because doing so will cause us to re-enter the destructor when protector goes out of scope. | 406 // because doing so will cause us to re-enter the destructor when protector goes out of scope. |
400 // Null-checking the FrameView indicates whether or not we're in the destruc tor. | 407 // Null-checking the FrameView indicates whether or not we're in the destruc tor. |
401 RefPtr<LocalFrame> protector = m_frame->view() ? m_frame : 0; | 408 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nul lptr); |
402 | 409 |
403 if (client()) | 410 if (client()) |
404 client()->dispatchDidFinishDocumentLoad(); | 411 client()->dispatchDidFinishDocumentLoad(); |
405 | 412 |
406 checkCompleted(); | 413 checkCompleted(); |
407 | 414 |
408 if (!m_frame->view()) | 415 if (!m_frame->view()) |
409 return; // We are being destroyed by something checkCompleted called. | 416 return; // We are being destroyed by something checkCompleted called. |
410 | 417 |
411 // Check if the scrollbars are really needed for the content. | 418 // Check if the scrollbars are really needed for the content. |
(...skipping 23 matching lines...) Expand all Loading... | |
435 { | 442 { |
436 for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree().parent ()) { | 443 for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree().parent ()) { |
437 if (ancestor->isLocalFrame() && !toLocalFrame(ancestor)->document()->loa dEventFinished()) | 444 if (ancestor->isLocalFrame() && !toLocalFrame(ancestor)->document()->loa dEventFinished()) |
438 return false; | 445 return false; |
439 } | 446 } |
440 return true; | 447 return true; |
441 } | 448 } |
442 | 449 |
443 void FrameLoader::checkCompleted() | 450 void FrameLoader::checkCompleted() |
444 { | 451 { |
445 RefPtr<LocalFrame> protect(m_frame); | 452 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
446 | 453 |
447 if (m_frame->view()) | 454 if (m_frame->view()) |
448 m_frame->view()->handleLoadCompleted(); | 455 m_frame->view()->handleLoadCompleted(); |
449 | 456 |
450 if (m_frame->document()->isLoadCompleted() && m_stateMachine.committedFirstR ealDocumentLoad()) | 457 if (m_frame->document()->isLoadCompleted() && m_stateMachine.committedFirstR ealDocumentLoad()) |
451 return; | 458 return; |
452 | 459 |
453 // Are we still parsing? | 460 // Are we still parsing? |
454 if (m_frame->document()->parsing()) | 461 if (m_frame->document()->parsing()) |
455 return; | 462 return; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 | 514 |
508 void FrameLoader::setOpener(LocalFrame* opener) | 515 void FrameLoader::setOpener(LocalFrame* opener) |
509 { | 516 { |
510 // If the frame is already detached, the opener has already been cleared. | 517 // If the frame is already detached, the opener has already been cleared. |
511 if (client()) | 518 if (client()) |
512 client()->setOpener(opener); | 519 client()->setOpener(opener); |
513 } | 520 } |
514 | 521 |
515 bool FrameLoader::allowPlugins(ReasonForCallingAllowPlugins reason) | 522 bool FrameLoader::allowPlugins(ReasonForCallingAllowPlugins reason) |
516 { | 523 { |
524 // With Oilpan, a FrameLoader might be accessed after the | |
525 // FrameHost has been detached. FrameClient will not be | |
526 // accessible, so bail early. | |
527 if (!client()) | |
528 return false; | |
517 Settings* settings = m_frame->settings(); | 529 Settings* settings = m_frame->settings(); |
518 bool allowed = client()->allowPlugins(settings && settings->pluginsEnabled() ); | 530 bool allowed = client()->allowPlugins(settings && settings->pluginsEnabled() ); |
519 if (!allowed && reason == AboutToInstantiatePlugin) | 531 if (!allowed && reason == AboutToInstantiatePlugin) |
520 client()->didNotAllowPlugins(); | 532 client()->didNotAllowPlugins(); |
521 return allowed; | 533 return allowed; |
522 } | 534 } |
523 | 535 |
524 void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume ntNavigationSource sameDocumentNavigationSource, PassRefPtr<SerializedScriptValu e> data, FrameLoadType type) | 536 void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume ntNavigationSource sameDocumentNavigationSource, PassRefPtr<SerializedScriptValu e> data, FrameLoadType type) |
525 { | 537 { |
526 // Update the data source's request with the new URL to fake the URL change | 538 // Update the data source's request with the new URL to fake the URL change |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 // We need to scroll to the fragment whether or not a hash change occurred, since | 589 // We need to scroll to the fragment whether or not a hash change occurred, since |
578 // the user might have scrolled since the previous navigation. | 590 // the user might have scrolled since the previous navigation. |
579 scrollToFragmentWithParentBoundary(url); | 591 scrollToFragmentWithParentBoundary(url); |
580 checkCompleted(); | 592 checkCompleted(); |
581 | 593 |
582 m_frame->domWindow()->statePopped(stateObject ? stateObject : SerializedScri ptValue::nullValue()); | 594 m_frame->domWindow()->statePopped(stateObject ? stateObject : SerializedScri ptValue::nullValue()); |
583 } | 595 } |
584 | 596 |
585 void FrameLoader::completed() | 597 void FrameLoader::completed() |
586 { | 598 { |
587 RefPtr<LocalFrame> protect(m_frame); | 599 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
588 | 600 |
589 for (Frame* descendant = m_frame->tree().traverseNext(m_frame); descendant; descendant = descendant->tree().traverseNext(m_frame)) { | 601 for (Frame* descendant = m_frame->tree().traverseNext(m_frame); descendant; descendant = descendant->tree().traverseNext(m_frame)) { |
590 if (descendant->isLocalFrame()) | 602 if (descendant->isLocalFrame()) |
591 toLocalFrame(descendant)->navigationScheduler().startTimer(); | 603 toLocalFrame(descendant)->navigationScheduler().startTimer(); |
592 } | 604 } |
593 | 605 |
594 Frame* parent = m_frame->tree().parent(); | 606 Frame* parent = m_frame->tree().parent(); |
595 if (parent && parent->isLocalFrame()) | 607 if (parent && parent->isLocalFrame()) |
596 toLocalFrame(parent)->loader().checkCompleted(); | 608 toLocalFrame(parent)->loader().checkCompleted(); |
597 | 609 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 return WebURLRequest::RequestContextInternal; | 713 return WebURLRequest::RequestContextInternal; |
702 } | 714 } |
703 ASSERT_NOT_REACHED(); | 715 ASSERT_NOT_REACHED(); |
704 return WebURLRequest::RequestContextHyperlink; | 716 return WebURLRequest::RequestContextHyperlink; |
705 } | 717 } |
706 | 718 |
707 void FrameLoader::load(const FrameLoadRequest& passedRequest) | 719 void FrameLoader::load(const FrameLoadRequest& passedRequest) |
708 { | 720 { |
709 ASSERT(m_frame->document()); | 721 ASSERT(m_frame->document()); |
710 | 722 |
711 RefPtr<LocalFrame> protect(m_frame); | 723 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
712 | 724 |
713 if (m_inStopAllLoaders) | 725 if (m_inStopAllLoaders) |
714 return; | 726 return; |
715 | 727 |
716 FrameLoadRequest request(passedRequest); | 728 FrameLoadRequest request(passedRequest); |
717 if (!prepareRequestForThisFrame(request)) | 729 if (!prepareRequestForThisFrame(request)) |
718 return; | 730 return; |
719 | 731 |
720 RefPtr<LocalFrame> targetFrame = request.formState() ? 0 : findFrameForNavig ation(AtomicString(request.frameName()), request.formState() ? request.formState ()->sourceDocument() : m_frame->document()); | 732 RefPtrWillBeRawPtr<LocalFrame> targetFrame = request.formState() ? 0 : findF rameForNavigation(AtomicString(request.frameName()), request.formState() ? reque st.formState()->sourceDocument() : m_frame->document()); |
721 if (targetFrame && targetFrame != m_frame) { | 733 if (targetFrame && targetFrame.get() != m_frame) { |
722 request.setFrameName("_self"); | 734 request.setFrameName("_self"); |
723 targetFrame->loader().load(request); | 735 targetFrame->loader().load(request); |
724 if (Page* page = targetFrame->page()) | 736 if (Page* page = targetFrame->page()) |
725 page->chrome().focus(); | 737 page->chrome().focus(); |
726 return; | 738 return; |
727 } | 739 } |
728 | 740 |
729 FrameLoadType newLoadType = determineFrameLoadType(request); | 741 FrameLoadType newLoadType = determineFrameLoadType(request); |
730 NavigationAction action(request.resourceRequest(), newLoadType, request.form State(), request.triggeringEvent()); | 742 NavigationAction action(request.resourceRequest(), newLoadType, request.form State(), request.triggeringEvent()); |
731 if (action.resourceRequest().requestContext() == WebURLRequest::RequestConte xtUnspecified) | 743 if (action.resourceRequest().requestContext() == WebURLRequest::RequestConte xtUnspecified) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 { | 835 { |
824 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) | 836 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) |
825 return; | 837 return; |
826 | 838 |
827 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. | 839 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. |
828 if (m_inStopAllLoaders) | 840 if (m_inStopAllLoaders) |
829 return; | 841 return; |
830 | 842 |
831 // Calling stopLoading() on the provisional document loader can blow away | 843 // Calling stopLoading() on the provisional document loader can blow away |
832 // the frame from underneath. | 844 // the frame from underneath. |
833 RefPtr<LocalFrame> protect(m_frame); | 845 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
834 | 846 |
835 m_inStopAllLoaders = true; | 847 m_inStopAllLoaders = true; |
836 | 848 |
837 for (RefPtr<Frame> child = m_frame->tree().firstChild(); child; child = chil d->tree().nextSibling()) { | 849 for (RefPtrWillBeRawPtr<Frame> child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { |
838 if (child->isLocalFrame()) | 850 if (child->isLocalFrame()) |
839 toLocalFrame(child.get())->loader().stopAllLoaders(); | 851 toLocalFrame(child.get())->loader().stopAllLoaders(); |
840 } | 852 } |
841 if (m_provisionalDocumentLoader) | 853 if (m_provisionalDocumentLoader) |
842 m_provisionalDocumentLoader->stopLoading(); | 854 m_provisionalDocumentLoader->stopLoading(); |
843 if (m_documentLoader) | 855 if (m_documentLoader) |
844 m_documentLoader->stopLoading(); | 856 m_documentLoader->stopLoading(); |
845 | 857 |
846 if (m_provisionalDocumentLoader) | 858 if (m_provisionalDocumentLoader) |
847 m_provisionalDocumentLoader->detachFromFrame(); | 859 m_provisionalDocumentLoader->detachFromFrame(); |
(...skipping 14 matching lines...) Expand all Loading... | |
862 // We only need to notify the client once, and only for the main frame. | 874 // We only need to notify the client once, and only for the main frame. |
863 if (isLoadingMainFrame() && !m_didAccessInitialDocument) { | 875 if (isLoadingMainFrame() && !m_didAccessInitialDocument) { |
864 m_didAccessInitialDocument = true; | 876 m_didAccessInitialDocument = true; |
865 // Notify asynchronously, since this is called within a JavaScript secur ity check. | 877 // Notify asynchronously, since this is called within a JavaScript secur ity check. |
866 m_didAccessInitialDocumentTimer.startOneShot(0, FROM_HERE); | 878 m_didAccessInitialDocumentTimer.startOneShot(0, FROM_HERE); |
867 } | 879 } |
868 } | 880 } |
869 | 881 |
870 void FrameLoader::didAccessInitialDocumentTimerFired(Timer<FrameLoader>*) | 882 void FrameLoader::didAccessInitialDocumentTimerFired(Timer<FrameLoader>*) |
871 { | 883 { |
872 client()->didAccessInitialDocument(); | 884 if (client()) |
885 client()->didAccessInitialDocument(); | |
873 } | 886 } |
874 | 887 |
875 void FrameLoader::notifyIfInitialDocumentAccessed() | 888 void FrameLoader::notifyIfInitialDocumentAccessed() |
876 { | 889 { |
877 if (m_didAccessInitialDocumentTimer.isActive()) { | 890 if (m_didAccessInitialDocumentTimer.isActive()) { |
878 m_didAccessInitialDocumentTimer.stop(); | 891 m_didAccessInitialDocumentTimer.stop(); |
879 didAccessInitialDocumentTimerFired(0); | 892 didAccessInitialDocumentTimerFired(0); |
880 } | 893 } |
881 } | 894 } |
882 | 895 |
883 void FrameLoader::commitProvisionalLoad() | 896 void FrameLoader::commitProvisionalLoad() |
884 { | 897 { |
885 ASSERT(client()->hasWebView()); | 898 ASSERT(client()->hasWebView()); |
886 ASSERT(m_state == FrameStateProvisional); | 899 ASSERT(m_state == FrameStateProvisional); |
887 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; | 900 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; |
888 RefPtr<LocalFrame> protect(m_frame); | 901 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
889 | 902 |
890 // Check if the destination page is allowed to access the previous page's ti ming information. | 903 // Check if the destination page is allowed to access the previous page's ti ming information. |
891 if (m_frame->document()) { | 904 if (m_frame->document()) { |
892 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->requ est().url()); | 905 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->requ est().url()); |
893 pdl->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canReq uest(m_frame->document()->url())); | 906 pdl->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canReq uest(m_frame->document()->url())); |
894 } | 907 } |
895 | 908 |
896 // The call to closeURL() invokes the unload event handler, which can execut e arbitrary | 909 // The call to closeURL() invokes the unload event handler, which can execut e arbitrary |
897 // JavaScript. If the script initiates a new load, we need to abandon the cu rrent load, | 910 // JavaScript. If the script initiates a new load, we need to abandon the cu rrent load, |
898 // or the two will stomp each other. | 911 // or the two will stomp each other. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
953 if (document->processingLoadEvent()) | 966 if (document->processingLoadEvent()) |
954 return false; | 967 return false; |
955 if (document->hasActiveParser()) | 968 if (document->hasActiveParser()) |
956 return false; | 969 return false; |
957 return true; | 970 return true; |
958 } | 971 } |
959 | 972 |
960 bool FrameLoader::checkLoadCompleteForThisFrame() | 973 bool FrameLoader::checkLoadCompleteForThisFrame() |
961 { | 974 { |
962 ASSERT(client()->hasWebView()); | 975 ASSERT(client()->hasWebView()); |
963 RefPtr<LocalFrame> protect(m_frame); | 976 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
964 | 977 |
965 bool allChildrenAreDoneLoading = true; | 978 bool allChildrenAreDoneLoading = true; |
966 for (RefPtr<Frame> child = m_frame->tree().firstChild(); child; child = chil d->tree().nextSibling()) { | 979 for (RefPtrWillBeRawPtr<Frame> child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { |
967 if (child->isLocalFrame()) | 980 if (child->isLocalFrame()) |
968 allChildrenAreDoneLoading &= toLocalFrame(child.get())->loader().che ckLoadCompleteForThisFrame(); | 981 allChildrenAreDoneLoading &= toLocalFrame(child.get())->loader().che ckLoadCompleteForThisFrame(); |
969 } | 982 } |
970 | 983 |
971 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { | 984 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { |
972 const ResourceError& error = m_provisionalDocumentLoader->mainDocumentEr ror(); | 985 const ResourceError& error = m_provisionalDocumentLoader->mainDocumentEr ror(); |
973 if (error.isNull()) | 986 if (error.isNull()) |
974 return false; | 987 return false; |
975 RefPtr<DocumentLoader> loader = m_provisionalDocumentLoader; | 988 RefPtr<DocumentLoader> loader = m_provisionalDocumentLoader; |
976 client()->dispatchDidFailProvisionalLoad(error); | 989 client()->dispatchDidFailProvisionalLoad(error); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1083 | 1096 |
1084 String FrameLoader::userAgent(const KURL& url) const | 1097 String FrameLoader::userAgent(const KURL& url) const |
1085 { | 1098 { |
1086 String userAgent = client()->userAgent(url); | 1099 String userAgent = client()->userAgent(url); |
1087 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); | 1100 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); |
1088 return userAgent; | 1101 return userAgent; |
1089 } | 1102 } |
1090 | 1103 |
1091 void FrameLoader::detachFromParent() | 1104 void FrameLoader::detachFromParent() |
1092 { | 1105 { |
1106 #if !ENABLE(OILPAN) | |
1093 // The caller must protect a reference to m_frame. | 1107 // The caller must protect a reference to m_frame. |
1094 ASSERT(m_frame->refCount() > 1); | 1108 ASSERT(m_frame->refCount() > 1); |
1109 #endif | |
1095 | 1110 |
1096 InspectorInstrumentation::frameDetachedFromParent(m_frame); | 1111 InspectorInstrumentation::frameDetachedFromParent(m_frame); |
1097 | 1112 |
1098 if (m_documentLoader) | 1113 if (m_documentLoader) |
1099 m_documentLoader->detachFromFrame(); | 1114 m_documentLoader->detachFromFrame(); |
1100 m_documentLoader = nullptr; | 1115 m_documentLoader = nullptr; |
1101 | 1116 |
1102 if (!client()) | 1117 if (!client()) |
1103 return; | 1118 return; |
1104 | 1119 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1138 // After this, we must no longer talk to the client since this clears | 1153 // After this, we must no longer talk to the client since this clears |
1139 // its owning reference back to our owning LocalFrame. | 1154 // its owning reference back to our owning LocalFrame. |
1140 client()->detachedFromParent(); | 1155 client()->detachedFromParent(); |
1141 m_frame->clearClient(); | 1156 m_frame->clearClient(); |
1142 } | 1157 } |
1143 } | 1158 } |
1144 | 1159 |
1145 void FrameLoader::receivedMainResourceError(const ResourceError& error) | 1160 void FrameLoader::receivedMainResourceError(const ResourceError& error) |
1146 { | 1161 { |
1147 // Retain because the stop may release the last reference to it. | 1162 // Retain because the stop may release the last reference to it. |
1148 RefPtr<LocalFrame> protect(m_frame); | 1163 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
1149 | 1164 |
1150 if (m_frame->document()->parser()) | 1165 if (m_frame->document()->parser()) |
1151 m_frame->document()->parser()->stopParsing(); | 1166 m_frame->document()->parser()->stopParsing(); |
1152 | 1167 |
1153 // FIXME: We really ought to be able to just check for isCancellation() here , but there are some | 1168 // FIXME: We really ought to be able to just check for isCancellation() here , but there are some |
1154 // ResourceErrors that setIsCancellation() but aren't created by ResourceErr or::cancelledError(). | 1169 // ResourceErrors that setIsCancellation() but aren't created by ResourceErr or::cancelledError(). |
1155 ResourceError c(ResourceError::cancelledError(KURL())); | 1170 ResourceError c(ResourceError::cancelledError(KURL())); |
1156 if ((error.errorCode() != c.errorCode() || error.domain() != c.domain()) && m_frame->owner()) { | 1171 if ((error.errorCode() != c.errorCode() || error.domain() != c.domain()) && m_frame->owner()) { |
1157 // FIXME: For now, fallback content doesn't work cross process. | 1172 // FIXME: For now, fallback content doesn't work cross process. |
1158 ASSERT(m_frame->owner()->isLocal()); | 1173 ASSERT(m_frame->owner()->isLocal()); |
(...skipping 21 matching lines...) Expand all Loading... | |
1180 && !m_frame->document()->isFrameSet(); | 1195 && !m_frame->document()->isFrameSet(); |
1181 } | 1196 } |
1182 | 1197 |
1183 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) | 1198 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) |
1184 { | 1199 { |
1185 FrameView* view = m_frame->view(); | 1200 FrameView* view = m_frame->view(); |
1186 if (!view) | 1201 if (!view) |
1187 return; | 1202 return; |
1188 | 1203 |
1189 // Leaking scroll position to a cross-origin ancestor would permit the so-ca lled "framesniffing" attack. | 1204 // Leaking scroll position to a cross-origin ancestor would permit the so-ca lled "framesniffing" attack. |
1190 RefPtr<LocalFrame> boundaryFrame(url.hasFragmentIdentifier() ? m_frame->docu ment()->findUnsafeParentScrollPropagationBoundary() : 0); | 1205 RefPtrWillBeRawPtr<LocalFrame> boundaryFrame = url.hasFragmentIdentifier() ? m_frame->document()->findUnsafeParentScrollPropagationBoundary() : 0; |
1191 | 1206 |
1192 if (boundaryFrame) | 1207 if (boundaryFrame) |
1193 boundaryFrame->view()->setSafeToPropagateScrollToParent(false); | 1208 boundaryFrame->view()->setSafeToPropagateScrollToParent(false); |
1194 | 1209 |
1195 view->scrollToFragment(url); | 1210 view->scrollToFragment(url); |
1196 | 1211 |
1197 if (boundaryFrame) | 1212 if (boundaryFrame) |
1198 boundaryFrame->view()->setSafeToPropagateScrollToParent(true); | 1213 boundaryFrame->view()->setSafeToPropagateScrollToParent(true); |
1199 } | 1214 } |
1200 | 1215 |
1201 bool FrameLoader::shouldClose() | 1216 bool FrameLoader::shouldClose() |
1202 { | 1217 { |
1203 Page* page = m_frame->page(); | 1218 Page* page = m_frame->page(); |
1204 if (!page || !page->chrome().canRunBeforeUnloadConfirmPanel()) | 1219 if (!page || !page->chrome().canRunBeforeUnloadConfirmPanel()) |
1205 return true; | 1220 return true; |
1206 | 1221 |
1207 // Store all references to each subframe in advance since beforeunload's eve nt handler may modify frame | 1222 // Store all references to each subframe in advance since beforeunload's eve nt handler may modify frame |
1208 Vector<RefPtr<LocalFrame> > targetFrames; | 1223 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > targetFrames; |
1209 targetFrames.append(m_frame); | 1224 targetFrames.append(m_frame); |
1210 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().traverseNext(m_frame)) { | 1225 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().traverseNext(m_frame)) { |
1211 // FIXME: There is not yet any way to dispatch events to out-of-process frames. | 1226 // FIXME: There is not yet any way to dispatch events to out-of-process frames. |
1212 if (child->isLocalFrame()) | 1227 if (child->isLocalFrame()) |
1213 targetFrames.append(toLocalFrame(child)); | 1228 targetFrames.append(toLocalFrame(child)); |
1214 } | 1229 } |
1215 | 1230 |
1216 bool shouldClose = false; | 1231 bool shouldClose = false; |
1217 { | 1232 { |
1218 NavigationDisablerForBeforeUnload navigationDisabler; | 1233 NavigationDisablerForBeforeUnload navigationDisabler; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1285 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); | 1300 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); |
1286 else if (m_documentLoader) | 1301 else if (m_documentLoader) |
1287 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding()); | 1302 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding()); |
1288 | 1303 |
1289 | 1304 |
1290 bool isTransitionNavigation = false; | 1305 bool isTransitionNavigation = false; |
1291 if (RuntimeEnabledFeatures::navigationTransitionsEnabled() && type != FrameL oadTypeReload && type != FrameLoadTypeReloadFromOrigin && type != FrameLoadTypeS ame) | 1306 if (RuntimeEnabledFeatures::navigationTransitionsEnabled() && type != FrameL oadTypeReload && type != FrameLoadTypeReloadFromOrigin && type != FrameLoadTypeS ame) |
1292 isTransitionNavigation = dispatchNavigationTransitionData(); | 1307 isTransitionNavigation = dispatchNavigationTransitionData(); |
1293 | 1308 |
1294 // stopAllLoaders can detach the LocalFrame, so protect it. | 1309 // stopAllLoaders can detach the LocalFrame, so protect it. |
1295 RefPtr<LocalFrame> protect(m_frame); | 1310 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
1296 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, sho uldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose( )) && m_policyDocumentLoader) { | 1311 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, sho uldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose( )) && m_policyDocumentLoader) { |
1297 m_policyDocumentLoader->detachFromFrame(); | 1312 m_policyDocumentLoader->detachFromFrame(); |
1298 m_policyDocumentLoader = nullptr; | 1313 m_policyDocumentLoader = nullptr; |
1299 checkCompleted(); | 1314 checkCompleted(); |
1300 return; | 1315 return; |
1301 } | 1316 } |
1302 | 1317 |
1303 if (m_provisionalDocumentLoader) { | 1318 if (m_provisionalDocumentLoader) { |
1304 m_provisionalDocumentLoader->stopLoading(); | 1319 m_provisionalDocumentLoader->stopLoading(); |
1305 if (m_provisionalDocumentLoader) | 1320 if (m_provisionalDocumentLoader) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1406 { | 1421 { |
1407 ASSERT(activeDocument); | 1422 ASSERT(activeDocument); |
1408 Frame* frame = m_frame->tree().find(name); | 1423 Frame* frame = m_frame->tree().find(name); |
1409 if (!frame || !frame->isLocalFrame() || !activeDocument->canNavigate(toLocal Frame(*frame))) | 1424 if (!frame || !frame->isLocalFrame() || !activeDocument->canNavigate(toLocal Frame(*frame))) |
1410 return 0; | 1425 return 0; |
1411 return toLocalFrame(frame); | 1426 return toLocalFrame(frame); |
1412 } | 1427 } |
1413 | 1428 |
1414 void FrameLoader::loadHistoryItem(HistoryItem* item, HistoryLoadType historyLoad Type, ResourceRequestCachePolicy cachePolicy) | 1429 void FrameLoader::loadHistoryItem(HistoryItem* item, HistoryLoadType historyLoad Type, ResourceRequestCachePolicy cachePolicy) |
1415 { | 1430 { |
1416 RefPtr<LocalFrame> protect(m_frame); | 1431 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
1417 if (m_frame->page()->defersLoading()) { | 1432 if (m_frame->page()->defersLoading()) { |
1418 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache Policy); | 1433 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache Policy); |
1419 return; | 1434 return; |
1420 } | 1435 } |
1421 | 1436 |
1422 m_provisionalItem = item; | 1437 m_provisionalItem = item; |
1423 if (historyLoadType == HistorySameDocumentLoad) { | 1438 if (historyLoadType == HistorySameDocumentLoad) { |
1424 loadInSameDocument(item->url(), item->stateObject(), FrameLoadTypeBackFo rward, NotClientRedirect); | 1439 loadInSameDocument(item->url(), item->stateObject(), FrameLoadTypeBackFo rward, NotClientRedirect); |
1425 restoreScrollPositionAndViewState(); | 1440 restoreScrollPositionAndViewState(); |
1426 return; | 1441 return; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1465 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. | 1480 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
1466 Frame* parentFrame = m_frame->tree().parent(); | 1481 Frame* parentFrame = m_frame->tree().parent(); |
1467 if (parentFrame && parentFrame->isLocalFrame()) | 1482 if (parentFrame && parentFrame->isLocalFrame()) |
1468 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1483 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
1469 if (FrameOwner* frameOwner = m_frame->owner()) | 1484 if (FrameOwner* frameOwner = m_frame->owner()) |
1470 flags |= frameOwner->sandboxFlags(); | 1485 flags |= frameOwner->sandboxFlags(); |
1471 return flags; | 1486 return flags; |
1472 } | 1487 } |
1473 | 1488 |
1474 } // namespace blink | 1489 } // namespace blink |
OLD | NEW |