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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 if (m_networkingContext) | 209 if (m_networkingContext) |
210 m_networkingContext->invalidate(); | 210 m_networkingContext->invalidate(); |
211 } | 211 } |
212 | 212 |
213 void FrameLoader::init() | 213 void FrameLoader::init() |
214 { | 214 { |
215 // This somewhat odd set of steps gives the frame an initial empty document. | 215 // This somewhat odd set of steps gives the frame an initial empty document. |
216 // It would be better if this could be done with even fewer steps. | 216 // It would be better if this could be done with even fewer steps. |
217 m_stateMachine.advanceTo(FrameLoaderStateMachine::CreatingInitialEmptyDocume
nt); | 217 m_stateMachine.advanceTo(FrameLoaderStateMachine::CreatingInitialEmptyDocume
nt); |
218 setPolicyDocumentLoader(m_client->createDocumentLoader(ResourceRequest(KURL(
ParsedURLString, emptyString())), SubstituteData()).get()); | 218 setPolicyDocumentLoader(m_client->createDocumentLoader(ResourceRequest(KURL(
ParsedURLString, emptyString())), SubstituteData()).get()); |
219 // FIXME: Make this an ASSERT() instead once we figured out what's going wro
ng. | |
220 if (!m_policyDocumentLoader.get()) | |
221 CRASH(); | |
222 setProvisionalDocumentLoader(m_policyDocumentLoader.get()); | 219 setProvisionalDocumentLoader(m_policyDocumentLoader.get()); |
223 setState(FrameStateProvisional); | 220 setState(FrameStateProvisional); |
224 m_provisionalDocumentLoader->setResponse(ResourceResponse(KURL(), "text/html
", 0, String(), String())); | 221 m_provisionalDocumentLoader->setResponse(ResourceResponse(KURL(), "text/html
", 0, String(), String())); |
225 m_provisionalDocumentLoader->finishedLoading(); | 222 m_provisionalDocumentLoader->finishedLoading(); |
226 ASSERT(!m_frame->document()); | 223 ASSERT(!m_frame->document()); |
227 m_documentLoader->writer()->begin(KURL(), false); | 224 m_documentLoader->writer()->begin(KURL(), false); |
228 m_documentLoader->writer()->end(); | 225 m_documentLoader->writer()->end(); |
229 m_frame->document()->cancelParsing(); | 226 m_frame->document()->cancelParsing(); |
230 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu
ment); | 227 m_stateMachine.advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocu
ment); |
231 m_didCallImplicitClose = true; | 228 m_didCallImplicitClose = true; |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 | 1085 |
1089 // Notify accessibility. | 1086 // Notify accessibility. |
1090 if (AXObjectCache::accessibilityEnabled()) { | 1087 if (AXObjectCache::accessibilityEnabled()) { |
1091 AXObjectCache::AXLoadingEvent loadingEvent = loadType() == FrameLoadType
Reload ? AXObjectCache::AXLoadingReloaded : AXObjectCache::AXLoadingStarted; | 1088 AXObjectCache::AXLoadingEvent loadingEvent = loadType() == FrameLoadType
Reload ? AXObjectCache::AXLoadingReloaded : AXObjectCache::AXLoadingStarted; |
1092 m_frame->document()->axObjectCache()->frameLoadingEventNotification(m_fr
ame, loadingEvent); | 1089 m_frame->document()->axObjectCache()->frameLoadingEventNotification(m_fr
ame, loadingEvent); |
1093 } | 1090 } |
1094 } | 1091 } |
1095 | 1092 |
1096 void FrameLoader::setupForReplace() | 1093 void FrameLoader::setupForReplace() |
1097 { | 1094 { |
1098 // FIXME: Make this an ASSERT() instead once we figured out what's going wro
ng. | |
1099 if (!m_documentLoader.get()) | |
1100 CRASH(); | |
1101 setState(FrameStateProvisional); | 1095 setState(FrameStateProvisional); |
1102 m_provisionalDocumentLoader = m_documentLoader; | 1096 m_provisionalDocumentLoader = m_documentLoader; |
1103 m_documentLoader = 0; | 1097 m_documentLoader = 0; |
1104 detachChildren(); | 1098 detachChildren(); |
1105 } | 1099 } |
1106 | 1100 |
1107 void FrameLoader::loadFrameRequest(const FrameLoadRequest& request, bool lockHis
tory, bool lockBackForwardList, | 1101 void FrameLoader::loadFrameRequest(const FrameLoadRequest& request, bool lockHis
tory, bool lockBackForwardList, |
1108 PassRefPtr<Event> event, PassRefPtr<FormState> formState, ShouldSendReferrer
shouldSendReferrer) | 1102 PassRefPtr<Event> event, PassRefPtr<FormState> formState, ShouldSendReferrer
shouldSendReferrer) |
1109 { | 1103 { |
1110 // Protect frame from getting blown away inside dispatchBeforeLoadEvent in l
oadWithDocumentLoader. | 1104 // Protect frame from getting blown away inside dispatchBeforeLoadEvent in l
oadWithDocumentLoader. |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 history()->setProvisionalItem(0); | 1493 history()->setProvisionalItem(0); |
1500 | 1494 |
1501 for (RefPtr<Frame> child = m_frame->tree()->firstChild(); child; child = chi
ld->tree()->nextSibling()) | 1495 for (RefPtr<Frame> child = m_frame->tree()->firstChild(); child; child = chi
ld->tree()->nextSibling()) |
1502 child->loader()->stopAllLoaders(clearProvisionalItemPolicy); | 1496 child->loader()->stopAllLoaders(clearProvisionalItemPolicy); |
1503 if (m_provisionalDocumentLoader) | 1497 if (m_provisionalDocumentLoader) |
1504 m_provisionalDocumentLoader->stopLoading(); | 1498 m_provisionalDocumentLoader->stopLoading(); |
1505 if (m_documentLoader) | 1499 if (m_documentLoader) |
1506 m_documentLoader->stopLoading(); | 1500 m_documentLoader->stopLoading(); |
1507 | 1501 |
1508 setProvisionalDocumentLoader(0); | 1502 setProvisionalDocumentLoader(0); |
1509 if (m_state == FrameStateProvisional) | |
1510 setState(FrameStateComplete); | |
1511 | 1503 |
1512 m_checkTimer.stop(); | 1504 m_checkTimer.stop(); |
1513 | 1505 |
1514 m_inStopAllLoaders = false; | 1506 m_inStopAllLoaders = false; |
1515 } | 1507 } |
1516 | 1508 |
1517 void FrameLoader::stopForUserCancel(bool deferCheckLoadComplete) | 1509 void FrameLoader::stopForUserCancel(bool deferCheckLoadComplete) |
1518 { | 1510 { |
1519 stopAllLoaders(); | 1511 stopAllLoaders(); |
1520 | 1512 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1615 else if (newState == FrameStateComplete) { | 1607 else if (newState == FrameStateComplete) { |
1616 frameLoadCompleted(); | 1608 frameLoadCompleted(); |
1617 storedTimeOfLastCompletedLoad = currentTime(); | 1609 storedTimeOfLastCompletedLoad = currentTime(); |
1618 if (m_documentLoader) | 1610 if (m_documentLoader) |
1619 m_documentLoader->stopRecordingResponses(); | 1611 m_documentLoader->stopRecordingResponses(); |
1620 } | 1612 } |
1621 } | 1613 } |
1622 | 1614 |
1623 void FrameLoader::clearProvisionalLoad() | 1615 void FrameLoader::clearProvisionalLoad() |
1624 { | 1616 { |
| 1617 setProvisionalDocumentLoader(0); |
1625 if (Page* page = m_frame->page()) | 1618 if (Page* page = m_frame->page()) |
1626 page->progress()->progressCompleted(m_frame); | 1619 page->progress()->progressCompleted(m_frame); |
1627 setProvisionalDocumentLoader(0); | |
1628 setState(FrameStateComplete); | 1620 setState(FrameStateComplete); |
1629 } | 1621 } |
1630 | 1622 |
1631 void FrameLoader::commitProvisionalLoad() | 1623 void FrameLoader::commitProvisionalLoad() |
1632 { | 1624 { |
1633 RefPtr<CachedPage> cachedPage = m_loadingFromCachedPage ? pageCache()->get(h
istory()->provisionalItem()) : 0; | 1625 RefPtr<CachedPage> cachedPage = m_loadingFromCachedPage ? pageCache()->get(h
istory()->provisionalItem()) : 0; |
1634 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; | 1626 RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; |
1635 | 1627 |
1636 LOG(PageCache, "WebCoreLoading %s: About to commit provisional load from pre
vious URL '%s' to new URL '%s'", m_frame->tree()->uniqueName().string().utf8().d
ata(), | 1628 LOG(PageCache, "WebCoreLoading %s: About to commit provisional load from pre
vious URL '%s' to new URL '%s'", m_frame->tree()->uniqueName().string().utf8().d
ata(), |
1637 m_frame->document() ? m_frame->document()->url().string().utf8().data()
: "", | 1629 m_frame->document() ? m_frame->document()->url().string().utf8().data()
: "", |
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2571 { | 2563 { |
2572 m_quickRedirectComing = false; | 2564 m_quickRedirectComing = false; |
2573 | 2565 |
2574 if (!shouldContinue) | 2566 if (!shouldContinue) |
2575 return; | 2567 return; |
2576 | 2568 |
2577 // If we have a provisional request for a different document, a fragment scr
oll should cancel it. | 2569 // If we have a provisional request for a different document, a fragment scr
oll should cancel it. |
2578 if (m_provisionalDocumentLoader && !equalIgnoringFragmentIdentifier(m_provis
ionalDocumentLoader->request().url(), request.url())) { | 2570 if (m_provisionalDocumentLoader && !equalIgnoringFragmentIdentifier(m_provis
ionalDocumentLoader->request().url(), request.url())) { |
2579 m_provisionalDocumentLoader->stopLoading(); | 2571 m_provisionalDocumentLoader->stopLoading(); |
2580 setProvisionalDocumentLoader(0); | 2572 setProvisionalDocumentLoader(0); |
2581 // FIXME: Make this an ASSERT() instead once we figured out what's going
wrong. | |
2582 if (m_state == FrameStateProvisional) | |
2583 CRASH(); | |
2584 } | 2573 } |
2585 | 2574 |
2586 bool isRedirect = m_quickRedirectComing || policyChecker()->loadType() == Fr
ameLoadTypeRedirectWithLockedBackForwardList; | 2575 bool isRedirect = m_quickRedirectComing || policyChecker()->loadType() == Fr
ameLoadTypeRedirectWithLockedBackForwardList; |
2587 loadInSameDocument(request.url(), 0, !isRedirect); | 2576 loadInSameDocument(request.url(), 0, !isRedirect); |
2588 } | 2577 } |
2589 | 2578 |
2590 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S
tring& httpMethod, FrameLoadType loadType, const KURL& url) | 2579 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S
tring& httpMethod, FrameLoadType loadType, const KURL& url) |
2591 { | 2580 { |
2592 // We don't do this if we are submitting a form with method other than "GET"
, explicitly reloading, | 2581 // We don't do this if we are submitting a form with method other than "GET"
, explicitly reloading, |
2593 // currently displaying a frameset, or if the URL does not have a fragment. | 2582 // currently displaying a frameset, or if the URL does not have a fragment. |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2736 if (!m_frame->page()) | 2725 if (!m_frame->page()) |
2737 return; | 2726 return; |
2738 | 2727 |
2739 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) | 2728 #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) |
2740 if (Page* page = m_frame->page()) { | 2729 if (Page* page = m_frame->page()) { |
2741 if (page->mainFrame() == m_frame) | 2730 if (page->mainFrame() == m_frame) |
2742 m_frame->page()->inspectorController()->resume(); | 2731 m_frame->page()->inspectorController()->resume(); |
2743 } | 2732 } |
2744 #endif | 2733 #endif |
2745 | 2734 |
2746 // FIXME: Make this an ASSERT() instead once we figured out what's going wro
ng. | |
2747 if (!m_policyDocumentLoader.get()) | |
2748 CRASH(); | |
2749 setProvisionalDocumentLoader(m_policyDocumentLoader.get()); | 2735 setProvisionalDocumentLoader(m_policyDocumentLoader.get()); |
2750 m_loadType = type; | 2736 m_loadType = type; |
2751 setState(FrameStateProvisional); | 2737 setState(FrameStateProvisional); |
2752 | 2738 |
2753 setPolicyDocumentLoader(0); | 2739 setPolicyDocumentLoader(0); |
2754 | 2740 |
2755 if (isBackForwardLoadType(type) && history()->provisionalItem()->isInPageCac
he()) { | 2741 if (isBackForwardLoadType(type) && history()->provisionalItem()->isInPageCac
he()) { |
2756 loadProvisionalItemFromCachedPage(); | 2742 loadProvisionalItemFromCachedPage(); |
2757 return; | 2743 return; |
2758 } | 2744 } |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3244 windowRect.setHeight(features.height + (windowRect.height() - pageSize.h
eight())); | 3230 windowRect.setHeight(features.height + (windowRect.height() - pageSize.h
eight())); |
3245 page->chrome()->setWindowRect(windowRect); | 3231 page->chrome()->setWindowRect(windowRect); |
3246 | 3232 |
3247 page->chrome()->show(); | 3233 page->chrome()->show(); |
3248 | 3234 |
3249 created = true; | 3235 created = true; |
3250 return frame; | 3236 return frame; |
3251 } | 3237 } |
3252 | 3238 |
3253 } // namespace WebCore | 3239 } // namespace WebCore |
OLD | NEW |