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

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

Powered by Google App Engine
This is Rietveld 408576698