Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: Source/core/loader/FrameLoader.cpp

Issue 14495011: Revert "Create errors (especially cancellation errors) internally to WebCore, rather" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 2316
2317 void FrameLoader::receivedMainResourceError(const ResourceError& error) 2317 void FrameLoader::receivedMainResourceError(const ResourceError& error)
2318 { 2318 {
2319 // Retain because the stop may release the last reference to it. 2319 // Retain because the stop may release the last reference to it.
2320 RefPtr<Frame> protect(m_frame); 2320 RefPtr<Frame> protect(m_frame);
2321 2321
2322 RefPtr<DocumentLoader> loader = activeDocumentLoader(); 2322 RefPtr<DocumentLoader> loader = activeDocumentLoader();
2323 // FIXME: Don't want to do this if an entirely new load is going, so should check 2323 // FIXME: Don't want to do this if an entirely new load is going, so should check
2324 // that both data sources on the frame are either this or nil. 2324 // that both data sources on the frame are either this or nil.
2325 stop(); 2325 stop();
2326 2326 if (m_client->shouldFallBack(error))
2327 // FIXME: We really ought to be able to just check for isCancellation() here , but there are some
2328 // ResourceErrors that setIsCancellation() but aren't created by ResourceErr or::cancelledError().
2329 ResourceError c(ResourceError::cancelledError(KURL()));
2330 if (error.errorCode() != c.errorCode() || error.domain() != c.domain())
2331 handleFallbackContent(); 2327 handleFallbackContent();
2332 2328
2333 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { 2329 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) {
2334 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCo py().url()) 2330 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCo py().url())
2335 m_submittedFormURL = KURL(); 2331 m_submittedFormURL = KURL();
2336 2332
2337 // Call clientRedirectCancelledOrFinished here so that the frame load de legate is notified that the redirect's 2333 // Call clientRedirectCancelledOrFinished here so that the frame load de legate is notified that the redirect's
2338 // status has changed, if there was a redirect. The frame load delegate may have saved some state about 2334 // status has changed, if there was a redirect. The frame load delegate may have saved some state about
2339 // the redirect in its -webView:willPerformClientRedirectToURL:delay:fir eDate:forFrame:. Since we are definitely 2335 // the redirect in its -webView:willPerformClientRedirectToURL:delay:fir eDate:forFrame:. Since we are definitely
2340 // not going to use this provisional resource, as it was cancelled, noti fy the frame load delegate that the redirect 2336 // not going to use this provisional resource, as it was cancelled, noti fy the frame load delegate that the redirect
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2589 identifier = 0; 2585 identifier = 0;
2590 if (Page* page = m_frame->page()) { 2586 if (Page* page = m_frame->page()) {
2591 identifier = createUniqueIdentifier(); 2587 identifier = createUniqueIdentifier();
2592 notifier()->assignIdentifierToInitialRequest(identifier, m_documentLoade r.get(), request); 2588 notifier()->assignIdentifierToInitialRequest(identifier, m_documentLoade r.get(), request);
2593 } 2589 }
2594 2590
2595 ResourceRequest newRequest(request); 2591 ResourceRequest newRequest(request);
2596 notifier()->dispatchWillSendRequest(m_documentLoader.get(), identifier, newR equest, ResourceResponse()); 2592 notifier()->dispatchWillSendRequest(m_documentLoader.get(), identifier, newR equest, ResourceResponse());
2597 2593
2598 if (newRequest.isNull()) 2594 if (newRequest.isNull())
2599 error = ResourceError::cancelledError(request.url()); 2595 error = cancelledError(request);
2600 else 2596 else
2601 error = ResourceError(); 2597 error = ResourceError();
2602 2598
2603 request = newRequest; 2599 request = newRequest;
2604 } 2600 }
2605 2601
2606 void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource) 2602 void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource)
2607 { 2603 {
2608 Page* page = m_frame->page(); 2604 Page* page = m_frame->page();
2609 if (!page) 2605 if (!page)
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 m_requestedHistoryItem = item; 2838 m_requestedHistoryItem = item;
2843 HistoryItem* currentItem = history()->currentItem(); 2839 HistoryItem* currentItem = history()->currentItem();
2844 bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavig ationTo(currentItem); 2840 bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavig ationTo(currentItem);
2845 2841
2846 if (sameDocumentNavigation) 2842 if (sameDocumentNavigation)
2847 loadSameDocumentItem(item); 2843 loadSameDocumentItem(item);
2848 else 2844 else
2849 loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForForm SubmissionItem); 2845 loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForForm SubmissionItem);
2850 } 2846 }
2851 2847
2848 ResourceError FrameLoader::cancelledError(const ResourceRequest& request) const
2849 {
2850 ResourceError error = m_client->cancelledError(request);
2851 error.setIsCancellation(true);
2852 return error;
2853 }
2854
2852 void FrameLoader::setTitle(const StringWithDirection& title) 2855 void FrameLoader::setTitle(const StringWithDirection& title)
2853 { 2856 {
2854 documentLoader()->setTitle(title); 2857 documentLoader()->setTitle(title);
2855 } 2858 }
2856 2859
2857 String FrameLoader::referrer() const 2860 String FrameLoader::referrer() const
2858 { 2861 {
2859 return m_documentLoader ? m_documentLoader->request().httpReferrer() : ""; 2862 return m_documentLoader ? m_documentLoader->request().httpReferrer() : "";
2860 } 2863 }
2861 2864
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3057 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect); 3060 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
3058 3061
3059 page->chrome()->setWindowRect(newWindowRect); 3062 page->chrome()->setWindowRect(newWindowRect);
3060 page->chrome()->show(); 3063 page->chrome()->show();
3061 3064
3062 created = true; 3065 created = true;
3063 return frame; 3066 return frame;
3064 } 3067 }
3065 3068
3066 } // namespace WebCore 3069 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698