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

Side by Side Diff: Source/WebCore/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 2492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2503 2503
2504 void FrameLoader::receivedMainResourceError(const ResourceError& error) 2504 void FrameLoader::receivedMainResourceError(const ResourceError& error)
2505 { 2505 {
2506 // Retain because the stop may release the last reference to it. 2506 // Retain because the stop may release the last reference to it.
2507 RefPtr<Frame> protect(m_frame); 2507 RefPtr<Frame> protect(m_frame);
2508 2508
2509 RefPtr<DocumentLoader> loader = activeDocumentLoader(); 2509 RefPtr<DocumentLoader> loader = activeDocumentLoader();
2510 // FIXME: Don't want to do this if an entirely new load is going, so should check 2510 // FIXME: Don't want to do this if an entirely new load is going, so should check
2511 // that both data sources on the frame are either this or nil. 2511 // that both data sources on the frame are either this or nil.
2512 stop(); 2512 stop();
2513 if (m_client->shouldFallBack(error)) 2513
2514 ResourceError c = ResourceError::createCancelledError(KURL());
2515 if (error.errorCode() != c.errorCode() || error.domain() != c.domain())
2514 handleFallbackContent(); 2516 handleFallbackContent();
2515 2517
2516 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { 2518 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) {
2517 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCo py().url()) 2519 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCo py().url())
2518 m_submittedFormURL = KURL(); 2520 m_submittedFormURL = KURL();
2519 2521
2520 // We might have made a page cache item, but now we're bailing out due t o an error before we ever 2522 // We might have made a page cache item, but now we're bailing out due t o an error before we ever
2521 // transitioned to the new page (before WebFrameState == commit). The g oal here is to restore any state 2523 // transitioned to the new page (before WebFrameState == commit). The g oal here is to restore any state
2522 // so that the existing view (that wenever got far enough to replace) ca n continue being used. 2524 // so that the existing view (that wenever got far enough to replace) ca n continue being used.
2523 history()->invalidateCurrentItemCachedPage(); 2525 history()->invalidateCurrentItemCachedPage();
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2769 identifier = 0; 2771 identifier = 0;
2770 if (Page* page = m_frame->page()) { 2772 if (Page* page = m_frame->page()) {
2771 identifier = page->progress()->createUniqueIdentifier(); 2773 identifier = page->progress()->createUniqueIdentifier();
2772 notifier()->assignIdentifierToInitialRequest(identifier, m_documentLoade r.get(), request); 2774 notifier()->assignIdentifierToInitialRequest(identifier, m_documentLoade r.get(), request);
2773 } 2775 }
2774 2776
2775 ResourceRequest newRequest(request); 2777 ResourceRequest newRequest(request);
2776 notifier()->dispatchWillSendRequest(m_documentLoader.get(), identifier, newR equest, ResourceResponse()); 2778 notifier()->dispatchWillSendRequest(m_documentLoader.get(), identifier, newR equest, ResourceResponse());
2777 2779
2778 if (newRequest.isNull()) 2780 if (newRequest.isNull())
2779 error = cancelledError(request); 2781 error = ResourceError::createCancelledError(request.url());
2780 else 2782 else
2781 error = ResourceError(); 2783 error = ResourceError();
2782 2784
2783 request = newRequest; 2785 request = newRequest;
2784 } 2786 }
2785 2787
2786 void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource) 2788 void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource)
2787 { 2789 {
2788 Page* page = m_frame->page(); 2790 Page* page = m_frame->page();
2789 if (!page) 2791 if (!page)
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
3045 m_requestedHistoryItem = item; 3047 m_requestedHistoryItem = item;
3046 HistoryItem* currentItem = history()->currentItem(); 3048 HistoryItem* currentItem = history()->currentItem();
3047 bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavig ationTo(currentItem); 3049 bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavig ationTo(currentItem);
3048 3050
3049 if (sameDocumentNavigation) 3051 if (sameDocumentNavigation)
3050 loadSameDocumentItem(item); 3052 loadSameDocumentItem(item);
3051 else 3053 else
3052 loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForForm SubmissionItem); 3054 loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForForm SubmissionItem);
3053 } 3055 }
3054 3056
3055 ResourceError FrameLoader::cancelledError(const ResourceRequest& request) const
3056 {
3057 ResourceError error = m_client->cancelledError(request);
3058 error.setIsCancellation(true);
3059 return error;
3060 }
3061
3062 void FrameLoader::setTitle(const StringWithDirection& title) 3057 void FrameLoader::setTitle(const StringWithDirection& title)
3063 { 3058 {
3064 documentLoader()->setTitle(title); 3059 documentLoader()->setTitle(title);
3065 } 3060 }
3066 3061
3067 String FrameLoader::referrer() const 3062 String FrameLoader::referrer() const
3068 { 3063 {
3069 return m_documentLoader ? m_documentLoader->request().httpReferrer() : ""; 3064 return m_documentLoader ? m_documentLoader->request().httpReferrer() : "";
3070 } 3065 }
3071 3066
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
3272 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect); 3267 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
3273 3268
3274 page->chrome()->setWindowRect(newWindowRect); 3269 page->chrome()->setWindowRect(newWindowRect);
3275 page->chrome()->show(); 3270 page->chrome()->show();
3276 3271
3277 created = true; 3272 created = true;
3278 return frame; 3273 return frame;
3279 } 3274 }
3280 3275
3281 } // namespace WebCore 3276 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698