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

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

Issue 14264012: Create errors (especially cancellation errors) internally to WebCore, rather (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: Created 7 years, 8 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
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 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 2436
2437 void FrameLoader::receivedMainResourceError(const ResourceError& error) 2437 void FrameLoader::receivedMainResourceError(const ResourceError& error)
2438 { 2438 {
2439 // Retain because the stop may release the last reference to it. 2439 // Retain because the stop may release the last reference to it.
2440 RefPtr<Frame> protect(m_frame); 2440 RefPtr<Frame> protect(m_frame);
2441 2441
2442 RefPtr<DocumentLoader> loader = activeDocumentLoader(); 2442 RefPtr<DocumentLoader> loader = activeDocumentLoader();
2443 // FIXME: Don't want to do this if an entirely new load is going, so should check 2443 // FIXME: Don't want to do this if an entirely new load is going, so should check
2444 // that both data sources on the frame are either this or nil. 2444 // that both data sources on the frame are either this or nil.
2445 stop(); 2445 stop();
2446 if (m_client->shouldFallBack(error)) 2446
2447 ResourceError c(ResourceError::cancelledError(KURL()));
2448 if (error.errorCode() != c.errorCode() || error.domain() != c.domain())
darin (slow to review) 2013/04/25 18:15:54 nit: might be good to leave a FIXME comment in her
2447 handleFallbackContent(); 2449 handleFallbackContent();
2448 2450
2449 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { 2451 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) {
2450 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCo py().url()) 2452 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCo py().url())
2451 m_submittedFormURL = KURL(); 2453 m_submittedFormURL = KURL();
2452 2454
2453 // We might have made a page cache item, but now we're bailing out due t o an error before we ever 2455 // We might have made a page cache item, but now we're bailing out due t o an error before we ever
2454 // transitioned to the new page (before WebFrameState == commit). The g oal here is to restore any state 2456 // transitioned to the new page (before WebFrameState == commit). The g oal here is to restore any state
2455 // so that the existing view (that wenever got far enough to replace) ca n continue being used. 2457 // so that the existing view (that wenever got far enough to replace) ca n continue being used.
2456 history()->invalidateCurrentItemCachedPage(); 2458 history()->invalidateCurrentItemCachedPage();
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2716 identifier = 0; 2718 identifier = 0;
2717 if (Page* page = m_frame->page()) { 2719 if (Page* page = m_frame->page()) {
2718 identifier = page->progress()->createUniqueIdentifier(); 2720 identifier = page->progress()->createUniqueIdentifier();
2719 notifier()->assignIdentifierToInitialRequest(identifier, m_documentLoade r.get(), request); 2721 notifier()->assignIdentifierToInitialRequest(identifier, m_documentLoade r.get(), request);
2720 } 2722 }
2721 2723
2722 ResourceRequest newRequest(request); 2724 ResourceRequest newRequest(request);
2723 notifier()->dispatchWillSendRequest(m_documentLoader.get(), identifier, newR equest, ResourceResponse()); 2725 notifier()->dispatchWillSendRequest(m_documentLoader.get(), identifier, newR equest, ResourceResponse());
2724 2726
2725 if (newRequest.isNull()) 2727 if (newRequest.isNull())
2726 error = cancelledError(request); 2728 error = ResourceError::cancelledError(request.url());
2727 else 2729 else
2728 error = ResourceError(); 2730 error = ResourceError();
2729 2731
2730 request = newRequest; 2732 request = newRequest;
2731 } 2733 }
2732 2734
2733 void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource) 2735 void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource)
2734 { 2736 {
2735 Page* page = m_frame->page(); 2737 Page* page = m_frame->page();
2736 if (!page) 2738 if (!page)
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 m_requestedHistoryItem = item; 2994 m_requestedHistoryItem = item;
2993 HistoryItem* currentItem = history()->currentItem(); 2995 HistoryItem* currentItem = history()->currentItem();
2994 bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavig ationTo(currentItem); 2996 bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavig ationTo(currentItem);
2995 2997
2996 if (sameDocumentNavigation) 2998 if (sameDocumentNavigation)
2997 loadSameDocumentItem(item); 2999 loadSameDocumentItem(item);
2998 else 3000 else
2999 loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForForm SubmissionItem); 3001 loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForForm SubmissionItem);
3000 } 3002 }
3001 3003
3002 ResourceError FrameLoader::cancelledError(const ResourceRequest& request) const
3003 {
3004 ResourceError error = m_client->cancelledError(request);
3005 error.setIsCancellation(true);
3006 return error;
3007 }
3008
3009 void FrameLoader::setTitle(const StringWithDirection& title) 3004 void FrameLoader::setTitle(const StringWithDirection& title)
3010 { 3005 {
3011 documentLoader()->setTitle(title); 3006 documentLoader()->setTitle(title);
3012 } 3007 }
3013 3008
3014 String FrameLoader::referrer() const 3009 String FrameLoader::referrer() const
3015 { 3010 {
3016 return m_documentLoader ? m_documentLoader->request().httpReferrer() : ""; 3011 return m_documentLoader ? m_documentLoader->request().httpReferrer() : "";
3017 } 3012 }
3018 3013
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3214 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect); 3209 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
3215 3210
3216 page->chrome()->setWindowRect(newWindowRect); 3211 page->chrome()->setWindowRect(newWindowRect);
3217 page->chrome()->show(); 3212 page->chrome()->show();
3218 3213
3219 created = true; 3214 created = true;
3220 return frame; 3215 return frame;
3221 } 3216 }
3222 3217
3223 } // namespace WebCore 3218 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698