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

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 24 matching lines...) Expand all
35 #include "config.h" 35 #include "config.h"
36 #include "FrameLoader.h" 36 #include "FrameLoader.h"
37 37
38 #include "AXObjectCache.h" 38 #include "AXObjectCache.h"
39 #include "ApplicationCacheHost.h" 39 #include "ApplicationCacheHost.h"
40 #include "BackForwardController.h" 40 #include "BackForwardController.h"
41 #include "BeforeUnloadEvent.h" 41 #include "BeforeUnloadEvent.h"
42 #include "MemoryCache.h" 42 #include "MemoryCache.h"
43 #include "CachedPage.h" 43 #include "CachedPage.h"
44 #include "CachedResourceLoader.h" 44 #include "CachedResourceLoader.h"
45 #include "CancelledResourceError.h"
45 #include "Chrome.h" 46 #include "Chrome.h"
46 #include "ChromeClient.h" 47 #include "ChromeClient.h"
47 #include "Console.h" 48 #include "Console.h"
48 #include "ContentSecurityPolicy.h" 49 #include "ContentSecurityPolicy.h"
49 #include "DOMImplementation.h" 50 #include "DOMImplementation.h"
50 #include "DOMWindow.h" 51 #include "DOMWindow.h"
51 #include "DatabaseManager.h" 52 #include "DatabaseManager.h"
52 #include "Document.h" 53 #include "Document.h"
53 #include "DocumentLoadTiming.h" 54 #include "DocumentLoadTiming.h"
54 #include "DocumentLoader.h" 55 #include "DocumentLoader.h"
(...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2497 2498
2498 void FrameLoader::receivedMainResourceError(const ResourceError& error) 2499 void FrameLoader::receivedMainResourceError(const ResourceError& error)
2499 { 2500 {
2500 // Retain because the stop may release the last reference to it. 2501 // Retain because the stop may release the last reference to it.
2501 RefPtr<Frame> protect(m_frame); 2502 RefPtr<Frame> protect(m_frame);
2502 2503
2503 RefPtr<DocumentLoader> loader = activeDocumentLoader(); 2504 RefPtr<DocumentLoader> loader = activeDocumentLoader();
2504 // FIXME: Don't want to do this if an entirely new load is going, so should check 2505 // FIXME: Don't want to do this if an entirely new load is going, so should check
2505 // that both data sources on the frame are either this or nil. 2506 // that both data sources on the frame are either this or nil.
2506 stop(); 2507 stop();
2507 if (m_client->shouldFallBack(error)) 2508
2509 ResourceError c = CancelledResourceError(KURL());
darin (slow to review) 2013/04/17 18:58:11 nit: CancelledResourceError c(KURL()); Although,
Nate Chapin 2013/04/17 20:45:05 I tried the switch to isCancellation(), and a coup
2510 if (error.errorCode() != c.errorCode() || error.domain() != c.domain())
2508 handleFallbackContent(); 2511 handleFallbackContent();
2509 2512
2510 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) { 2513 if (m_state == FrameStateProvisional && m_provisionalDocumentLoader) {
2511 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCo py().url()) 2514 if (m_submittedFormURL == m_provisionalDocumentLoader->originalRequestCo py().url())
2512 m_submittedFormURL = KURL(); 2515 m_submittedFormURL = KURL();
2513 2516
2514 // We might have made a page cache item, but now we're bailing out due t o an error before we ever 2517 // We might have made a page cache item, but now we're bailing out due t o an error before we ever
2515 // transitioned to the new page (before WebFrameState == commit). The g oal here is to restore any state 2518 // transitioned to the new page (before WebFrameState == commit). The g oal here is to restore any state
2516 // so that the existing view (that wenever got far enough to replace) ca n continue being used. 2519 // so that the existing view (that wenever got far enough to replace) ca n continue being used.
2517 history()->invalidateCurrentItemCachedPage(); 2520 history()->invalidateCurrentItemCachedPage();
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 identifier = 0; 2766 identifier = 0;
2764 if (Page* page = m_frame->page()) { 2767 if (Page* page = m_frame->page()) {
2765 identifier = page->progress()->createUniqueIdentifier(); 2768 identifier = page->progress()->createUniqueIdentifier();
2766 notifier()->assignIdentifierToInitialRequest(identifier, m_documentLoade r.get(), request); 2769 notifier()->assignIdentifierToInitialRequest(identifier, m_documentLoade r.get(), request);
2767 } 2770 }
2768 2771
2769 ResourceRequest newRequest(request); 2772 ResourceRequest newRequest(request);
2770 notifier()->dispatchWillSendRequest(m_documentLoader.get(), identifier, newR equest, ResourceResponse()); 2773 notifier()->dispatchWillSendRequest(m_documentLoader.get(), identifier, newR equest, ResourceResponse());
2771 2774
2772 if (newRequest.isNull()) 2775 if (newRequest.isNull())
2773 error = cancelledError(request); 2776 error = CancelledResourceError(request.url());
darin (slow to review) 2013/04/17 18:58:11 Hmm, this relies on the fact that CancelledResourc
2774 else 2777 else
2775 error = ResourceError(); 2778 error = ResourceError();
2776 2779
2777 request = newRequest; 2780 request = newRequest;
2778 } 2781 }
2779 2782
2780 void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource) 2783 void FrameLoader::loadedResourceFromMemoryCache(CachedResource* resource)
2781 { 2784 {
2782 Page* page = m_frame->page(); 2785 Page* page = m_frame->page();
2783 if (!page) 2786 if (!page)
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 m_requestedHistoryItem = item; 3042 m_requestedHistoryItem = item;
3040 HistoryItem* currentItem = history()->currentItem(); 3043 HistoryItem* currentItem = history()->currentItem();
3041 bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavig ationTo(currentItem); 3044 bool sameDocumentNavigation = currentItem && item->shouldDoSameDocumentNavig ationTo(currentItem);
3042 3045
3043 if (sameDocumentNavigation) 3046 if (sameDocumentNavigation)
3044 loadSameDocumentItem(item); 3047 loadSameDocumentItem(item);
3045 else 3048 else
3046 loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForForm SubmissionItem); 3049 loadDifferentDocumentItem(item, loadType, MayAttemptCacheOnlyLoadForForm SubmissionItem);
3047 } 3050 }
3048 3051
3049 ResourceError FrameLoader::cancelledError(const ResourceRequest& request) const
3050 {
3051 ResourceError error = m_client->cancelledError(request);
3052 error.setIsCancellation(true);
3053 return error;
3054 }
3055
3056 void FrameLoader::setTitle(const StringWithDirection& title) 3052 void FrameLoader::setTitle(const StringWithDirection& title)
3057 { 3053 {
3058 documentLoader()->setTitle(title); 3054 documentLoader()->setTitle(title);
3059 } 3055 }
3060 3056
3061 String FrameLoader::referrer() const 3057 String FrameLoader::referrer() const
3062 { 3058 {
3063 return m_documentLoader ? m_documentLoader->request().httpReferrer() : ""; 3059 return m_documentLoader ? m_documentLoader->request().httpReferrer() : "";
3064 } 3060 }
3065 3061
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect); 3257 FloatRect newWindowRect = DOMWindow::adjustWindowRect(page, windowRect);
3262 3258
3263 page->chrome()->setWindowRect(newWindowRect); 3259 page->chrome()->setWindowRect(newWindowRect);
3264 page->chrome()->show(); 3260 page->chrome()->show();
3265 3261
3266 created = true; 3262 created = true;
3267 return frame; 3263 return frame;
3268 } 3264 }
3269 3265
3270 } // namespace WebCore 3266 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698