| 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 3220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3231 // about:blank to clear a tab, and we want to still allow that. | 3231 // about:blank to clear a tab, and we want to still allow that. |
| 3232 // | 3232 // |
| 3233 // Note: this is known to break POST submissions when crossing process | 3233 // Note: this is known to break POST submissions when crossing process |
| 3234 // boundaries until http://crbug.com/101395 is fixed. This is better for | 3234 // boundaries until http://crbug.com/101395 is fixed. This is better for |
| 3235 // security than loading a WebUI, extension or app page in the wrong process. | 3235 // security than loading a WebUI, extension or app page in the wrong process. |
| 3236 // POST requests don't work because this mechanism does not preserve form | 3236 // POST requests don't work because this mechanism does not preserve form |
| 3237 // POST data. We will need to send the request's httpBody data up to the | 3237 // POST data. We will need to send the request's httpBody data up to the |
| 3238 // browser process, and issue a special POST navigation in WebKit (via | 3238 // browser process, and issue a special POST navigation in WebKit (via |
| 3239 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl | 3239 // FrameLoader::loadFrameRequest). See ResourceDispatcher and WebURLLoaderImpl |
| 3240 // for examples of how to send the httpBody data. | 3240 // for examples of how to send the httpBody data. |
| 3241 if (!frame->parent() && is_content_initiated && | 3241 if (!frame->parent() && (is_content_initiated || is_redirect) && |
| 3242 !url.SchemeIs(chrome::kAboutScheme)) { | 3242 !url.SchemeIs(chrome::kAboutScheme)) { |
| 3243 bool send_referrer = false; | 3243 bool send_referrer = false; |
| 3244 | 3244 |
| 3245 // All navigations to or from WebUI URLs or within WebUI-enabled | 3245 // All navigations to or from WebUI URLs or within WebUI-enabled |
| 3246 // RenderProcesses must be handled by the browser process so that the | 3246 // RenderProcesses must be handled by the browser process so that the |
| 3247 // correct bindings and data sources can be registered. | 3247 // correct bindings and data sources can be registered. |
| 3248 // Similarly, navigations to view-source URLs or within ViewSource mode | 3248 // Similarly, navigations to view-source URLs or within ViewSource mode |
| 3249 // must be handled by the browser process (except for reloads - those are | 3249 // must be handled by the browser process (except for reloads - those are |
| 3250 // safe to leave within the renderer). | 3250 // safe to leave within the renderer). |
| 3251 // Lastly, access to file:// URLs from non-file:// URL pages must be | 3251 // 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... |
| 3623 // from being dumb, WebCore doesn't expect it and it will cause a crash. | 3623 // from being dumb, WebCore doesn't expect it and it will cause a crash. |
| 3624 if (error.reason == net::ERR_ABORTED) | 3624 if (error.reason == net::ERR_ABORTED) |
| 3625 return; | 3625 return; |
| 3626 | 3626 |
| 3627 // Don't display "client blocked" error page if browser has asked us not to. | 3627 // Don't display "client blocked" error page if browser has asked us not to. |
| 3628 if (error.reason == net::ERR_BLOCKED_BY_CLIENT && | 3628 if (error.reason == net::ERR_BLOCKED_BY_CLIENT && |
| 3629 renderer_preferences_.disable_client_blocked_error_page) { | 3629 renderer_preferences_.disable_client_blocked_error_page) { |
| 3630 return; | 3630 return; |
| 3631 } | 3631 } |
| 3632 | 3632 |
| 3633 if (RenderThreadImpl::current()->layout_test_mode()) | 3633 // Allow the embedder to suppress an error page. |
| 3634 if (GetContentClient()->renderer()->ShouldSuppressErrorPage( |
| 3635 error.unreachableURL)) { |
| 3634 return; | 3636 return; |
| 3637 } |
| 3638 |
| 3639 if (RenderThreadImpl::current() && |
| 3640 RenderThreadImpl::current()->layout_test_mode()) { |
| 3641 return; |
| 3642 } |
| 3635 | 3643 |
| 3636 // Make sure we never show errors in view source mode. | 3644 // Make sure we never show errors in view source mode. |
| 3637 frame->enableViewSourceMode(false); | 3645 frame->enableViewSourceMode(false); |
| 3638 | 3646 |
| 3639 DocumentState* document_state = DocumentState::FromDataSource(ds); | 3647 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 3640 NavigationState* navigation_state = document_state->navigation_state(); | 3648 NavigationState* navigation_state = document_state->navigation_state(); |
| 3641 | 3649 |
| 3642 // If this is a failed back/forward/reload navigation, then we need to do a | 3650 // If this is a failed back/forward/reload navigation, then we need to do a |
| 3643 // 'replace' load. This is necessary to avoid messing up session history. | 3651 // 'replace' load. This is necessary to avoid messing up session history. |
| 3644 // Otherwise, we do a normal load, which simulates a 'go' navigation as far | 3652 // Otherwise, we do a normal load, which simulates a 'go' navigation as far |
| (...skipping 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6500 for (size_t i = 0; i < icon_urls.size(); i++) { | 6508 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6501 WebURL url = icon_urls[i].iconURL(); | 6509 WebURL url = icon_urls[i].iconURL(); |
| 6502 if (!url.isEmpty()) | 6510 if (!url.isEmpty()) |
| 6503 urls.push_back(FaviconURL(url, | 6511 urls.push_back(FaviconURL(url, |
| 6504 ToFaviconType(icon_urls[i].iconType()))); | 6512 ToFaviconType(icon_urls[i].iconType()))); |
| 6505 } | 6513 } |
| 6506 SendUpdateFaviconURL(urls); | 6514 SendUpdateFaviconURL(urls); |
| 6507 } | 6515 } |
| 6508 | 6516 |
| 6509 } // namespace content | 6517 } // namespace content |
| OLD | NEW |