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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 if (!m_stateMachine.committedFirstRealDocumentLoad()) | 238 if (!m_stateMachine.committedFirstRealDocumentLoad()) |
233 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad ); | 239 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad ); |
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::dispose() |
243 { | 249 { |
250 // dispose() is called during (Local)Frame finalization and when creating | |
251 // a new Document within it (DocumentLoader::createWriterFor().) | |
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 |
255 m_frame->view()->clear(); | 262 if (FrameView* view = m_frame->view()) |
dcheng
2014/09/19 06:55:48
Is there any particular significance to pulling th
sof
2014/09/19 11:56:42
There is not, just a linear use of a FrameView I c
| |
263 view->clear(); | |
256 | 264 |
257 m_frame->script().enableEval(); | 265 m_frame->script().enableEval(); |
258 | 266 |
259 m_frame->navigationScheduler().cancel(); | 267 m_frame->navigationScheduler().cancel(); |
260 | 268 |
261 m_checkTimer.stop(); | 269 m_checkTimer.stop(); |
262 | 270 |
263 if (m_stateMachine.isDisplayingInitialEmptyDocument()) | 271 if (m_stateMachine.isDisplayingInitialEmptyDocument()) |
264 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad ); | 272 m_stateMachine.advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad ); |
265 } | 273 } |
(...skipping 11 matching lines...) Expand all Loading... | |
277 RefPtr<DocumentLoader> documentLoader(m_frame->document()->loader()); | 285 RefPtr<DocumentLoader> documentLoader(m_frame->document()->loader()); |
278 | 286 |
279 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL); | 287 UseCounter::count(*m_frame->document(), UseCounter::ReplaceDocumentViaJavaSc riptURL); |
280 | 288 |
281 // Prepare a DocumentInit before clearing the frame, because it may need to | 289 // Prepare a DocumentInit before clearing the frame, because it may need to |
282 // inherit an aliased security context. | 290 // inherit an aliased security context. |
283 DocumentInit init(m_frame->document()->url(), m_frame); | 291 DocumentInit init(m_frame->document()->url(), m_frame); |
284 init.withNewRegistrationContext(); | 292 init.withNewRegistrationContext(); |
285 | 293 |
286 stopAllLoaders(); | 294 stopAllLoaders(); |
287 clear(); | 295 dispose(); |
288 | 296 |
289 // clear() potentially detaches the frame from the document. The | 297 // dispose() potentially detaches the frame from the document. The |
290 // loading cannot continue in that case. | 298 // loading cannot continue in that case. |
291 if (!m_frame->page()) | 299 if (!m_frame->page()) |
292 return; | 300 return; |
293 | 301 |
294 documentLoader->replaceDocumentWhileExecutingJavaScriptURL(init, source, own erDocument); | 302 documentLoader->replaceDocumentWhileExecutingJavaScriptURL(init, source, own erDocument); |
295 } | 303 } |
296 | 304 |
297 void FrameLoader::setHistoryItemStateForCommit(HistoryCommitType historyCommitTy pe, bool isPushOrReplaceState, PassRefPtr<SerializedScriptValue> stateObject) | 305 void FrameLoader::setHistoryItemStateForCommit(HistoryCommitType historyCommitTy pe, bool isPushOrReplaceState, PassRefPtr<SerializedScriptValue> stateObject) |
298 { | 306 { |
299 if (m_provisionalItem) | 307 if (m_provisionalItem) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 } | 399 } |
392 | 400 |
393 void FrameLoader::finishedParsing() | 401 void FrameLoader::finishedParsing() |
394 { | 402 { |
395 if (m_stateMachine.creatingInitialEmptyDocument()) | 403 if (m_stateMachine.creatingInitialEmptyDocument()) |
396 return; | 404 return; |
397 | 405 |
398 // This can be called from the LocalFrame's destructor, in which case we sho uldn't protect ourselves | 406 // 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. | 407 // 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. | 408 // Null-checking the FrameView indicates whether or not we're in the destruc tor. |
401 RefPtr<LocalFrame> protector = m_frame->view() ? m_frame : 0; | 409 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame->view() ? m_frame.get() : nul lptr); |
402 | 410 |
403 if (client()) | 411 if (client()) |
404 client()->dispatchDidFinishDocumentLoad(); | 412 client()->dispatchDidFinishDocumentLoad(); |
405 | 413 |
406 checkCompleted(); | 414 checkCompleted(); |
407 | 415 |
408 if (!m_frame->view()) | 416 if (!m_frame->view()) |
409 return; // We are being destroyed by something checkCompleted called. | 417 return; // We are being destroyed by something checkCompleted called. |
410 | 418 |
411 // Check if the scrollbars are really needed for the content. | 419 // Check if the scrollbars are really needed for the content. |
(...skipping 23 matching lines...) Expand all Loading... | |
435 { | 443 { |
436 for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree().parent ()) { | 444 for (Frame* ancestor = m_frame; ancestor; ancestor = ancestor->tree().parent ()) { |
437 if (ancestor->isLocalFrame() && !toLocalFrame(ancestor)->document()->loa dEventFinished()) | 445 if (ancestor->isLocalFrame() && !toLocalFrame(ancestor)->document()->loa dEventFinished()) |
438 return false; | 446 return false; |
439 } | 447 } |
440 return true; | 448 return true; |
441 } | 449 } |
442 | 450 |
443 void FrameLoader::checkCompleted() | 451 void FrameLoader::checkCompleted() |
444 { | 452 { |
445 RefPtr<LocalFrame> protect(m_frame); | 453 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
446 | 454 |
447 if (m_frame->view()) | 455 if (m_frame->view()) |
448 m_frame->view()->handleLoadCompleted(); | 456 m_frame->view()->handleLoadCompleted(); |
449 | 457 |
450 if (m_frame->document()->isLoadCompleted() && m_stateMachine.committedFirstR ealDocumentLoad()) | 458 if (m_frame->document()->isLoadCompleted() && m_stateMachine.committedFirstR ealDocumentLoad()) |
451 return; | 459 return; |
452 | 460 |
453 // Are we still parsing? | 461 // Are we still parsing? |
454 if (m_frame->document()->parsing()) | 462 if (m_frame->document()->parsing()) |
455 return; | 463 return; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 | 515 |
508 void FrameLoader::setOpener(LocalFrame* opener) | 516 void FrameLoader::setOpener(LocalFrame* opener) |
509 { | 517 { |
510 // If the frame is already detached, the opener has already been cleared. | 518 // If the frame is already detached, the opener has already been cleared. |
511 if (client()) | 519 if (client()) |
512 client()->setOpener(opener); | 520 client()->setOpener(opener); |
513 } | 521 } |
514 | 522 |
515 bool FrameLoader::allowPlugins(ReasonForCallingAllowPlugins reason) | 523 bool FrameLoader::allowPlugins(ReasonForCallingAllowPlugins reason) |
516 { | 524 { |
525 // With Oilpan, a FrameLoader might be accessed after the | |
526 // FrameHost has been detached. FrameClient will not be | |
527 // accessible, so bail early. | |
dcheng
2014/09/19 06:55:48
Out of curiosity, what does the callstack look lik
sof
2014/09/19 09:05:31
The failing stack isn't all that interesting, just
dcheng
2014/09/19 09:09:37
I guess I was just hoping that this would allow us
| |
528 if (!client()) | |
529 return false; | |
517 Settings* settings = m_frame->settings(); | 530 Settings* settings = m_frame->settings(); |
518 bool allowed = client()->allowPlugins(settings && settings->pluginsEnabled() ); | 531 bool allowed = client()->allowPlugins(settings && settings->pluginsEnabled() ); |
519 if (!allowed && reason == AboutToInstantiatePlugin) | 532 if (!allowed && reason == AboutToInstantiatePlugin) |
520 client()->didNotAllowPlugins(); | 533 client()->didNotAllowPlugins(); |
521 return allowed; | 534 return allowed; |
522 } | 535 } |
523 | 536 |
524 void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume ntNavigationSource sameDocumentNavigationSource, PassRefPtr<SerializedScriptValu e> data, FrameLoadType type) | 537 void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume ntNavigationSource sameDocumentNavigationSource, PassRefPtr<SerializedScriptValu e> data, FrameLoadType type) |
525 { | 538 { |
526 // Update the data source's request with the new URL to fake the URL change | 539 // 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 | 590 // 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. | 591 // the user might have scrolled since the previous navigation. |
579 scrollToFragmentWithParentBoundary(url); | 592 scrollToFragmentWithParentBoundary(url); |
580 checkCompleted(); | 593 checkCompleted(); |
581 | 594 |
582 m_frame->domWindow()->statePopped(stateObject ? stateObject : SerializedScri ptValue::nullValue()); | 595 m_frame->domWindow()->statePopped(stateObject ? stateObject : SerializedScri ptValue::nullValue()); |
583 } | 596 } |
584 | 597 |
585 void FrameLoader::completed() | 598 void FrameLoader::completed() |
586 { | 599 { |
587 RefPtr<LocalFrame> protect(m_frame); | 600 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
588 | 601 |
589 for (Frame* descendant = m_frame->tree().traverseNext(m_frame); descendant; descendant = descendant->tree().traverseNext(m_frame)) { | 602 for (Frame* descendant = m_frame->tree().traverseNext(m_frame); descendant; descendant = descendant->tree().traverseNext(m_frame)) { |
590 if (descendant->isLocalFrame()) | 603 if (descendant->isLocalFrame()) |
591 toLocalFrame(descendant)->navigationScheduler().startTimer(); | 604 toLocalFrame(descendant)->navigationScheduler().startTimer(); |
592 } | 605 } |
593 | 606 |
594 Frame* parent = m_frame->tree().parent(); | 607 Frame* parent = m_frame->tree().parent(); |
595 if (parent && parent->isLocalFrame()) | 608 if (parent && parent->isLocalFrame()) |
596 toLocalFrame(parent)->loader().checkCompleted(); | 609 toLocalFrame(parent)->loader().checkCompleted(); |
597 | 610 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 return WebURLRequest::RequestContextInternal; | 714 return WebURLRequest::RequestContextInternal; |
702 } | 715 } |
703 ASSERT_NOT_REACHED(); | 716 ASSERT_NOT_REACHED(); |
704 return WebURLRequest::RequestContextHyperlink; | 717 return WebURLRequest::RequestContextHyperlink; |
705 } | 718 } |
706 | 719 |
707 void FrameLoader::load(const FrameLoadRequest& passedRequest) | 720 void FrameLoader::load(const FrameLoadRequest& passedRequest) |
708 { | 721 { |
709 ASSERT(m_frame->document()); | 722 ASSERT(m_frame->document()); |
710 | 723 |
711 RefPtr<LocalFrame> protect(m_frame); | 724 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
712 | 725 |
713 if (m_inStopAllLoaders) | 726 if (m_inStopAllLoaders) |
714 return; | 727 return; |
715 | 728 |
716 FrameLoadRequest request(passedRequest); | 729 FrameLoadRequest request(passedRequest); |
717 if (!prepareRequestForThisFrame(request)) | 730 if (!prepareRequestForThisFrame(request)) |
718 return; | 731 return; |
719 | 732 |
720 RefPtr<LocalFrame> targetFrame = request.formState() ? 0 : findFrameForNavig ation(AtomicString(request.frameName()), request.formState() ? request.formState ()->sourceDocument() : m_frame->document()); | 733 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) { | 734 if (targetFrame && targetFrame.get() != m_frame) { |
722 request.setFrameName("_self"); | 735 request.setFrameName("_self"); |
723 targetFrame->loader().load(request); | 736 targetFrame->loader().load(request); |
724 if (Page* page = targetFrame->page()) | 737 if (Page* page = targetFrame->page()) |
725 page->chrome().focus(); | 738 page->chrome().focus(); |
726 return; | 739 return; |
727 } | 740 } |
728 | 741 |
729 FrameLoadType newLoadType = determineFrameLoadType(request); | 742 FrameLoadType newLoadType = determineFrameLoadType(request); |
730 NavigationAction action(request.resourceRequest(), newLoadType, request.form State(), request.triggeringEvent()); | 743 NavigationAction action(request.resourceRequest(), newLoadType, request.form State(), request.triggeringEvent()); |
731 if (action.resourceRequest().requestContext() == WebURLRequest::RequestConte xtUnspecified) | 744 if (action.resourceRequest().requestContext() == WebURLRequest::RequestConte xtUnspecified) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 { | 836 { |
824 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) | 837 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) |
825 return; | 838 return; |
826 | 839 |
827 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. | 840 // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. |
828 if (m_inStopAllLoaders) | 841 if (m_inStopAllLoaders) |
829 return; | 842 return; |
830 | 843 |
831 // Calling stopLoading() on the provisional document loader can blow away | 844 // Calling stopLoading() on the provisional document loader can blow away |
832 // the frame from underneath. | 845 // the frame from underneath. |
833 RefPtr<LocalFrame> protect(m_frame); | 846 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
834 | 847 |
835 m_inStopAllLoaders = true; | 848 m_inStopAllLoaders = true; |
836 | 849 |
837 for (RefPtr<Frame> child = m_frame->tree().firstChild(); child; child = chil d->tree().nextSibling()) { | 850 for (RefPtrWillBeRawPtr<Frame> child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { |
838 if (child->isLocalFrame()) | 851 if (child->isLocalFrame()) |
839 toLocalFrame(child.get())->loader().stopAllLoaders(); | 852 toLocalFrame(child.get())->loader().stopAllLoaders(); |
840 } | 853 } |
841 if (m_provisionalDocumentLoader) | 854 if (m_provisionalDocumentLoader) |
842 m_provisionalDocumentLoader->stopLoading(); | 855 m_provisionalDocumentLoader->stopLoading(); |
843 if (m_documentLoader) | 856 if (m_documentLoader) |
844 m_documentLoader->stopLoading(); | 857 m_documentLoader->stopLoading(); |
845 | 858 |
846 if (m_provisionalDocumentLoader) | 859 if (m_provisionalDocumentLoader) |
847 m_provisionalDocumentLoader->detachFromFrame(); | 860 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. | 875 // We only need to notify the client once, and only for the main frame. |
863 if (isLoadingMainFrame() && !m_didAccessInitialDocument) { | 876 if (isLoadingMainFrame() && !m_didAccessInitialDocument) { |
864 m_didAccessInitialDocument = true; | 877 m_didAccessInitialDocument = true; |
865 // Notify asynchronously, since this is called within a JavaScript secur ity check. | 878 // Notify asynchronously, since this is called within a JavaScript secur ity check. |
866 m_didAccessInitialDocumentTimer.startOneShot(0, FROM_HERE); | 879 m_didAccessInitialDocumentTimer.startOneShot(0, FROM_HERE); |
867 } | 880 } |
868 } | 881 } |
869 | 882 |
870 void FrameLoader::didAccessInitialDocumentTimerFired(Timer<FrameLoader>*) | 883 void FrameLoader::didAccessInitialDocumentTimerFired(Timer<FrameLoader>*) |
871 { | 884 { |
872 client()->didAccessInitialDocument(); | 885 if (client()) |
886 client()->didAccessInitialDocument(); | |
873 } | 887 } |
874 | 888 |
875 void FrameLoader::notifyIfInitialDocumentAccessed() | 889 void FrameLoader::notifyIfInitialDocumentAccessed() |
876 { | 890 { |
877 if (m_didAccessInitialDocumentTimer.isActive()) { | 891 if (m_didAccessInitialDocumentTimer.isActive()) { |
878 m_didAccessInitialDocumentTimer.stop(); | 892 m_didAccessInitialDocumentTimer.stop(); |
879 didAccessInitialDocumentTimerFired(0); | 893 didAccessInitialDocumentTimerFired(0); |
880 } | 894 } |
881 } | 895 } |
882 | 896 |
883 void FrameLoader::commitProvisionalLoad() | 897 void FrameLoader::commitProvisionalLoad() |
884 { | 898 { |
885 ASSERT(client()->hasWebView()); | 899 ASSERT(client()->hasWebView()); |
886 ASSERT(m_state == FrameStateProvisional); | 900 ASSERT(m_state == FrameStateProvisional); |
887 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; | 901 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; |
888 RefPtr<LocalFrame> protect(m_frame); | 902 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
889 | 903 |
890 // Check if the destination page is allowed to access the previous page's ti ming information. | 904 // Check if the destination page is allowed to access the previous page's ti ming information. |
891 if (m_frame->document()) { | 905 if (m_frame->document()) { |
892 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->requ est().url()); | 906 RefPtr<SecurityOrigin> securityOrigin = SecurityOrigin::create(pdl->requ est().url()); |
893 pdl->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canReq uest(m_frame->document()->url())); | 907 pdl->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canReq uest(m_frame->document()->url())); |
894 } | 908 } |
895 | 909 |
896 // The call to closeURL() invokes the unload event handler, which can execut e arbitrary | 910 // 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, | 911 // JavaScript. If the script initiates a new load, we need to abandon the cu rrent load, |
898 // or the two will stomp each other. | 912 // or the two will stomp each other. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
953 if (document->processingLoadEvent()) | 967 if (document->processingLoadEvent()) |
954 return false; | 968 return false; |
955 if (document->hasActiveParser()) | 969 if (document->hasActiveParser()) |
956 return false; | 970 return false; |
957 return true; | 971 return true; |
958 } | 972 } |
959 | 973 |
960 bool FrameLoader::checkLoadCompleteForThisFrame() | 974 bool FrameLoader::checkLoadCompleteForThisFrame() |
961 { | 975 { |
962 ASSERT(client()->hasWebView()); | 976 ASSERT(client()->hasWebView()); |
963 RefPtr<LocalFrame> protect(m_frame); | 977 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
964 | 978 |
965 bool allChildrenAreDoneLoading = true; | 979 bool allChildrenAreDoneLoading = true; |
966 for (RefPtr<Frame> child = m_frame->tree().firstChild(); child; child = chil d->tree().nextSibling()) { | 980 for (RefPtrWillBeRawPtr<Frame> child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { |
967 if (child->isLocalFrame()) | 981 if (child->isLocalFrame()) |
968 allChildrenAreDoneLoading &= toLocalFrame(child.get())->loader().che ckLoadCompleteForThisFrame(); | 982 allChildrenAreDoneLoading &= toLocalFrame(child.get())->loader().che ckLoadCompleteForThisFrame(); |
969 } | 983 } |
970 | 984 |
971 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { | 985 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { |
972 const ResourceError& error = m_provisionalDocumentLoader->mainDocumentEr ror(); | 986 const ResourceError& error = m_provisionalDocumentLoader->mainDocumentEr ror(); |
973 if (error.isNull()) | 987 if (error.isNull()) |
974 return false; | 988 return false; |
975 RefPtr<DocumentLoader> loader = m_provisionalDocumentLoader; | 989 RefPtr<DocumentLoader> loader = m_provisionalDocumentLoader; |
976 client()->dispatchDidFailProvisionalLoad(error); | 990 client()->dispatchDidFailProvisionalLoad(error); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1083 | 1097 |
1084 String FrameLoader::userAgent(const KURL& url) const | 1098 String FrameLoader::userAgent(const KURL& url) const |
1085 { | 1099 { |
1086 String userAgent = client()->userAgent(url); | 1100 String userAgent = client()->userAgent(url); |
1087 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); | 1101 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); |
1088 return userAgent; | 1102 return userAgent; |
1089 } | 1103 } |
1090 | 1104 |
1091 void FrameLoader::detachFromParent() | 1105 void FrameLoader::detachFromParent() |
1092 { | 1106 { |
1107 #if !ENABLE(OILPAN) | |
1093 // The caller must protect a reference to m_frame. | 1108 // The caller must protect a reference to m_frame. |
1094 ASSERT(m_frame->refCount() > 1); | 1109 ASSERT(m_frame->refCount() > 1); |
1110 #endif | |
1095 | 1111 |
1096 InspectorInstrumentation::frameDetachedFromParent(m_frame); | 1112 InspectorInstrumentation::frameDetachedFromParent(m_frame); |
1097 | 1113 |
1098 if (m_documentLoader) | 1114 if (m_documentLoader) |
1099 m_documentLoader->detachFromFrame(); | 1115 m_documentLoader->detachFromFrame(); |
1100 m_documentLoader = nullptr; | 1116 m_documentLoader = nullptr; |
1101 | 1117 |
1102 if (!client()) | 1118 if (!client()) |
1103 return; | 1119 return; |
1104 | 1120 |
(...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 | 1154 // After this, we must no longer talk to the client since this clears |
1139 // its owning reference back to our owning LocalFrame. | 1155 // its owning reference back to our owning LocalFrame. |
1140 client()->detachedFromParent(); | 1156 client()->detachedFromParent(); |
1141 m_frame->clearClient(); | 1157 m_frame->clearClient(); |
1142 } | 1158 } |
1143 } | 1159 } |
1144 | 1160 |
1145 void FrameLoader::receivedMainResourceError(const ResourceError& error) | 1161 void FrameLoader::receivedMainResourceError(const ResourceError& error) |
1146 { | 1162 { |
1147 // Retain because the stop may release the last reference to it. | 1163 // Retain because the stop may release the last reference to it. |
1148 RefPtr<LocalFrame> protect(m_frame); | 1164 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
1149 | 1165 |
1150 if (m_frame->document()->parser()) | 1166 if (m_frame->document()->parser()) |
1151 m_frame->document()->parser()->stopParsing(); | 1167 m_frame->document()->parser()->stopParsing(); |
1152 | 1168 |
1153 // FIXME: We really ought to be able to just check for isCancellation() here , but there are some | 1169 // 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(). | 1170 // ResourceErrors that setIsCancellation() but aren't created by ResourceErr or::cancelledError(). |
1155 ResourceError c(ResourceError::cancelledError(KURL())); | 1171 ResourceError c(ResourceError::cancelledError(KURL())); |
1156 if ((error.errorCode() != c.errorCode() || error.domain() != c.domain()) && m_frame->owner()) { | 1172 if ((error.errorCode() != c.errorCode() || error.domain() != c.domain()) && m_frame->owner()) { |
1157 // FIXME: For now, fallback content doesn't work cross process. | 1173 // FIXME: For now, fallback content doesn't work cross process. |
1158 ASSERT(m_frame->owner()->isLocal()); | 1174 ASSERT(m_frame->owner()->isLocal()); |
(...skipping 21 matching lines...) Expand all Loading... | |
1180 && !m_frame->document()->isFrameSet(); | 1196 && !m_frame->document()->isFrameSet(); |
1181 } | 1197 } |
1182 | 1198 |
1183 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) | 1199 void FrameLoader::scrollToFragmentWithParentBoundary(const KURL& url) |
1184 { | 1200 { |
1185 FrameView* view = m_frame->view(); | 1201 FrameView* view = m_frame->view(); |
1186 if (!view) | 1202 if (!view) |
1187 return; | 1203 return; |
1188 | 1204 |
1189 // Leaking scroll position to a cross-origin ancestor would permit the so-ca lled "framesniffing" attack. | 1205 // 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); | 1206 RefPtrWillBeRawPtr<LocalFrame> boundaryFrame = url.hasFragmentIdentifier() ? m_frame->document()->findUnsafeParentScrollPropagationBoundary() : 0; |
1191 | 1207 |
1192 if (boundaryFrame) | 1208 if (boundaryFrame) |
1193 boundaryFrame->view()->setSafeToPropagateScrollToParent(false); | 1209 boundaryFrame->view()->setSafeToPropagateScrollToParent(false); |
1194 | 1210 |
1195 view->scrollToFragment(url); | 1211 view->scrollToFragment(url); |
1196 | 1212 |
1197 if (boundaryFrame) | 1213 if (boundaryFrame) |
1198 boundaryFrame->view()->setSafeToPropagateScrollToParent(true); | 1214 boundaryFrame->view()->setSafeToPropagateScrollToParent(true); |
1199 } | 1215 } |
1200 | 1216 |
1201 bool FrameLoader::shouldClose() | 1217 bool FrameLoader::shouldClose() |
1202 { | 1218 { |
1203 Page* page = m_frame->page(); | 1219 Page* page = m_frame->page(); |
1204 if (!page || !page->chrome().canRunBeforeUnloadConfirmPanel()) | 1220 if (!page || !page->chrome().canRunBeforeUnloadConfirmPanel()) |
1205 return true; | 1221 return true; |
1206 | 1222 |
1207 // Store all references to each subframe in advance since beforeunload's eve nt handler may modify frame | 1223 // Store all references to each subframe in advance since beforeunload's eve nt handler may modify frame |
1208 Vector<RefPtr<LocalFrame> > targetFrames; | 1224 WillBeHeapVector<RefPtrWillBeMember<LocalFrame> > targetFrames; |
1209 targetFrames.append(m_frame); | 1225 targetFrames.append(m_frame); |
1210 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().traverseNext(m_frame)) { | 1226 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. | 1227 // FIXME: There is not yet any way to dispatch events to out-of-process frames. |
1212 if (child->isLocalFrame()) | 1228 if (child->isLocalFrame()) |
1213 targetFrames.append(toLocalFrame(child)); | 1229 targetFrames.append(toLocalFrame(child)); |
1214 } | 1230 } |
1215 | 1231 |
1216 bool shouldClose = false; | 1232 bool shouldClose = false; |
1217 { | 1233 { |
1218 NavigationDisablerForBeforeUnload navigationDisabler; | 1234 NavigationDisablerForBeforeUnload navigationDisabler; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1285 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); | 1301 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); |
1286 else if (m_documentLoader) | 1302 else if (m_documentLoader) |
1287 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding()); | 1303 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding()); |
1288 | 1304 |
1289 | 1305 |
1290 bool isTransitionNavigation = false; | 1306 bool isTransitionNavigation = false; |
1291 if (RuntimeEnabledFeatures::navigationTransitionsEnabled() && type != FrameL oadTypeReload && type != FrameLoadTypeReloadFromOrigin && type != FrameLoadTypeS ame) | 1307 if (RuntimeEnabledFeatures::navigationTransitionsEnabled() && type != FrameL oadTypeReload && type != FrameLoadTypeReloadFromOrigin && type != FrameLoadTypeS ame) |
1292 isTransitionNavigation = dispatchNavigationTransitionData(); | 1308 isTransitionNavigation = dispatchNavigationTransitionData(); |
1293 | 1309 |
1294 // stopAllLoaders can detach the LocalFrame, so protect it. | 1310 // stopAllLoaders can detach the LocalFrame, so protect it. |
1295 RefPtr<LocalFrame> protect(m_frame); | 1311 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
1296 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, sho uldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose( )) && m_policyDocumentLoader) { | 1312 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, sho uldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose( )) && m_policyDocumentLoader) { |
1297 m_policyDocumentLoader->detachFromFrame(); | 1313 m_policyDocumentLoader->detachFromFrame(); |
1298 m_policyDocumentLoader = nullptr; | 1314 m_policyDocumentLoader = nullptr; |
1299 checkCompleted(); | 1315 checkCompleted(); |
1300 return; | 1316 return; |
1301 } | 1317 } |
1302 | 1318 |
1303 if (m_provisionalDocumentLoader) { | 1319 if (m_provisionalDocumentLoader) { |
1304 m_provisionalDocumentLoader->stopLoading(); | 1320 m_provisionalDocumentLoader->stopLoading(); |
1305 if (m_provisionalDocumentLoader) | 1321 if (m_provisionalDocumentLoader) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1406 { | 1422 { |
1407 ASSERT(activeDocument); | 1423 ASSERT(activeDocument); |
1408 Frame* frame = m_frame->tree().find(name); | 1424 Frame* frame = m_frame->tree().find(name); |
1409 if (!frame || !frame->isLocalFrame() || !activeDocument->canNavigate(toLocal Frame(*frame))) | 1425 if (!frame || !frame->isLocalFrame() || !activeDocument->canNavigate(toLocal Frame(*frame))) |
1410 return 0; | 1426 return 0; |
1411 return toLocalFrame(frame); | 1427 return toLocalFrame(frame); |
1412 } | 1428 } |
1413 | 1429 |
1414 void FrameLoader::loadHistoryItem(HistoryItem* item, HistoryLoadType historyLoad Type, ResourceRequestCachePolicy cachePolicy) | 1430 void FrameLoader::loadHistoryItem(HistoryItem* item, HistoryLoadType historyLoad Type, ResourceRequestCachePolicy cachePolicy) |
1415 { | 1431 { |
1416 RefPtr<LocalFrame> protect(m_frame); | 1432 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); |
1417 if (m_frame->page()->defersLoading()) { | 1433 if (m_frame->page()->defersLoading()) { |
1418 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache Policy); | 1434 m_deferredHistoryLoad = DeferredHistoryLoad(item, historyLoadType, cache Policy); |
1419 return; | 1435 return; |
1420 } | 1436 } |
1421 | 1437 |
1422 m_provisionalItem = item; | 1438 m_provisionalItem = item; |
1423 if (historyLoadType == HistorySameDocumentLoad) { | 1439 if (historyLoadType == HistorySameDocumentLoad) { |
1424 loadInSameDocument(item->url(), item->stateObject(), FrameLoadTypeBackFo rward, NotClientRedirect); | 1440 loadInSameDocument(item->url(), item->stateObject(), FrameLoadTypeBackFo rward, NotClientRedirect); |
1425 restoreScrollPositionAndViewState(); | 1441 restoreScrollPositionAndViewState(); |
1426 return; | 1442 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. | 1481 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. |
1466 Frame* parentFrame = m_frame->tree().parent(); | 1482 Frame* parentFrame = m_frame->tree().parent(); |
1467 if (parentFrame && parentFrame->isLocalFrame()) | 1483 if (parentFrame && parentFrame->isLocalFrame()) |
1468 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); | 1484 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); |
1469 if (FrameOwner* frameOwner = m_frame->owner()) | 1485 if (FrameOwner* frameOwner = m_frame->owner()) |
1470 flags |= frameOwner->sandboxFlags(); | 1486 flags |= frameOwner->sandboxFlags(); |
1471 return flags; | 1487 return flags; |
1472 } | 1488 } |
1473 | 1489 |
1474 } // namespace blink | 1490 } // namespace blink |
OLD | NEW |