OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
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 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 4 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 static double storedTimeOfLastCompletedLoad; | 197 static double storedTimeOfLastCompletedLoad; |
198 static FrameLoader::LocalLoadPolicy localLoadPolicy = FrameLoader::AllowLocalLoa
dsForLocalOnly; | 198 static FrameLoader::LocalLoadPolicy localLoadPolicy = FrameLoader::AllowLocalLoa
dsForLocalOnly; |
199 | 199 |
200 bool isBackForwardLoadType(FrameLoadType type) | 200 bool isBackForwardLoadType(FrameLoadType type) |
201 { | 201 { |
202 switch (type) { | 202 switch (type) { |
203 case FrameLoadTypeStandard: | 203 case FrameLoadTypeStandard: |
204 case FrameLoadTypeReload: | 204 case FrameLoadTypeReload: |
205 case FrameLoadTypeReloadFromOrigin: | 205 case FrameLoadTypeReloadFromOrigin: |
206 case FrameLoadTypeSame: | 206 case FrameLoadTypeSame: |
207 case FrameLoadTypeRedirect: | 207 case FrameLoadTypeRedirectWithLockedBackForwardList: |
208 case FrameLoadTypeReplace: | 208 case FrameLoadTypeReplace: |
209 return false; | 209 return false; |
210 case FrameLoadTypeBack: | 210 case FrameLoadTypeBack: |
211 case FrameLoadTypeForward: | 211 case FrameLoadTypeForward: |
212 case FrameLoadTypeIndexedBackForward: | 212 case FrameLoadTypeIndexedBackForward: |
213 return true; | 213 return true; |
214 } | 214 } |
215 ASSERT_NOT_REACHED(); | 215 ASSERT_NOT_REACHED(); |
216 return false; | 216 return false; |
217 } | 217 } |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1219 | 1219 |
1220 switch (loadType()) { | 1220 switch (loadType()) { |
1221 case FrameLoadTypeReload: | 1221 case FrameLoadTypeReload: |
1222 case FrameLoadTypeReloadFromOrigin: | 1222 case FrameLoadTypeReloadFromOrigin: |
1223 case FrameLoadTypeSame: | 1223 case FrameLoadTypeSame: |
1224 case FrameLoadTypeReplace: | 1224 case FrameLoadTypeReplace: |
1225 break; | 1225 break; |
1226 case FrameLoadTypeBack: | 1226 case FrameLoadTypeBack: |
1227 case FrameLoadTypeForward: | 1227 case FrameLoadTypeForward: |
1228 case FrameLoadTypeIndexedBackForward: | 1228 case FrameLoadTypeIndexedBackForward: |
1229 case FrameLoadTypeRedirect: | 1229 case FrameLoadTypeRedirectWithLockedBackForwardList: |
1230 case FrameLoadTypeStandard: | 1230 case FrameLoadTypeStandard: |
1231 itemToRestore = m_currentHistoryItem.get(); | 1231 itemToRestore = m_currentHistoryItem.get(); |
1232 } | 1232 } |
1233 | 1233 |
1234 if (!itemToRestore) | 1234 if (!itemToRestore) |
1235 return; | 1235 return; |
1236 | 1236 |
1237 LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame->tre
e()->name().string().utf8().data(), itemToRestore); | 1237 LOG(Loading, "WebCoreLoading %s: restoring form state from %p", m_frame->tre
e()->name().string().utf8().data(), itemToRestore); |
1238 doc->setStateForNewFormElements(itemToRestore->documentState()); | 1238 doc->setStateForNewFormElements(itemToRestore->documentState()); |
1239 } | 1239 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 void FrameLoader::scheduleHTTPRedirection(double delay, const String& url) | 1388 void FrameLoader::scheduleHTTPRedirection(double delay, const String& url) |
1389 { | 1389 { |
1390 if (delay < 0 || delay > INT_MAX / 1000) | 1390 if (delay < 0 || delay > INT_MAX / 1000) |
1391 return; | 1391 return; |
1392 | 1392 |
1393 if (!m_frame->page()) | 1393 if (!m_frame->page()) |
1394 return; | 1394 return; |
1395 | 1395 |
1396 // We want a new history item if the refresh timeout is > 1 second. | 1396 // We want a new history item if the refresh timeout is > 1 second. |
1397 if (!m_scheduledRedirection || delay <= m_scheduledRedirection->delay) | 1397 if (!m_scheduledRedirection || delay <= m_scheduledRedirection->delay) |
1398 scheduleRedirection(new ScheduledRedirection(delay, url, delay <= 1, del
ay <= 1, false, false)); | 1398 scheduleRedirection(new ScheduledRedirection(delay, url, true, delay <=
1, false, false)); |
1399 } | 1399 } |
1400 | 1400 |
1401 void FrameLoader::scheduleLocationChange(const String& url, const String& referr
er, bool lockHistory, bool lockBackForwardList, bool wasUserGesture) | 1401 void FrameLoader::scheduleLocationChange(const String& url, const String& referr
er, bool lockHistory, bool lockBackForwardList, bool wasUserGesture) |
1402 { | 1402 { |
1403 if (!m_frame->page()) | 1403 if (!m_frame->page()) |
1404 return; | 1404 return; |
1405 | 1405 |
1406 // If the URL we're going to navigate to is the same as the current one, exc
ept for the | 1406 // If the URL we're going to navigate to is the same as the current one, exc
ept for the |
1407 // fragment part, we don't need to schedule the location change. | 1407 // fragment part, we don't need to schedule the location change. |
1408 KURL parsedURL(url); | 1408 KURL parsedURL(url); |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 In the case of saving state about a page with frames, we store a tree of ite
ms that mirrors the frame tree. | 1551 In the case of saving state about a page with frames, we store a tree of ite
ms that mirrors the frame tree. |
1552 The item that was the target of the user's navigation is designated as the "
targetItem". | 1552 The item that was the target of the user's navigation is designated as the "
targetItem". |
1553 When this method is called with doClip=YES we're able to create the whole tr
ee except for the target's children, | 1553 When this method is called with doClip=YES we're able to create the whole tr
ee except for the target's children, |
1554 which will be loaded in the future. That part of the tree will be filled ou
t as the child loads are committed. | 1554 which will be loaded in the future. That part of the tree will be filled ou
t as the child loads are committed. |
1555 */ | 1555 */ |
1556 void FrameLoader::loadURLIntoChildFrame(const KURL& url, const String& referer,
Frame* childFrame) | 1556 void FrameLoader::loadURLIntoChildFrame(const KURL& url, const String& referer,
Frame* childFrame) |
1557 { | 1557 { |
1558 ASSERT(childFrame); | 1558 ASSERT(childFrame); |
1559 HistoryItem* parentItem = currentHistoryItem(); | 1559 HistoryItem* parentItem = currentHistoryItem(); |
1560 FrameLoadType loadType = this->loadType(); | 1560 FrameLoadType loadType = this->loadType(); |
1561 FrameLoadType childLoadType = FrameLoadTypeRedirect; | 1561 FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedBackForwardList
; |
1562 | 1562 |
1563 KURL workingURL = url; | 1563 KURL workingURL = url; |
1564 | 1564 |
1565 // If we're moving in the backforward list, we might want to replace the con
tent | 1565 // If we're moving in the backforward list, we might want to replace the con
tent |
1566 // of this child frame with whatever was there at that point. | 1566 // of this child frame with whatever was there at that point. |
1567 if (parentItem && parentItem->children().size() && isBackForwardLoadType(loa
dType)) { | 1567 if (parentItem && parentItem->children().size() && isBackForwardLoadType(loa
dType)) { |
1568 HistoryItem* childItem = parentItem->childItemWithName(childFrame->tree(
)->name()); | 1568 HistoryItem* childItem = parentItem->childItemWithName(childFrame->tree(
)->name()); |
1569 if (childItem) { | 1569 if (childItem) { |
1570 // Use the original URL to ensure we get all the side-effects, such
as | 1570 // Use the original URL to ensure we get all the side-effects, such
as |
1571 // onLoad handlers, of any redirects that happened. An example of wh
ere | 1571 // onLoad handlers, of any redirects that happened. An example of wh
ere |
1572 // this is needed is Radar 3213556. | 1572 // this is needed is Radar 3213556. |
1573 workingURL = KURL(childItem->originalURLString()); | 1573 workingURL = KURL(childItem->originalURLString()); |
1574 childLoadType = loadType; | 1574 childLoadType = loadType; |
1575 childFrame->loader()->setProvisionalHistoryItem(childItem); | 1575 childFrame->loader()->setProvisionalHistoryItem(childItem); |
1576 } | 1576 } |
1577 } | 1577 } |
1578 | 1578 |
1579 RefPtr<Archive> subframeArchive = activeDocumentLoader()->popArchiveForSubfr
ame(childFrame->tree()->name()); | 1579 RefPtr<Archive> subframeArchive = activeDocumentLoader()->popArchiveForSubfr
ame(childFrame->tree()->name()); |
1580 | 1580 |
1581 if (subframeArchive) | 1581 if (subframeArchive) |
1582 childFrame->loader()->loadArchive(subframeArchive.release()); | 1582 childFrame->loader()->loadArchive(subframeArchive.release()); |
1583 else | 1583 else |
1584 childFrame->loader()->loadURL(workingURL, referer, String(), childLoadTy
pe, 0, 0); | 1584 childFrame->loader()->loadURL(workingURL, referer, String(), false, chil
dLoadType, 0, 0); |
1585 } | 1585 } |
1586 | 1586 |
1587 void FrameLoader::loadArchive(PassRefPtr<Archive> prpArchive) | 1587 void FrameLoader::loadArchive(PassRefPtr<Archive> prpArchive) |
1588 { | 1588 { |
1589 RefPtr<Archive> archive = prpArchive; | 1589 RefPtr<Archive> archive = prpArchive; |
1590 | 1590 |
1591 ArchiveResource* mainResource = archive->mainResource(); | 1591 ArchiveResource* mainResource = archive->mainResource(); |
1592 ASSERT(mainResource); | 1592 ASSERT(mainResource); |
1593 if (!mainResource) | 1593 if (!mainResource) |
1594 return; | 1594 return; |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2156 m_redirectionTimer.stop(); | 2156 m_redirectionTimer.stop(); |
2157 m_redirectionTimer.startOneShot(m_scheduledRedirection->delay); | 2157 m_redirectionTimer.startOneShot(m_scheduledRedirection->delay); |
2158 | 2158 |
2159 switch (m_scheduledRedirection->type) { | 2159 switch (m_scheduledRedirection->type) { |
2160 case ScheduledRedirection::redirection: | 2160 case ScheduledRedirection::redirection: |
2161 case ScheduledRedirection::locationChange: | 2161 case ScheduledRedirection::locationChange: |
2162 case ScheduledRedirection::locationChangeDuringLoad: | 2162 case ScheduledRedirection::locationChangeDuringLoad: |
2163 clientRedirected(KURL(m_scheduledRedirection->url), | 2163 clientRedirected(KURL(m_scheduledRedirection->url), |
2164 m_scheduledRedirection->delay, | 2164 m_scheduledRedirection->delay, |
2165 currentTime() + m_redirectionTimer.nextFireInterval(), | 2165 currentTime() + m_redirectionTimer.nextFireInterval(), |
2166 m_scheduledRedirection->lockHistory, | |
2167 m_scheduledRedirection->lockBackForwardList, | 2166 m_scheduledRedirection->lockBackForwardList, |
2168 m_isExecutingJavaScriptFormAction); | 2167 m_isExecutingJavaScriptFormAction); |
2169 return; | 2168 return; |
2170 case ScheduledRedirection::historyNavigation: | 2169 case ScheduledRedirection::historyNavigation: |
2171 // Don't report history navigations. | 2170 // Don't report history navigations. |
2172 return; | 2171 return; |
2173 } | 2172 } |
2174 ASSERT_NOT_REACHED(); | 2173 ASSERT_NOT_REACHED(); |
2175 } | 2174 } |
2176 | 2175 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2260 return; | 2259 return; |
2261 } | 2260 } |
2262 } | 2261 } |
2263 | 2262 |
2264 if (shouldHideReferrer(url, referrer)) | 2263 if (shouldHideReferrer(url, referrer)) |
2265 referrer = String(); | 2264 referrer = String(); |
2266 | 2265 |
2267 FrameLoadType loadType; | 2266 FrameLoadType loadType; |
2268 if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData) | 2267 if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData) |
2269 loadType = FrameLoadTypeReload; | 2268 loadType = FrameLoadTypeReload; |
2270 else if (lockHistory && lockBackForwardList) | 2269 else if (lockBackForwardList) |
2271 loadType = FrameLoadTypeRedirect; | 2270 loadType = FrameLoadTypeRedirectWithLockedBackForwardList; |
2272 else | 2271 else |
2273 loadType = FrameLoadTypeStandard; | 2272 loadType = FrameLoadTypeStandard; |
2274 | 2273 |
2275 if (request.resourceRequest().httpMethod() == "POST") | 2274 if (request.resourceRequest().httpMethod() == "POST") |
2276 loadPostRequest(request.resourceRequest(), referrer, request.frameName()
, loadType, event, formState.release()); | 2275 loadPostRequest(request.resourceRequest(), referrer, request.frameName()
, lockHistory, loadType, event, formState.release()); |
2277 else | 2276 else |
2278 loadURL(request.resourceRequest().url(), referrer, request.frameName(),
loadType, event, formState.release()); | 2277 loadURL(request.resourceRequest().url(), referrer, request.frameName(),
lockHistory, loadType, event, formState.release()); |
2279 | 2278 |
2280 Frame* targetFrame = findFrameForNavigation(request.frameName()); | 2279 Frame* targetFrame = findFrameForNavigation(request.frameName()); |
2281 if (targetFrame && targetFrame != m_frame) | 2280 if (targetFrame && targetFrame != m_frame) |
2282 if (Page* page = targetFrame->page()) | 2281 if (Page* page = targetFrame->page()) |
2283 page->chrome()->focus(); | 2282 page->chrome()->focus(); |
2284 } | 2283 } |
2285 | 2284 |
2286 void FrameLoader::loadURL(const KURL& newURL, const String& referrer, const Stri
ng& frameName, FrameLoadType newLoadType, | 2285 void FrameLoader::loadURL(const KURL& newURL, const String& referrer, const Stri
ng& frameName, bool lockHistory, FrameLoadType newLoadType, |
2287 Event* event, PassRefPtr<FormState> prpFormState) | 2286 Event* event, PassRefPtr<FormState> prpFormState) |
2288 { | 2287 { |
2289 RefPtr<FormState> formState = prpFormState; | 2288 RefPtr<FormState> formState = prpFormState; |
2290 bool isFormSubmission = formState; | 2289 bool isFormSubmission = formState; |
2291 | 2290 |
2292 ResourceRequest request(newURL); | 2291 ResourceRequest request(newURL); |
2293 if (!referrer.isEmpty()) { | 2292 if (!referrer.isEmpty()) { |
2294 request.setHTTPReferrer(referrer); | 2293 request.setHTTPReferrer(referrer); |
2295 RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString
(referrer); | 2294 RefPtr<SecurityOrigin> referrerOrigin = SecurityOrigin::createFromString
(referrer); |
2296 addHTTPOriginIfNeeded(request, referrerOrigin->toString()); | 2295 addHTTPOriginIfNeeded(request, referrerOrigin->toString()); |
2297 } | 2296 } |
2298 addExtraFieldsToRequest(request, newLoadType, true, event || isFormSubmissio
n); | 2297 addExtraFieldsToRequest(request, newLoadType, true, event || isFormSubmissio
n); |
2299 if (newLoadType == FrameLoadTypeReload || newLoadType == FrameLoadTypeReload
FromOrigin) | 2298 if (newLoadType == FrameLoadTypeReload || newLoadType == FrameLoadTypeReload
FromOrigin) |
2300 request.setCachePolicy(ReloadIgnoringCacheData); | 2299 request.setCachePolicy(ReloadIgnoringCacheData); |
2301 | 2300 |
2302 ASSERT(newLoadType != FrameLoadTypeSame); | 2301 ASSERT(newLoadType != FrameLoadTypeSame); |
2303 | 2302 |
2304 NavigationAction action(newURL, newLoadType, isFormSubmission, event); | 2303 NavigationAction action(newURL, newLoadType, isFormSubmission, event); |
2305 | 2304 |
2306 if (!frameName.isEmpty()) { | 2305 if (!frameName.isEmpty()) { |
2307 if (Frame* targetFrame = findFrameForNavigation(frameName)) | 2306 if (Frame* targetFrame = findFrameForNavigation(frameName)) |
2308 targetFrame->loader()->loadURL(newURL, referrer, String(), newLoadTy
pe, event, formState); | 2307 targetFrame->loader()->loadURL(newURL, referrer, String(), lockHisto
ry, newLoadType, event, formState); |
2309 else | 2308 else |
2310 checkNewWindowPolicy(action, request, formState, frameName); | 2309 checkNewWindowPolicy(action, request, formState, frameName); |
2311 return; | 2310 return; |
2312 } | 2311 } |
2313 | 2312 |
2314 RefPtr<DocumentLoader> oldDocumentLoader = m_documentLoader; | 2313 RefPtr<DocumentLoader> oldDocumentLoader = m_documentLoader; |
2315 | 2314 |
2316 bool sameURL = shouldTreatURLAsSameAsCurrent(newURL); | 2315 bool sameURL = shouldTreatURLAsSameAsCurrent(newURL); |
2317 | 2316 |
2318 // Make sure to do scroll to anchor processing even if the URL is | 2317 // Make sure to do scroll to anchor processing even if the URL is |
2319 // exactly the same so pages with '#' links and DHTML side effects | 2318 // exactly the same so pages with '#' links and DHTML side effects |
2320 // work properly. | 2319 // work properly. |
2321 if (shouldScrollToAnchor(isFormSubmission, newLoadType, newURL)) { | 2320 if (shouldScrollToAnchor(isFormSubmission, newLoadType, newURL)) { |
2322 oldDocumentLoader->setTriggeringAction(action); | 2321 oldDocumentLoader->setTriggeringAction(action); |
2323 stopPolicyCheck(); | 2322 stopPolicyCheck(); |
2324 checkNavigationPolicy(request, oldDocumentLoader.get(), formState, | 2323 checkNavigationPolicy(request, oldDocumentLoader.get(), formState, |
2325 callContinueFragmentScrollAfterNavigationPolicy, this); | 2324 callContinueFragmentScrollAfterNavigationPolicy, this); |
2326 } else { | 2325 } else { |
2327 // must grab this now, since this load may stop the previous load and cl
ear this flag | 2326 // must grab this now, since this load may stop the previous load and cl
ear this flag |
2328 bool isRedirect = m_quickRedirectComing; | 2327 bool isRedirect = m_quickRedirectComing; |
2329 loadWithNavigationAction(request, action, newLoadType, formState); | 2328 loadWithNavigationAction(request, action, lockHistory, newLoadType, form
State); |
2330 if (isRedirect) { | 2329 if (isRedirect) { |
2331 m_quickRedirectComing = false; | 2330 m_quickRedirectComing = false; |
2332 if (m_provisionalDocumentLoader) | 2331 if (m_provisionalDocumentLoader) |
2333 m_provisionalDocumentLoader->setIsClientRedirect(true); | 2332 m_provisionalDocumentLoader->setIsClientRedirect(true); |
2334 } else if (sameURL) | 2333 } else if (sameURL) |
2335 // Example of this case are sites that reload the same URL with a di
fferent cookie | 2334 // Example of this case are sites that reload the same URL with a di
fferent cookie |
2336 // driving the generated content, or a master frame with links that
drive a target | 2335 // driving the generated content, or a master frame with links that
drive a target |
2337 // frame, where the user has clicked on the same link repeatedly. | 2336 // frame, where the user has clicked on the same link repeatedly. |
2338 // But if the load type is FrameLoadTypeReload, which means the fram
e | 2337 // But if the load type is FrameLoadTypeReload, which means the fram
e |
2339 // is reloaded so we do not change the load type. | 2338 // is reloaded so we do not change the load type. |
2340 if (m_loadType != FrameLoadTypeReload) | 2339 if (m_loadType != FrameLoadTypeReload) |
2341 m_loadType = FrameLoadTypeSame; | 2340 m_loadType = FrameLoadTypeSame; |
2342 } | 2341 } |
2343 } | 2342 } |
2344 | 2343 |
2345 void FrameLoader::load(const ResourceRequest& request) | 2344 void FrameLoader::load(const ResourceRequest& request, bool lockHistory) |
2346 { | 2345 { |
2347 load(request, SubstituteData()); | 2346 load(request, SubstituteData(), lockHistory); |
2348 } | 2347 } |
2349 | 2348 |
2350 void FrameLoader::load(const ResourceRequest& request, const SubstituteData& sub
stituteData) | 2349 void FrameLoader::load(const ResourceRequest& request, const SubstituteData& sub
stituteData, bool lockHistory) |
2351 { | 2350 { |
2352 if (m_inStopAllLoaders) | 2351 if (m_inStopAllLoaders) |
2353 return; | 2352 return; |
2354 | 2353 |
2355 // FIXME: is this the right place to reset loadType? Perhaps this should be
done after loading is finished or aborted. | 2354 // FIXME: is this the right place to reset loadType? Perhaps this should be
done after loading is finished or aborted. |
2356 m_loadType = FrameLoadTypeStandard; | 2355 m_loadType = FrameLoadTypeStandard; |
2357 load(m_client->createDocumentLoader(request, substituteData).get()); | 2356 RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, subs
tituteData); |
| 2357 loader->setURLForHistoryReflectsClientRedirect(lockHistory); |
| 2358 load(loader.get()); |
2358 } | 2359 } |
2359 | 2360 |
2360 void FrameLoader::load(const ResourceRequest& request, const String& frameName) | 2361 void FrameLoader::load(const ResourceRequest& request, const String& frameName,
bool lockHistory) |
2361 { | 2362 { |
2362 if (frameName.isEmpty()) { | 2363 if (frameName.isEmpty()) { |
2363 load(request); | 2364 load(request, lockHistory); |
2364 return; | 2365 return; |
2365 } | 2366 } |
2366 | 2367 |
2367 Frame* frame = findFrameForNavigation(frameName); | 2368 Frame* frame = findFrameForNavigation(frameName); |
2368 if (frame) { | 2369 if (frame) { |
2369 frame->loader()->load(request); | 2370 frame->loader()->load(request, lockHistory); |
2370 return; | 2371 return; |
2371 } | 2372 } |
2372 | 2373 |
2373 checkNewWindowPolicy(NavigationAction(request.url(), NavigationTypeOther), r
equest, 0, frameName); | 2374 checkNewWindowPolicy(NavigationAction(request.url(), NavigationTypeOther), r
equest, 0, frameName); |
2374 } | 2375 } |
2375 | 2376 |
2376 void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const
NavigationAction& action, FrameLoadType type, PassRefPtr<FormState> formState) | 2377 void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const
NavigationAction& action, bool lockHistory, FrameLoadType type, PassRefPtr<Form
State> formState) |
2377 { | 2378 { |
2378 RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, Subs
tituteData()); | 2379 RefPtr<DocumentLoader> loader = m_client->createDocumentLoader(request, Subs
tituteData()); |
| 2380 loader->setURLForHistoryReflectsClientRedirect(lockHistory); |
2379 | 2381 |
2380 loader->setTriggeringAction(action); | 2382 loader->setTriggeringAction(action); |
2381 if (m_documentLoader) { | 2383 if (m_documentLoader) { |
2382 // if the load type is not FrameLoadTypeReload, | 2384 // if the load type is not FrameLoadTypeReload, |
2383 // we need not use original encoding override. | 2385 // we need not use original encoding override. |
2384 if (type == FrameLoadTypeReload) | 2386 if (type == FrameLoadTypeReload) |
2385 loader->setOverrideEncoding(m_documentLoader->overrideEncoding()); | 2387 loader->setOverrideEncoding(m_documentLoader->overrideEncoding()); |
2386 else | 2388 else |
2387 loader->setOverrideEncoding(String()); | 2389 loader->setOverrideEncoding(String()); |
2388 } | 2390 } |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2994 updateHistoryForStandardLoad(); | 2996 updateHistoryForStandardLoad(); |
2995 #ifndef BUILDING_ON_TIGER | 2997 #ifndef BUILDING_ON_TIGER |
2996 // This code was originally added for a Leopard performance imporvem
ent. We decided to | 2998 // This code was originally added for a Leopard performance imporvem
ent. We decided to |
2997 // ifdef it to fix correctness issues on Tiger documented in <rdar:/
/problem/5441823>. | 2999 // ifdef it to fix correctness issues on Tiger documented in <rdar:/
/problem/5441823>. |
2998 if (m_frame->view()) | 3000 if (m_frame->view()) |
2999 m_frame->view()->setScrollbarsSuppressed(true); | 3001 m_frame->view()->setScrollbarsSuppressed(true); |
3000 #endif | 3002 #endif |
3001 m_client->transitionToCommittedForNewPage(); | 3003 m_client->transitionToCommittedForNewPage(); |
3002 break; | 3004 break; |
3003 | 3005 |
3004 case FrameLoadTypeRedirect: | 3006 case FrameLoadTypeRedirectWithLockedBackForwardList: |
3005 updateHistoryForRedirectWithLockedHistory(); | 3007 updateHistoryForRedirectWithLockedBackForwardList(); |
3006 m_client->transitionToCommittedForNewPage(); | 3008 m_client->transitionToCommittedForNewPage(); |
3007 break; | 3009 break; |
3008 | 3010 |
3009 // FIXME Remove this check when dummy ds is removed (whatever "dummy ds"
is). | 3011 // FIXME Remove this check when dummy ds is removed (whatever "dummy ds"
is). |
3010 // An exception should be thrown if we're in the FrameLoadTypeUninitiali
zed state. | 3012 // An exception should be thrown if we're in the FrameLoadTypeUninitiali
zed state. |
3011 default: | 3013 default: |
3012 ASSERT_NOT_REACHED(); | 3014 ASSERT_NOT_REACHED(); |
3013 } | 3015 } |
3014 | 3016 |
3015 m_responseMIMEType = dl->responseMIMEType(); | 3017 m_responseMIMEType = dl->responseMIMEType(); |
3016 | 3018 |
3017 // Tell the client we've committed this URL. | 3019 // Tell the client we've committed this URL. |
3018 ASSERT(m_frame->view()); | 3020 ASSERT(m_frame->view()); |
3019 | 3021 |
3020 if (m_creatingInitialEmptyDocument) | 3022 if (m_creatingInitialEmptyDocument) |
3021 return; | 3023 return; |
| 3024 |
| 3025 m_committedFirstRealDocumentLoad = true; |
3022 | 3026 |
3023 m_committedFirstRealDocumentLoad = true; | |
3024 | |
3025 // For non-cached HTML pages, these methods are called in FrameLoader::begin
. | 3027 // For non-cached HTML pages, these methods are called in FrameLoader::begin
. |
3026 if (cachedPage || !m_client->hasHTMLView()) { | 3028 if (cachedPage || !m_client->hasHTMLView()) { |
3027 dispatchDidCommitLoad(); | 3029 dispatchDidCommitLoad(); |
3028 | 3030 |
3029 // If we have a title let the WebView know about it. | 3031 // If we have a title let the WebView know about it. |
3030 if (!ptitle.isNull()) | 3032 if (!ptitle.isNull()) |
3031 m_client->dispatchDidReceiveTitle(ptitle); | 3033 m_client->dispatchDidReceiveTitle(ptitle); |
3032 } | 3034 } |
3033 } | 3035 } |
3034 | 3036 |
3035 void FrameLoader::clientRedirectCancelledOrFinished(bool cancelWithLoadInProgres
s) | 3037 void FrameLoader::clientRedirectCancelledOrFinished(bool cancelWithLoadInProgres
s) |
3036 { | 3038 { |
3037 // Note that -webView:didCancelClientRedirectForFrame: is called on the fram
e load delegate even if | 3039 // Note that -webView:didCancelClientRedirectForFrame: is called on the fram
e load delegate even if |
3038 // the redirect succeeded. We should either rename this API, or add a new m
ethod, like | 3040 // the redirect succeeded. We should either rename this API, or add a new m
ethod, like |
3039 // -webView:didFinishClientRedirectForFrame: | 3041 // -webView:didFinishClientRedirectForFrame: |
3040 m_client->dispatchDidCancelClientRedirect(); | 3042 m_client->dispatchDidCancelClientRedirect(); |
3041 | 3043 |
3042 if (!cancelWithLoadInProgress) | 3044 if (!cancelWithLoadInProgress) |
3043 m_quickRedirectComing = false; | 3045 m_quickRedirectComing = false; |
3044 | 3046 |
3045 m_sentRedirectNotification = false; | 3047 m_sentRedirectNotification = false; |
3046 } | 3048 } |
3047 | 3049 |
3048 void FrameLoader::clientRedirected(const KURL& url, double seconds, double fireD
ate, bool lockHistory, bool lockBackForwardList, bool isJavaScriptFormAction) | 3050 void FrameLoader::clientRedirected(const KURL& url, double seconds, double fireD
ate, bool lockBackForwardList, bool isJavaScriptFormAction) |
3049 { | 3051 { |
3050 m_client->dispatchWillPerformClientRedirect(url, seconds, fireDate); | 3052 m_client->dispatchWillPerformClientRedirect(url, seconds, fireDate); |
3051 | 3053 |
3052 // Remember that we sent a redirect notification to the frame load delegate
so that when we commit | 3054 // Remember that we sent a redirect notification to the frame load delegate
so that when we commit |
3053 // the next provisional load, we can send a corresponding -webView:didCancel
ClientRedirectForFrame: | 3055 // the next provisional load, we can send a corresponding -webView:didCancel
ClientRedirectForFrame: |
3054 m_sentRedirectNotification = true; | 3056 m_sentRedirectNotification = true; |
3055 | 3057 |
3056 // If a "quick" redirect comes in an, we set a special mode so we treat the
next | 3058 // If a "quick" redirect comes in an, we set a special mode so we treat the
next |
3057 // load as part of the same navigation. If we don't have a document loader,
we have | 3059 // load as part of the same navigation. If we don't have a document loader,
we have |
3058 // no "original" load on which to base a redirect, so we treat the redirect
as a normal load. | 3060 // no "original" load on which to base a redirect, so we treat the redirect
as a normal load. |
3059 m_quickRedirectComing = (lockHistory && lockBackForwardList) && m_documentLo
ader && !isJavaScriptFormAction; | 3061 m_quickRedirectComing = lockBackForwardList && m_documentLoader && !isJavaSc
riptFormAction; |
3060 } | 3062 } |
3061 | 3063 |
3062 #if ENABLE(WML) | 3064 #if ENABLE(WML) |
3063 void FrameLoader::setForceReloadWmlDeck(bool reload) | 3065 void FrameLoader::setForceReloadWmlDeck(bool reload) |
3064 { | 3066 { |
3065 m_forceReloadWmlDeck = reload; | 3067 m_forceReloadWmlDeck = reload; |
3066 } | 3068 } |
3067 #endif | 3069 #endif |
3068 | 3070 |
3069 bool FrameLoader::shouldReload(const KURL& currentURL, const KURL& destinationUR
L) | 3071 bool FrameLoader::shouldReload(const KURL& currentURL, const KURL& destinationUR
L) |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3687 request.setHTTPOrigin(origin); | 3689 request.setHTTPOrigin(origin); |
3688 } | 3690 } |
3689 | 3691 |
3690 void FrameLoader::committedLoad(DocumentLoader* loader, const char* data, int le
ngth) | 3692 void FrameLoader::committedLoad(DocumentLoader* loader, const char* data, int le
ngth) |
3691 { | 3693 { |
3692 if (ArchiveFactory::isArchiveMimeType(loader->response().mimeType())) | 3694 if (ArchiveFactory::isArchiveMimeType(loader->response().mimeType())) |
3693 return; | 3695 return; |
3694 m_client->committedLoad(loader, data, length); | 3696 m_client->committedLoad(loader, data, length); |
3695 } | 3697 } |
3696 | 3698 |
3697 void FrameLoader::loadPostRequest(const ResourceRequest& inRequest, const String
& referrer, const String& frameName, FrameLoadType loadType, Event* event, PassR
efPtr<FormState> prpFormState) | 3699 void FrameLoader::loadPostRequest(const ResourceRequest& inRequest, const String
& referrer, const String& frameName, bool lockHistory, FrameLoadType loadType, E
vent* event, PassRefPtr<FormState> prpFormState) |
3698 { | 3700 { |
3699 RefPtr<FormState> formState = prpFormState; | 3701 RefPtr<FormState> formState = prpFormState; |
3700 | 3702 |
3701 // When posting, use the NSURLRequestReloadIgnoringCacheData load flag. | 3703 // When posting, use the NSURLRequestReloadIgnoringCacheData load flag. |
3702 // This prevents a potential bug which may cause a page with a form that use
s itself | 3704 // This prevents a potential bug which may cause a page with a form that use
s itself |
3703 // as an action to be returned from the cache without submitting. | 3705 // as an action to be returned from the cache without submitting. |
3704 | 3706 |
3705 // FIXME: Where's the code that implements what the comment above says? | 3707 // FIXME: Where's the code that implements what the comment above says? |
3706 | 3708 |
3707 // Previously when this method was reached, the original FrameLoadRequest ha
d been deconstructed to build a | 3709 // Previously when this method was reached, the original FrameLoadRequest ha
d been deconstructed to build a |
(...skipping 12 matching lines...) Expand all Loading... |
3720 workingResourceRequest.setHTTPOrigin(origin); | 3722 workingResourceRequest.setHTTPOrigin(origin); |
3721 workingResourceRequest.setHTTPMethod("POST"); | 3723 workingResourceRequest.setHTTPMethod("POST"); |
3722 workingResourceRequest.setHTTPBody(formData); | 3724 workingResourceRequest.setHTTPBody(formData); |
3723 workingResourceRequest.setHTTPContentType(contentType); | 3725 workingResourceRequest.setHTTPContentType(contentType); |
3724 addExtraFieldsToRequest(workingResourceRequest, loadType, true, true); | 3726 addExtraFieldsToRequest(workingResourceRequest, loadType, true, true); |
3725 | 3727 |
3726 NavigationAction action(url, loadType, true, event); | 3728 NavigationAction action(url, loadType, true, event); |
3727 | 3729 |
3728 if (!frameName.isEmpty()) { | 3730 if (!frameName.isEmpty()) { |
3729 if (Frame* targetFrame = findFrameForNavigation(frameName)) | 3731 if (Frame* targetFrame = findFrameForNavigation(frameName)) |
3730 targetFrame->loader()->loadWithNavigationAction(workingResourceReque
st, action, loadType, formState.release()); | 3732 targetFrame->loader()->loadWithNavigationAction(workingResourceReque
st, action, lockHistory, loadType, formState.release()); |
3731 else | 3733 else |
3732 checkNewWindowPolicy(action, workingResourceRequest, formState.relea
se(), frameName); | 3734 checkNewWindowPolicy(action, workingResourceRequest, formState.relea
se(), frameName); |
3733 } else | 3735 } else |
3734 loadWithNavigationAction(workingResourceRequest, action, loadType, formS
tate.release()); | 3736 loadWithNavigationAction(workingResourceRequest, action, lockHistory, lo
adType, formState.release()); |
3735 } | 3737 } |
3736 | 3738 |
3737 void FrameLoader::loadEmptyDocumentSynchronously() | 3739 void FrameLoader::loadEmptyDocumentSynchronously() |
3738 { | 3740 { |
3739 ResourceRequest request(KURL("")); | 3741 ResourceRequest request(KURL("")); |
3740 load(request); | 3742 load(request, false); |
3741 } | 3743 } |
3742 | 3744 |
3743 unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& requ
est, ResourceError& error, ResourceResponse& response, Vector<char>& data) | 3745 unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& requ
est, ResourceError& error, ResourceResponse& response, Vector<char>& data) |
3744 { | 3746 { |
3745 // Since this is a subresource, we can load any URL (we ignore the return va
lue). | 3747 // Since this is a subresource, we can load any URL (we ignore the return va
lue). |
3746 // But we still want to know whether we should hide the referrer or not, so
we call the canLoad method. | 3748 // But we still want to know whether we should hide the referrer or not, so
we call the canLoad method. |
3747 String referrer = m_outgoingReferrer; | 3749 String referrer = m_outgoingReferrer; |
3748 if (shouldHideReferrer(request.url(), referrer)) | 3750 if (shouldHideReferrer(request.url(), referrer)) |
3749 referrer = String(); | 3751 referrer = String(); |
3750 | 3752 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3883 | 3885 |
3884 void FrameLoader::callContinueFragmentScrollAfterNavigationPolicy(void* argument
, | 3886 void FrameLoader::callContinueFragmentScrollAfterNavigationPolicy(void* argument
, |
3885 const ResourceRequest& request, PassRefPtr<FormState>, bool shouldContinue) | 3887 const ResourceRequest& request, PassRefPtr<FormState>, bool shouldContinue) |
3886 { | 3888 { |
3887 FrameLoader* loader = static_cast<FrameLoader*>(argument); | 3889 FrameLoader* loader = static_cast<FrameLoader*>(argument); |
3888 loader->continueFragmentScrollAfterNavigationPolicy(request, shouldContinue)
; | 3890 loader->continueFragmentScrollAfterNavigationPolicy(request, shouldContinue)
; |
3889 } | 3891 } |
3890 | 3892 |
3891 void FrameLoader::continueFragmentScrollAfterNavigationPolicy(const ResourceRequ
est& request, bool shouldContinue) | 3893 void FrameLoader::continueFragmentScrollAfterNavigationPolicy(const ResourceRequ
est& request, bool shouldContinue) |
3892 { | 3894 { |
3893 bool isRedirect = m_quickRedirectComing || m_policyLoadType == FrameLoadType
Redirect; | 3895 bool isRedirect = m_quickRedirectComing || m_policyLoadType == FrameLoadType
RedirectWithLockedBackForwardList; |
3894 m_quickRedirectComing = false; | 3896 m_quickRedirectComing = false; |
3895 | 3897 |
3896 if (!shouldContinue) | 3898 if (!shouldContinue) |
3897 return; | 3899 return; |
3898 | 3900 |
3899 KURL url = request.url(); | 3901 KURL url = request.url(); |
3900 | 3902 |
3901 m_documentLoader->replaceRequestURLForAnchorScroll(url); | 3903 m_documentLoader->replaceRequestURLForAnchorScroll(url); |
3902 if (!isRedirect && !shouldTreatURLAsSameAsCurrent(url)) { | 3904 if (!isRedirect && !shouldTreatURLAsSameAsCurrent(url)) { |
3903 // NB: must happen after _setURL, since we add based on the current requ
est. | 3905 // NB: must happen after _setURL, since we add based on the current requ
est. |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4163 RefPtr<Frame> mainFrame = m_client->dispatchCreatePage(); | 4165 RefPtr<Frame> mainFrame = m_client->dispatchCreatePage(); |
4164 if (!mainFrame) | 4166 if (!mainFrame) |
4165 return; | 4167 return; |
4166 | 4168 |
4167 if (frameName != "_blank") | 4169 if (frameName != "_blank") |
4168 mainFrame->tree()->setName(frameName); | 4170 mainFrame->tree()->setName(frameName); |
4169 | 4171 |
4170 mainFrame->loader()->setOpenedByDOM(); | 4172 mainFrame->loader()->setOpenedByDOM(); |
4171 mainFrame->loader()->m_client->dispatchShow(); | 4173 mainFrame->loader()->m_client->dispatchShow(); |
4172 mainFrame->loader()->setOpener(frame.get()); | 4174 mainFrame->loader()->setOpener(frame.get()); |
4173 mainFrame->loader()->loadWithNavigationAction(request, NavigationAction(), F
rameLoadTypeStandard, formState); | 4175 mainFrame->loader()->loadWithNavigationAction(request, NavigationAction(), f
alse, FrameLoadTypeStandard, formState); |
4174 } | 4176 } |
4175 | 4177 |
4176 void FrameLoader::sendRemainingDelegateMessages(unsigned long identifier, const
ResourceResponse& response, int length, const ResourceError& error) | 4178 void FrameLoader::sendRemainingDelegateMessages(unsigned long identifier, const
ResourceResponse& response, int length, const ResourceError& error) |
4177 { | 4179 { |
4178 if (!response.isNull()) | 4180 if (!response.isNull()) |
4179 dispatchDidReceiveResponse(m_documentLoader.get(), identifier, response)
; | 4181 dispatchDidReceiveResponse(m_documentLoader.get(), identifier, response)
; |
4180 | 4182 |
4181 if (length > 0) | 4183 if (length > 0) |
4182 dispatchDidReceiveContentLength(m_documentLoader.get(), identifier, leng
th); | 4184 dispatchDidReceiveContentLength(m_documentLoader.get(), identifier, leng
th); |
4183 | 4185 |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4638 case FrameLoadTypeReloadFromOrigin: | 4640 case FrameLoadTypeReloadFromOrigin: |
4639 request.setCachePolicy(ReloadIgnoringCacheData); | 4641 request.setCachePolicy(ReloadIgnoringCacheData); |
4640 break; | 4642 break; |
4641 case FrameLoadTypeBack: | 4643 case FrameLoadTypeBack: |
4642 case FrameLoadTypeForward: | 4644 case FrameLoadTypeForward: |
4643 case FrameLoadTypeIndexedBackForward: | 4645 case FrameLoadTypeIndexedBackForward: |
4644 if (itemURL.protocol() != "https") | 4646 if (itemURL.protocol() != "https") |
4645 request.setCachePolicy(ReturnCacheDataElseLoad); | 4647 request.setCachePolicy(ReturnCacheDataElseLoad); |
4646 break; | 4648 break; |
4647 case FrameLoadTypeStandard: | 4649 case FrameLoadTypeStandard: |
4648 case FrameLoadTypeRedirect: | 4650 case FrameLoadTypeRedirectWithLockedBackForwardList: |
4649 break; | 4651 break; |
4650 case FrameLoadTypeSame: | 4652 case FrameLoadTypeSame: |
4651 default: | 4653 default: |
4652 ASSERT_NOT_REACHED(); | 4654 ASSERT_NOT_REACHED(); |
4653 } | 4655 } |
4654 | 4656 |
4655 action = NavigationAction(itemOriginalURL, loadType, false); | 4657 action = NavigationAction(itemOriginalURL, loadType, false); |
4656 } | 4658 } |
4657 | 4659 |
4658 if (!addedExtraFields) | 4660 if (!addedExtraFields) |
4659 addExtraFieldsToRequest(request, m_loadType, true, formData); | 4661 addExtraFieldsToRequest(request, m_loadType, true, formData); |
4660 | 4662 |
4661 loadWithNavigationAction(request, action, loadType, 0); | 4663 loadWithNavigationAction(request, action, false, loadType, 0); |
4662 } | 4664 } |
4663 } | 4665 } |
4664 } | 4666 } |
4665 | 4667 |
4666 // Walk the frame tree and ensure that the URLs match the URLs in the item. | 4668 // Walk the frame tree and ensure that the URLs match the URLs in the item. |
4667 bool FrameLoader::urlsMatchItem(HistoryItem* item) const | 4669 bool FrameLoader::urlsMatchItem(HistoryItem* item) const |
4668 { | 4670 { |
4669 const KURL& currentURL = documentLoader()->url(); | 4671 const KURL& currentURL = documentLoader()->url(); |
4670 if (!equalIgnoringRef(currentURL, item->url())) | 4672 if (!equalIgnoringRef(currentURL, item->url())) |
4671 return false; | 4673 return false; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4801 // If the navigation occured during load and this is a subframe, update the
current | 4803 // If the navigation occured during load and this is a subframe, update the
current |
4802 // back/forward item rather than adding a new one and don't add the new URL
to global | 4804 // back/forward item rather than adding a new one and don't add the new URL
to global |
4803 // history at all. But do add it to visited links. <rdar://problem/5333496> | 4805 // history at all. But do add it to visited links. <rdar://problem/5333496> |
4804 bool frameNavigationDuringLoad = false; | 4806 bool frameNavigationDuringLoad = false; |
4805 if (m_navigationDuringLoad) { | 4807 if (m_navigationDuringLoad) { |
4806 HTMLFrameOwnerElement* owner = m_frame->ownerElement(); | 4808 HTMLFrameOwnerElement* owner = m_frame->ownerElement(); |
4807 frameNavigationDuringLoad = owner && !owner->createdByParser(); | 4809 frameNavigationDuringLoad = owner && !owner->createdByParser(); |
4808 m_navigationDuringLoad = false; | 4810 m_navigationDuringLoad = false; |
4809 } | 4811 } |
4810 | 4812 |
| 4813 bool didUpdateGlobalHistory = false; |
4811 if (!frameNavigationDuringLoad && !documentLoader()->isClientRedirect()) { | 4814 if (!frameNavigationDuringLoad && !documentLoader()->isClientRedirect()) { |
4812 if (!historyURL.isEmpty()) { | 4815 if (!historyURL.isEmpty()) { |
4813 addBackForwardItemClippedAtTarget(true); | 4816 addBackForwardItemClippedAtTarget(true); |
4814 if (!needPrivacy) | 4817 if (!needPrivacy) { |
4815 m_client->updateGlobalHistory(); | 4818 m_client->updateGlobalHistory(); |
| 4819 didUpdateGlobalHistory = true; |
| 4820 } |
4816 if (Page* page = m_frame->page()) | 4821 if (Page* page = m_frame->page()) |
4817 page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForwardLi
st()->currentItem()); | 4822 page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForwardLi
st()->currentItem()); |
4818 } | 4823 } |
4819 } else if (documentLoader()->unreachableURL().isEmpty() && m_currentHistoryI
tem) { | 4824 } else if (documentLoader()->unreachableURL().isEmpty() && m_currentHistoryI
tem) { |
4820 m_currentHistoryItem->setURL(documentLoader()->url()); | 4825 m_currentHistoryItem->setURL(documentLoader()->url()); |
4821 m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->request()
); | 4826 m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->request()
); |
4822 } | 4827 } |
4823 | 4828 |
4824 if (!historyURL.isEmpty() && !needPrivacy) { | 4829 if (!historyURL.isEmpty() && !needPrivacy) { |
4825 if (Page* page = m_frame->page()) | 4830 if (Page* page = m_frame->page()) |
4826 page->group().addVisitedLink(historyURL); | 4831 page->group().addVisitedLink(historyURL); |
| 4832 |
| 4833 if (!didUpdateGlobalHistory && !url().isEmpty()) |
| 4834 m_client->updateGlobalHistoryForRedirectWithoutHistoryItem(); |
4827 } | 4835 } |
4828 } | 4836 } |
4829 | 4837 |
4830 void FrameLoader::updateHistoryForClientRedirect() | 4838 void FrameLoader::updateHistoryForClientRedirect() |
4831 { | 4839 { |
4832 #if !LOG_DISABLED | 4840 #if !LOG_DISABLED |
4833 if (documentLoader()) | 4841 if (documentLoader()) |
4834 LOG(History, "WebCoreHistory: Updating History for client redirect in fr
ame %s", documentLoader()->title().utf8().data()); | 4842 LOG(History, "WebCoreHistory: Updating History for client redirect in fr
ame %s", documentLoader()->title().utf8().data()); |
4835 #endif | 4843 #endif |
4836 | 4844 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4874 | 4882 |
4875 if (loadType() == FrameLoadTypeReload || loadType() == FrameLoadTypeRelo
adFromOrigin) | 4883 if (loadType() == FrameLoadTypeReload || loadType() == FrameLoadTypeRelo
adFromOrigin) |
4876 saveScrollPositionAndViewStateToItem(m_currentHistoryItem.get()); | 4884 saveScrollPositionAndViewStateToItem(m_currentHistoryItem.get()); |
4877 | 4885 |
4878 // Sometimes loading a page again leads to a different result because of
cookies. Bugzilla 4072 | 4886 // Sometimes loading a page again leads to a different result because of
cookies. Bugzilla 4072 |
4879 if (documentLoader()->unreachableURL().isEmpty()) | 4887 if (documentLoader()->unreachableURL().isEmpty()) |
4880 m_currentHistoryItem->setURL(documentLoader()->requestURL()); | 4888 m_currentHistoryItem->setURL(documentLoader()->requestURL()); |
4881 } | 4889 } |
4882 } | 4890 } |
4883 | 4891 |
4884 void FrameLoader::updateHistoryForRedirectWithLockedHistory() | 4892 void FrameLoader::updateHistoryForRedirectWithLockedBackForwardList() |
4885 { | 4893 { |
4886 #if !LOG_DISABLED | 4894 #if !LOG_DISABLED |
4887 if (documentLoader()) | 4895 if (documentLoader()) |
4888 LOG(History, "WebCoreHistory: Updating History for internal load in fram
e %s", documentLoader()->title().utf8().data()); | 4896 LOG(History, "WebCoreHistory: Updating History for redirect load in fram
e %s", documentLoader()->title().utf8().data()); |
4889 #endif | 4897 #endif |
4890 | 4898 |
4891 Settings* settings = m_frame->settings(); | 4899 Settings* settings = m_frame->settings(); |
4892 bool needPrivacy = !settings || settings->privateBrowsingEnabled(); | 4900 bool needPrivacy = !settings || settings->privateBrowsingEnabled(); |
4893 const KURL& historyURL = documentLoader()->urlForHistory(); | 4901 const KURL& historyURL = documentLoader()->urlForHistory(); |
4894 | 4902 |
| 4903 bool didUpdateGlobalHistory = false; |
4895 if (documentLoader()->isClientRedirect()) { | 4904 if (documentLoader()->isClientRedirect()) { |
4896 if (!m_currentHistoryItem && !m_frame->tree()->parent()) { | 4905 if (!m_currentHistoryItem && !m_frame->tree()->parent()) { |
4897 addBackForwardItemClippedAtTarget(true); | |
4898 if (!historyURL.isEmpty()) { | 4906 if (!historyURL.isEmpty()) { |
4899 if (!needPrivacy) | 4907 addBackForwardItemClippedAtTarget(true); |
| 4908 if (!needPrivacy) { |
4900 m_client->updateGlobalHistory(); | 4909 m_client->updateGlobalHistory(); |
| 4910 didUpdateGlobalHistory = true; |
| 4911 } |
4901 if (Page* page = m_frame->page()) | 4912 if (Page* page = m_frame->page()) |
4902 page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForwa
rdList()->currentItem()); | 4913 page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForwa
rdList()->currentItem()); |
4903 } | 4914 } |
4904 } | 4915 } |
4905 if (m_currentHistoryItem) { | 4916 if (m_currentHistoryItem) { |
4906 m_currentHistoryItem->setURL(documentLoader()->url()); | 4917 m_currentHistoryItem->setURL(documentLoader()->url()); |
4907 m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->reque
st()); | 4918 m_currentHistoryItem->setFormInfoFromRequest(documentLoader()->reque
st()); |
4908 } | 4919 } |
4909 } else { | 4920 } else { |
4910 Frame* parentFrame = m_frame->tree()->parent(); | 4921 Frame* parentFrame = m_frame->tree()->parent(); |
4911 if (parentFrame && parentFrame->loader()->m_currentHistoryItem) | 4922 if (parentFrame && parentFrame->loader()->m_currentHistoryItem) |
4912 parentFrame->loader()->m_currentHistoryItem->addChildItem(createHist
oryItem(true)); | 4923 parentFrame->loader()->m_currentHistoryItem->addChildItem(createHist
oryItem(true)); |
4913 } | 4924 } |
4914 | 4925 |
4915 if (!historyURL.isEmpty() && !needPrivacy) { | 4926 if (!historyURL.isEmpty() && !needPrivacy) { |
4916 if (Page* page = m_frame->page()) | 4927 if (Page* page = m_frame->page()) |
4917 page->group().addVisitedLink(historyURL); | 4928 page->group().addVisitedLink(historyURL); |
| 4929 |
| 4930 if (!didUpdateGlobalHistory && !url().isEmpty()) |
| 4931 m_client->updateGlobalHistoryForRedirectWithoutHistoryItem(); |
4918 } | 4932 } |
4919 } | 4933 } |
4920 | 4934 |
4921 void FrameLoader::updateHistoryForCommit() | 4935 void FrameLoader::updateHistoryForCommit() |
4922 { | 4936 { |
4923 #if !LOG_DISABLED | 4937 #if !LOG_DISABLED |
4924 if (documentLoader()) | 4938 if (documentLoader()) |
4925 LOG(History, "WebCoreHistory: Updating History for commit in frame %s",
documentLoader()->title().utf8().data()); | 4939 LOG(History, "WebCoreHistory: Updating History for commit in frame %s",
documentLoader()->title().utf8().data()); |
4926 #endif | 4940 #endif |
4927 FrameLoadType type = loadType(); | 4941 FrameLoadType type = loadType(); |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5493 } | 5507 } |
5494 | 5508 |
5495 #endif | 5509 #endif |
5496 | 5510 |
5497 bool FrameLoaderClient::hasHTMLView() const | 5511 bool FrameLoaderClient::hasHTMLView() const |
5498 { | 5512 { |
5499 return true; | 5513 return true; |
5500 } | 5514 } |
5501 | 5515 |
5502 } // namespace WebCore | 5516 } // namespace WebCore |
OLD | NEW |