| 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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 if (Frame* parent = m_frame->tree()->parent()) | 1118 if (Frame* parent = m_frame->tree()->parent()) |
| 1119 loader->setOverrideEncoding(parent->loader()->documentLoader()->override
Encoding()); | 1119 loader->setOverrideEncoding(parent->loader()->documentLoader()->override
Encoding()); |
| 1120 else if (!overrideEncoding.isEmpty()) | 1120 else if (!overrideEncoding.isEmpty()) |
| 1121 loader->setOverrideEncoding(overrideEncoding); | 1121 loader->setOverrideEncoding(overrideEncoding); |
| 1122 else if (m_documentLoader) | 1122 else if (m_documentLoader) |
| 1123 loader->setOverrideEncoding(m_documentLoader->overrideEncoding()); | 1123 loader->setOverrideEncoding(m_documentLoader->overrideEncoding()); |
| 1124 | 1124 |
| 1125 if (type == FrameLoadTypeRedirectWithLockedBackForwardList) | 1125 if (type == FrameLoadTypeRedirectWithLockedBackForwardList) |
| 1126 loader->setIsClientRedirect(true); | 1126 loader->setIsClientRedirect(true); |
| 1127 | 1127 |
| 1128 m_loadType = type; | |
| 1129 bool isFormSubmission = formState; | 1128 bool isFormSubmission = formState; |
| 1130 | 1129 |
| 1131 if (shouldPerformFragmentNavigation(isFormSubmission, request.httpMethod(),
type, request.url())) | 1130 if (shouldPerformFragmentNavigation(isFormSubmission, request.httpMethod(),
type, request.url())) |
| 1132 checkNavigationPolicyAndContinueFragmentScroll(action); | 1131 checkNavigationPolicyAndContinueFragmentScroll(action, type != FrameLoad
TypeRedirectWithLockedBackForwardList); |
| 1133 else { | 1132 else { |
| 1134 setPolicyDocumentLoader(loader.get()); | 1133 setPolicyDocumentLoader(loader.get()); |
| 1135 checkNavigationPolicyAndContinueLoad(formState); | 1134 checkNavigationPolicyAndContinueLoad(formState, type); |
| 1136 } | 1135 } |
| 1137 } | 1136 } |
| 1138 | 1137 |
| 1139 void FrameLoader::reportLocalLoadFailed(Frame* frame, const String& url) | 1138 void FrameLoader::reportLocalLoadFailed(Frame* frame, const String& url) |
| 1140 { | 1139 { |
| 1141 ASSERT(!url.isEmpty()); | 1140 ASSERT(!url.isEmpty()); |
| 1142 if (!frame) | 1141 if (!frame) |
| 1143 return; | 1142 return; |
| 1144 | 1143 |
| 1145 frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLeve
l, "Not allowed to load local resource: " + url); | 1144 frame->document()->addConsoleMessage(SecurityMessageSource, ErrorMessageLeve
l, "Not allowed to load local resource: " + url); |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1920 // status has changed, if there was a redirect. | 1919 // status has changed, if there was a redirect. |
| 1921 if (loader->isClientRedirect()) | 1920 if (loader->isClientRedirect()) |
| 1922 clientRedirectCancelledOrFinished(); | 1921 clientRedirectCancelledOrFinished(); |
| 1923 } | 1922 } |
| 1924 | 1923 |
| 1925 checkCompleted(); | 1924 checkCompleted(); |
| 1926 if (m_frame->page()) | 1925 if (m_frame->page()) |
| 1927 checkLoadComplete(); | 1926 checkLoadComplete(); |
| 1928 } | 1927 } |
| 1929 | 1928 |
| 1930 void FrameLoader::checkNavigationPolicyAndContinueFragmentScroll(const Navigatio
nAction& action) | 1929 void FrameLoader::checkNavigationPolicyAndContinueFragmentScroll(const Navigatio
nAction& action, bool isNewNavigation) |
| 1931 { | 1930 { |
| 1932 m_documentLoader->setTriggeringAction(action); | 1931 m_documentLoader->setTriggeringAction(action); |
| 1933 | 1932 |
| 1934 const ResourceRequest& request = action.resourceRequest(); | 1933 const ResourceRequest& request = action.resourceRequest(); |
| 1935 if (!m_documentLoader->shouldContinueForNavigationPolicy(request)) | 1934 if (!m_documentLoader->shouldContinueForNavigationPolicy(request)) |
| 1936 return; | 1935 return; |
| 1937 | 1936 |
| 1938 // If we have a provisional request for a different document, a fragment scr
oll should cancel it. | 1937 // If we have a provisional request for a different document, a fragment scr
oll should cancel it. |
| 1939 if (m_provisionalDocumentLoader && !equalIgnoringFragmentIdentifier(m_provis
ionalDocumentLoader->request().url(), request.url())) { | 1938 if (m_provisionalDocumentLoader && !equalIgnoringFragmentIdentifier(m_provis
ionalDocumentLoader->request().url(), request.url())) { |
| 1940 m_provisionalDocumentLoader->stopLoading(); | 1939 m_provisionalDocumentLoader->stopLoading(); |
| 1941 setProvisionalDocumentLoader(0); | 1940 setProvisionalDocumentLoader(0); |
| 1942 } | 1941 } |
| 1943 loadInSameDocument(request.url(), 0, m_loadType != FrameLoadTypeRedirectWith
LockedBackForwardList); | 1942 loadInSameDocument(request.url(), 0, isNewNavigation); |
| 1944 } | 1943 } |
| 1945 | 1944 |
| 1946 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S
tring& httpMethod, FrameLoadType loadType, const KURL& url) | 1945 bool FrameLoader::shouldPerformFragmentNavigation(bool isFormSubmission, const S
tring& httpMethod, FrameLoadType loadType, const KURL& url) |
| 1947 { | 1946 { |
| 1948 // We don't do this if we are submitting a form with method other than "GET"
, explicitly reloading, | 1947 // We don't do this if we are submitting a form with method other than "GET"
, explicitly reloading, |
| 1949 // currently displaying a frameset, or if the URL does not have a fragment. | 1948 // currently displaying a frameset, or if the URL does not have a fragment. |
| 1950 // These rules were originally based on what KHTML was doing in KHTMLPart::o
penURL. | 1949 // These rules were originally based on what KHTML was doing in KHTMLPart::o
penURL. |
| 1951 | 1950 |
| 1952 // FIXME: What about load types other than Standard and Reload? | 1951 // FIXME: What about load types other than Standard and Reload? |
| 1953 | 1952 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2030 | 2029 |
| 2031 if (!beforeUnloadEvent->defaultPrevented()) | 2030 if (!beforeUnloadEvent->defaultPrevented()) |
| 2032 document->defaultEventHandler(beforeUnloadEvent.get()); | 2031 document->defaultEventHandler(beforeUnloadEvent.get()); |
| 2033 if (beforeUnloadEvent->result().isNull()) | 2032 if (beforeUnloadEvent->result().isNull()) |
| 2034 return true; | 2033 return true; |
| 2035 | 2034 |
| 2036 String text = document->displayStringModifiedByEncoding(beforeUnloadEvent->r
esult()); | 2035 String text = document->displayStringModifiedByEncoding(beforeUnloadEvent->r
esult()); |
| 2037 return chrome.runBeforeUnloadConfirmPanel(text, m_frame); | 2036 return chrome.runBeforeUnloadConfirmPanel(text, m_frame); |
| 2038 } | 2037 } |
| 2039 | 2038 |
| 2040 void FrameLoader::checkNavigationPolicyAndContinueLoad(PassRefPtr<FormState> for
mState) | 2039 void FrameLoader::checkNavigationPolicyAndContinueLoad(PassRefPtr<FormState> for
mState, FrameLoadType type) |
| 2041 { | 2040 { |
| 2042 // If we loaded an alternate page to replace an unreachableURL, we'll get in
here with a | 2041 // If we loaded an alternate page to replace an unreachableURL, we'll get in
here with a |
| 2043 // nil policyDataSource because loading the alternate page will have passed | 2042 // nil policyDataSource because loading the alternate page will have passed |
| 2044 // through this method already, nested; otherwise, policyDataSource should s
till be set. | 2043 // through this method already, nested; otherwise, policyDataSource should s
till be set. |
| 2045 ASSERT(m_policyDocumentLoader || !m_provisionalDocumentLoader->unreachableUR
L().isEmpty()); | 2044 ASSERT(m_policyDocumentLoader || !m_provisionalDocumentLoader->unreachableUR
L().isEmpty()); |
| 2046 | 2045 |
| 2047 // stopAllLoaders can detach the Frame, so protect it. | 2046 // stopAllLoaders can detach the Frame, so protect it. |
| 2048 RefPtr<Frame> protect(m_frame); | 2047 RefPtr<Frame> protect(m_frame); |
| 2049 | 2048 |
| 2050 bool isTargetItem = history()->provisionalItem() ? history()->provisionalIte
m()->isTargetItem() : false; | 2049 bool isTargetItem = history()->provisionalItem() ? history()->provisionalIte
m()->isTargetItem() : false; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 // might detach the current FrameLoader, in which case we should bail on thi
s newly defunct load. | 2093 // might detach the current FrameLoader, in which case we should bail on thi
s newly defunct load. |
| 2095 if (!m_frame->page()) | 2094 if (!m_frame->page()) |
| 2096 return; | 2095 return; |
| 2097 | 2096 |
| 2098 if (Page* page = m_frame->page()) { | 2097 if (Page* page = m_frame->page()) { |
| 2099 if (page->mainFrame() == m_frame) | 2098 if (page->mainFrame() == m_frame) |
| 2100 m_frame->page()->inspectorController()->resume(); | 2099 m_frame->page()->inspectorController()->resume(); |
| 2101 } | 2100 } |
| 2102 | 2101 |
| 2103 setProvisionalDocumentLoader(m_policyDocumentLoader.get()); | 2102 setProvisionalDocumentLoader(m_policyDocumentLoader.get()); |
| 2103 m_loadType = type; |
| 2104 setState(FrameStateProvisional); | 2104 setState(FrameStateProvisional); |
| 2105 | 2105 |
| 2106 setPolicyDocumentLoader(0); | 2106 setPolicyDocumentLoader(0); |
| 2107 | 2107 |
| 2108 if (formState) | 2108 if (formState) |
| 2109 m_client->dispatchWillSubmitForm(formState); | 2109 m_client->dispatchWillSubmitForm(formState); |
| 2110 | 2110 |
| 2111 prepareForLoadStart(); | 2111 prepareForLoadStart(); |
| 2112 | 2112 |
| 2113 // The load might be cancelled inside of prepareForLoadStart(), nulling out
the m_provisionalDocumentLoader, | 2113 // The load might be cancelled inside of prepareForLoadStart(), nulling out
the m_provisionalDocumentLoader, |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2539 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect); | 2539 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect); |
| 2540 | 2540 |
| 2541 page->chrome().setWindowRect(newWindowRect); | 2541 page->chrome().setWindowRect(newWindowRect); |
| 2542 page->chrome().show(); | 2542 page->chrome().show(); |
| 2543 | 2543 |
| 2544 created = true; | 2544 created = true; |
| 2545 return frame; | 2545 return frame; |
| 2546 } | 2546 } |
| 2547 | 2547 |
| 2548 } // namespace WebCore | 2548 } // namespace WebCore |
| OLD | NEW |