| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 3231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3242 // about:blank to clear a tab, and we want to still allow that. | 3242 // about:blank to clear a tab, and we want to still allow that. |
| 3243 // | 3243 // |
| 3244 // Note: this is known to break POST submissions when crossing process | 3244 // Note: this is known to break POST submissions when crossing process |
| 3245 // boundaries until http://crbug.com/101395 is fixed. This is better for | 3245 // boundaries until http://crbug.com/101395 is fixed. This is better for |
| 3246 // security than loading a WebUI, extension or app page in the wrong process. | 3246 // security than loading a WebUI, extension or app page in the wrong process. |
| 3247 // POST requests don't work because this mechanism does not preserve form | 3247 // POST requests don't work because this mechanism does not preserve form |
| 3248 // POST data. We will need to send the request's httpBody data up to the | 3248 // POST data. We will need to send the request's httpBody data up to the |
| 3249 // browser process, and issue a special POST navigation in WebKit (via | 3249 // browser process, and issue a special POST navigation in WebKit (via |
| 3250 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl | 3250 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl |
| 3251 // for examples of how to send the httpBody data. | 3251 // for examples of how to send the httpBody data. |
| 3252 if (!frame->parent() && is_content_initiated && | 3252 if (!frame->parent() && (is_content_initiated || is_redirect) && |
| 3253 !url.SchemeIs(chrome::kAboutScheme)) { | 3253 !url.SchemeIs(chrome::kAboutScheme)) { |
| 3254 bool send_referrer = false; | 3254 bool send_referrer = false; |
| 3255 | 3255 |
| 3256 // All navigations to or from WebUI URLs or within WebUI-enabled | 3256 // All navigations to or from WebUI URLs or within WebUI-enabled |
| 3257 // RenderProcesses must be handled by the browser process so that the | 3257 // RenderProcesses must be handled by the browser process so that the |
| 3258 // correct bindings and data sources can be registered. | 3258 // correct bindings and data sources can be registered. |
| 3259 // Similarly, navigations to view-source URLs or within ViewSource mode | 3259 // Similarly, navigations to view-source URLs or within ViewSource mode |
| 3260 // must be handled by the browser process (except for reloads - those are | 3260 // must be handled by the browser process (except for reloads - those are |
| 3261 // safe to leave within the renderer). | 3261 // safe to leave within the renderer). |
| 3262 // Lastly, access to file:// URLs from non-file:// URL pages must be | 3262 // Lastly, access to file:// URLs from non-file:// URL pages must be |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3634 // from being dumb, WebCore doesn't expect it and it will cause a crash. | 3634 // from being dumb, WebCore doesn't expect it and it will cause a crash. |
| 3635 if (error.reason == net::ERR_ABORTED) | 3635 if (error.reason == net::ERR_ABORTED) |
| 3636 return; | 3636 return; |
| 3637 | 3637 |
| 3638 // Don't display "client blocked" error page if browser has asked us not to. | 3638 // Don't display "client blocked" error page if browser has asked us not to. |
| 3639 if (error.reason == net::ERR_BLOCKED_BY_CLIENT && | 3639 if (error.reason == net::ERR_BLOCKED_BY_CLIENT && |
| 3640 renderer_preferences_.disable_client_blocked_error_page) { | 3640 renderer_preferences_.disable_client_blocked_error_page) { |
| 3641 return; | 3641 return; |
| 3642 } | 3642 } |
| 3643 | 3643 |
| 3644 if (RenderThreadImpl::current()->layout_test_mode()) | 3644 // Allow the embedder to suppress an error page. |
| 3645 if (GetContentClient()->renderer()->ShouldSuppressErrorPage( |
| 3646 error.unreachableURL)) { |
| 3645 return; | 3647 return; |
| 3648 } |
| 3649 |
| 3650 if (RenderThreadImpl::current() && |
| 3651 RenderThreadImpl::current()->layout_test_mode()) { |
| 3652 return; |
| 3653 } |
| 3646 | 3654 |
| 3647 // Make sure we never show errors in view source mode. | 3655 // Make sure we never show errors in view source mode. |
| 3648 frame->enableViewSourceMode(false); | 3656 frame->enableViewSourceMode(false); |
| 3649 | 3657 |
| 3650 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3658 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 3651 NavigationState* navigation_state = document_state->navigation_state(); | 3659 NavigationState* navigation_state = document_state->navigation_state(); |
| 3652 | 3660 |
| 3653 // If this is a failed back/forward/reload navigation, then we need to do a | 3661 // If this is a failed back/forward/reload navigation, then we need to do a |
| 3654 // 'replace' load. This is necessary to avoid messing up session history. | 3662 // 'replace' load. This is necessary to avoid messing up session history. |
| 3655 // Otherwise, we do a normal load, which simulates a 'go' navigation as far | 3663 // Otherwise, we do a normal load, which simulates a 'go' navigation as far |
| (...skipping 2850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6506 for (size_t i = 0; i < icon_urls.size(); i++) { | 6514 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6507 WebURL url = icon_urls[i].iconURL(); | 6515 WebURL url = icon_urls[i].iconURL(); |
| 6508 if (!url.isEmpty()) | 6516 if (!url.isEmpty()) |
| 6509 urls.push_back(FaviconURL(url, | 6517 urls.push_back(FaviconURL(url, |
| 6510 ToFaviconType(icon_urls[i].iconType()))); | 6518 ToFaviconType(icon_urls[i].iconType()))); |
| 6511 } | 6519 } |
| 6512 SendUpdateFaviconURL(urls); | 6520 SendUpdateFaviconURL(urls); |
| 6513 } | 6521 } |
| 6514 | 6522 |
| 6515 } // namespace content | 6523 } // namespace content |
| OLD | NEW |