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

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 2466 matching lines...) Expand 10 before | Expand all | Expand 10 after
2477 2477
2478 void FrameLoader::receivedMainResourceError(const ResourceError& error) 2478 void FrameLoader::receivedMainResourceError(const ResourceError& error)
2479 { 2479 {
2480 // Retain because the stop may release the last reference to it. 2480 // Retain because the stop may release the last reference to it.
2481 RefPtr<Frame> protect(m_frame); 2481 RefPtr<Frame> protect(m_frame);
2482 2482
2483 RefPtr<DocumentLoader> loader = activeDocumentLoader(); 2483 RefPtr<DocumentLoader> loader = activeDocumentLoader();
2484 // FIXME: Don't want to do this if an entirely new load is going, so should check 2484 // FIXME: Don't want to do this if an entirely new load is going, so should check
2485 // that both data sources on the frame are either this or nil. 2485 // that both data sources on the frame are either this or nil.
2486 stop(); 2486 stop();
2487 if (m_client->shouldFallBack(error)) 2487
2488 ResourceError c(ResourceError::cancelledError(KURL()));
2489 if (error.errorCode() != c.errorCode() || error.domain() != c.domain())
2488 handleFallbackContent(); 2490 handleFallbackContent();
2489 2491
2490 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { 2492 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) {
2491 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCo py().url()) 2493 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCo py().url())
2492 m_submittedFormURL = KURL(); 2494 m_submittedFormURL = KURL();
2493 2495
2494 // We might have made a page cache item, but now we're bailing out due t o an error before we ever 2496 // We might have made a page cache item, but now we're bailing out due t o an error before we ever
2495 // transitioned to the new page (before WebFrameState == commit). The g oal here is to restore any state 2497 // transitioned to the new page (before WebFrameState == commit). The g oal here is to restore any state
2496 // so that the existing view (that wenever got far enough to replace) ca n continue being used. 2498 // so that the existing view (that wenever got far enough to replace) ca n continue being used.
2497 history()->invalidateCurrentItemCachedPage(); 2499 history()->invalidateCurrentItemCachedPage();
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
2755 identifier = 0; 2757 identifier = 0;
2756 if (Page* page = m_frame->page()) { 2758 if (Page* page = m_frame->page()) {
2757 identifier = page->progress()->createUniqueIdentifier(); 2759 identifier = page->progress()->createUniqueIdentifier();
2758 notifier()->assignIdentifierToInitialRequest(identifier, m_documentLoade r.get(), request); 2760 notifier()->assignIdentifierToInitialRequest(identifier, m_documentLoade r.get(), request);
2759 } 2761 }
2760 2762
2761 ResourceRequest newRequest(request); 2763 ResourceRequest newRequest(request);
2762 notifier()->dispatchWillSendRequest(m_documentLoader.get(), identifier, newR equest, ResourceResponse()); 2764 notifier()->dispatchWillSendRequest(m_documentLoader.get(), identifier, newR equest, ResourceResponse());
2763 2765
2764 if (newRequest.isNull()) 2766 if (newRequest.isNull())
2765 error = cancelledError(request); 2767 error = ResourceError::cancelledError(request.url());
2766 else 2768 else
2767 error = ResourceError(); 2769 error = ResourceError();
2768 2770
2769 request = newRequest; 2771 request = newRequest;
2770 } 2772 }
2771 2773
2772 void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource) 2774 void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource)
2773 { 2775 {
2774 Page* page = m_frame->page(); 2776 Page* page = m_frame->page();
2775 if (!page) 2777 if (!page)
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 m_requestedHistoryItem = item; 3033 m_requestedHistoryItem = item;
3032 HistoryItem* currentItem = history()->currentItem(); 3034 HistoryItem* currentItem = history()->currentItem();
3033 bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavig ationTo(currentItem); 3035 bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavig ationTo(currentItem);
3034 3036
3035 if (sameDocumentNavigation) 3037 if (sameDocumentNavigation)
3036 loadSameDocumentItem(item); 3038 loadSameDocumentItem(item);
3037 else 3039 else
3038 loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForForm SubmissionItem); 3040 loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForForm SubmissionItem);
3039 } 3041 }
3040 3042
3041 ResourceError FrameLoader::cancelledError(const ResourceRequest& request) const
3042 {
3043 ResourceError error = m_client->cancelledError(request);
3044 error.setIsCancellation(true);
3045 return error;
3046 }
3047
3048 void FrameLoader::setTitle(const StringWithDirection& title) 3043 void FrameLoader::setTitle(const StringWithDirection& title)
3049 { 3044 {
3050 documentLoader()->setTitle(title); 3045 documentLoader()->setTitle(title);
3051 } 3046 }
3052 3047
3053 String FrameLoader::referrer() const 3048 String FrameLoader::referrer() const
3054 { 3049 {
3055 return m_documentLoader ? m_documentLoader->request().httpReferrer() : ""; 3050 return m_documentLoader ? m_documentLoader->request().httpReferrer() : "";
3056 } 3051 }
3057 3052
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3253 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect); 3248 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
3254 3249
3255 page->chrome()->setWindowRect(newWindowRect); 3250 page->chrome()->setWindowRect(newWindowRect);
3256 page->chrome()->show(); 3251 page->chrome()->show();
3257 3252
3258 created = true; 3253 created = true;
3259 return frame; 3254 return frame;
3260 } 3255 }
3261 3256
3262 } // namespace WebCore 3257 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698