diff options
39 files changed, 152 insertions, 268 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index a64b26b..aa0c358 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -57,7 +57,6 @@ include_rules = [ "+content/browser/geolocation/wifi_data_provider_common.h", "+content/browser/gpu/gpu_blacklist.h", "+content/browser/gpu/gpu_data_manager.h", - "+content/browser/gpu/gpu_process_host_ui_shim.h", "+content/browser/in_process_webkit/dom_storage_context.h", "+content/browser/in_process_webkit/session_storage_namespace.h", "+content/browser/in_process_webkit/webkit_context.h", diff --git a/chrome/browser/autofill/autofill_popup_view_browsertest.cc b/chrome/browser/autofill/autofill_popup_view_browsertest.cc index 5dda01a..06b80ad 100644 --- a/chrome/browser/autofill/autofill_popup_view_browsertest.cc +++ b/chrome/browser/autofill/autofill_popup_view_browsertest.cc @@ -71,7 +71,7 @@ IN_PROC_BROWSER_TEST_F(InProcessBrowserTest, GURL(chrome::kAboutBlankURL), content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); browser()->OpenURL(content::OpenURLParams( - GURL(chrome::kAboutCrashURL), content::Referrer(), + GURL(chrome::kChromeUICrashURL), content::Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); observer.Wait(); diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 7212cb6..0c7b22b 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -12,10 +12,8 @@ #include "base/string_util.h" #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/ui/browser_dialogs.h" -#include "chrome/common/about_handler.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" -#include "content/browser/gpu/gpu_process_host_ui_shim.h" #include "content/browser/sensors/sensors_provider.h" #if defined(USE_TCMALLOC) @@ -104,10 +102,6 @@ bool WillHandleBrowserAboutURL(GURL* url, if (!url->SchemeIs(chrome::kChromeUIScheme)) return false; - // Circumvent processing URLs that the renderer process will handle. - if (chrome_about_handler::WillHandle(*url)) - return false; - CommandLine* cl = CommandLine::ForCurrentProcess(); bool enableUberPage = !cl->HasSwitch(switches::kDisableUberPage); @@ -172,33 +166,6 @@ bool HandleNonNavigationAboutURL(const GURL& url) { #endif // OFFICIAL_BUILD - // Handle URLs to crash the browser or wreck the gpu process. - if (host == chrome::kChromeUIBrowserCrashHost) { - // Induce an intentional crash in the browser process. - CHECK(false); - } - - if (host == chrome::kChromeUIGpuCleanHost) { - GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); - if (shim) - shim->SimulateRemoveAllContext(); - return true; - } - - if (host == chrome::kChromeUIGpuCrashHost) { - GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); - if (shim) - shim->SimulateCrash(); - return true; - } - - if (host == chrome::kChromeUIGpuHangHost) { - GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); - if (shim) - shim->SimulateHang(); - return true; - } - #if defined(OS_CHROMEOS) if (host == chrome::kChromeUIRotateHost) { content::ScreenOrientation change = content::SCREEN_ORIENTATION_TOP; diff --git a/chrome/browser/browser_about_handler_unittest.cc b/chrome/browser/browser_about_handler_unittest.cc index 120e152..9516714 100644 --- a/chrome/browser/browser_about_handler_unittest.cc +++ b/chrome/browser/browser_about_handler_unittest.cc @@ -6,7 +6,6 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "chrome/browser/browser_about_handler.h" -#include "chrome/common/about_handler.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/testing_profile.h" #include "content/test/test_browser_thread.h" @@ -23,86 +22,42 @@ TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) { struct AboutURLTestData { GURL test_url; GURL result_url; - bool about_handled; - bool browser_handled; } test_data[] = { { GURL("http://google.com"), - GURL("http://google.com"), - false, - false + GURL("http://google.com") }, { GURL(chrome::kAboutBlankURL), - GURL(chrome::kAboutBlankURL), - false, - false - }, - { - GURL(chrome_prefix + chrome::kChromeUICrashHost), - GURL(chrome_prefix + chrome::kChromeUICrashHost), - true, - false - }, - { - GURL(chrome_prefix + chrome::kChromeUIKillHost), - GURL(chrome_prefix + chrome::kChromeUIKillHost), - true, - false + GURL(chrome::kAboutBlankURL) }, { - GURL(chrome_prefix + chrome::kChromeUIHangHost), - GURL(chrome_prefix + chrome::kChromeUIHangHost), - true, - false - }, - { - GURL(chrome_prefix + chrome::kChromeUIShorthangHost), - GURL(chrome_prefix + chrome::kChromeUIShorthangHost), - true, - false - }, - { - GURL(chrome_prefix + chrome::kChromeUIMemoryHost), GURL(chrome_prefix + chrome::kChromeUIMemoryHost), - false, - false + GURL(chrome_prefix + chrome::kChromeUIMemoryHost) }, { GURL(chrome_prefix + chrome::kChromeUIDefaultHost), - GURL(chrome_prefix + chrome::kChromeUIVersionHost), - false, - false + GURL(chrome_prefix + chrome::kChromeUIVersionHost) }, { GURL(chrome_prefix + chrome::kChromeUIAboutHost), - GURL(chrome_prefix + chrome::kChromeUIChromeURLsHost), - false, - false + GURL(chrome_prefix + chrome::kChromeUIChromeURLsHost) }, { GURL(chrome_prefix + chrome::kChromeUICacheHost), - GURL(chrome_prefix + chrome::kChromeUINetworkViewCacheHost), - false, - false + GURL(chrome_prefix + chrome::kChromeUINetworkViewCacheHost) }, { GURL(chrome_prefix + chrome::kChromeUIGpuHost), - GURL(chrome_prefix + chrome::kChromeUIGpuInternalsHost), - false, - false + GURL(chrome_prefix + chrome::kChromeUIGpuInternalsHost) }, { GURL(chrome_prefix + chrome::kChromeUISyncHost), - GURL(chrome_prefix + chrome::kChromeUISyncInternalsHost), - false, - false + GURL(chrome_prefix + chrome::kChromeUISyncInternalsHost) }, { GURL(chrome_prefix + "host/path?query#ref"), GURL(chrome_prefix + "host/path?query#ref"), - false, - false } }; MessageLoopForUI message_loop; @@ -111,14 +66,7 @@ TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { GURL url(test_data[i].test_url); - EXPECT_EQ(test_data[i].about_handled, - chrome_about_handler::WillHandle(url)); - EXPECT_EQ(test_data[i].browser_handled, - WillHandleBrowserAboutURL(&url, &profile)); + WillHandleBrowserAboutURL(&url, &profile); EXPECT_EQ(test_data[i].result_url, url); } - - // Crash the browser process for chrome://inducebrowsercrashforrealz. - GURL url(chrome_prefix + chrome::kChromeUIBrowserCrashHost); - EXPECT_DEATH(HandleNonNavigationAboutURL(url), ""); } diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index 4eb533d..b9a3f10 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc @@ -424,13 +424,6 @@ bool ChromeContentBrowserClient::ShouldUseProcessPerSite( return true; } -bool ChromeContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) { - return url == GURL(chrome::kChromeUICrashURL) || - url == GURL(chrome::kChromeUIKillURL) || - url == GURL(chrome::kChromeUIHangURL) || - url == GURL(chrome::kChromeUIShorthangURL); -} - bool ChromeContentBrowserClient::IsHandledURL(const GURL& url) { return ProfileIOData::IsHandledURL(url); } diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index 98545f9..0dc3bc6 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h @@ -27,7 +27,6 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { const GURL& effective_url) OVERRIDE; virtual GURL GetEffectiveURL(content::BrowserContext* browser_context, const GURL& url) OVERRIDE; - virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE; virtual bool IsHandledURL(const GURL& url) OVERRIDE; virtual bool IsSuitableHost(content::RenderProcessHost* process_host, const GURL& url) OVERRIDE; diff --git a/chrome/browser/metrics/metrics_service_uitest.cc b/chrome/browser/metrics/metrics_service_uitest.cc index a5f221f..f2f45e1 100644 --- a/chrome/browser/metrics/metrics_service_uitest.cc +++ b/chrome/browser/metrics/metrics_service_uitest.cc @@ -98,7 +98,7 @@ TEST_F(MetricsServiceTest, DISABLED_CrashRenderers) { defined(GOOGLE_CHROME_BUILD) expected_crashes_ = 1; #endif - ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL))); + ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kChromeUICrashURL))); } // Give the browser a chance to notice the crashed tab. diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index 767476b..c98d0bf 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -194,7 +194,7 @@ class TestPrerenderContents : public PrerenderContents { virtual bool AddAliasURL(const GURL& url) OVERRIDE { // Prevent FINAL_STATUS_UNSUPPORTED_SCHEME when navigating to about:crash in // the PrerenderRendererCrash test. - if (url.spec() != chrome::kAboutCrashURL) + if (url.spec() != chrome::kChromeUICrashURL) return PrerenderContents::AddAliasURL(url); return true; } @@ -1373,7 +1373,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderRendererCrash) { ASSERT_TRUE(GetPrerenderContents()->prerender_contents()); GetPrerenderContents()->prerender_contents()->web_contents()->GetController(). LoadURL( - GURL(chrome::kAboutCrashURL), + GURL(chrome::kChromeUICrashURL), content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index eb4fb39..d61768e 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc @@ -40,7 +40,6 @@ #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" -#include "chrome/common/about_handler.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_version_info.h" #include "chrome/common/jstemplate_builder.h" diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 06add7f..08362d0 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -53,8 +53,6 @@ '<(DEPTH)/webkit/support/webkit_support.gyp:glue', ], 'sources': [ - 'common/about_handler.cc', - 'common/about_handler.h', 'common/all_messages.h', 'common/attrition_experiments.h', 'common/auto_start_linux.cc', diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi index ca2cd03..0efa805 100644 --- a/chrome/chrome_renderer.gypi +++ b/chrome/chrome_renderer.gypi @@ -144,8 +144,6 @@ 'renderer/resources/extensions/types_custom_bindings.js', 'renderer/resources/extensions/web_request_custom_bindings.js', 'renderer/resources/extensions/windows_custom_bindings.js', - 'renderer/about_handler.cc', - 'renderer/about_handler.h', 'renderer/chrome_content_renderer_client.cc', 'renderer/chrome_content_renderer_client.h', 'renderer/chrome_ppapi_interfaces.cc', diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 803c428..879c87e 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -2061,7 +2061,6 @@ 'renderer/net/predictor_queue_unittest.cc', 'renderer/net/renderer_predictor_unittest.cc', 'renderer/plugins/plugin_uma_unittest.cc', - 'renderer/renderer_about_handler_unittest.cc', 'renderer/safe_browsing/features_unittest.cc', 'renderer/safe_browsing/murmurhash3_util_unittest.cc', 'renderer/safe_browsing/phishing_term_feature_extractor_unittest.cc', diff --git a/chrome/common/about_handler.cc b/chrome/common/about_handler.cc deleted file mode 100644 index fded391..0000000 --- a/chrome/common/about_handler.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/about_handler.h" -#include "chrome/common/url_constants.h" -#include "googleurl/src/gurl.h" - -namespace chrome_about_handler { - -// This needs to match up with about_urls_handlers in -// chrome/renderer/about_handler.cc. -const char* const about_urls[] = { - chrome::kChromeUICrashURL, - chrome::kChromeUIKillURL, - chrome::kChromeUIHangURL, - chrome::kChromeUIShorthangURL, - NULL, -}; -const size_t about_urls_size = arraysize(about_urls); - -bool WillHandle(const GURL& url) { - if (!url.SchemeIs(chrome::kChromeUIScheme)) - return false; - - const char* const* url_handler = about_urls; - while (*url_handler) { - if (GURL(*url_handler) == url) - return true; - url_handler++; - } - return false; -} - -} // namespace chrome_about_handler diff --git a/chrome/common/about_handler.h b/chrome/common/about_handler.h deleted file mode 100644 index 5de13ee..0000000 --- a/chrome/common/about_handler.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_COMMON_ABOUT_HANDLER_H__ -#define CHROME_COMMON_ABOUT_HANDLER_H__ -#pragma once - -#include <stddef.h> - -class GURL; - -namespace chrome_about_handler { - -extern const char* const about_urls[]; -extern const size_t about_urls_size; // Only used for testing - -// Returns true if the URL is one that AboutHandler will handle when -// AboutHandler::MaybeHandle is called. -bool WillHandle(const GURL& url); - -} // namespace chrome_about_handler - -#endif // CHROME_COMMON_ABOUT_HANDLER_H__ diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc index 2d6c9a9..7c5d96203 100644 --- a/chrome/common/url_constants.cc +++ b/chrome/common/url_constants.cc @@ -33,7 +33,6 @@ const char kChromeUICloudPrintResourcesURL[] = "chrome://cloudprintresources/"; const char kChromeUIConflictsURL[] = "chrome://conflicts/"; const char kChromeUIConstrainedHTMLTestURL[] = "chrome://constrained-test/"; const char kChromeUICrashesURL[] = "chrome://crashes/"; -const char kChromeUICrashURL[] = "chrome://crash/"; const char kChromeUICreditsURL[] = "chrome://credits/"; const char kChromeUIDevToolsURL[] = "chrome-devtools://devtools/"; const char kChromeUIDownloadsURL[] = "chrome://downloads/"; @@ -46,17 +45,12 @@ const char kChromeUIFaviconURL[] = "chrome://favicon/"; const char kChromeUIFeedbackURL[] = "chrome://feedback/"; const char kChromeUIFlagsURL[] = "chrome://flags/"; const char kChromeUIFlashURL[] = "chrome://flash/"; -const char kChromeUIGpuCleanURL[] = "chrome://gpuclean"; -const char kChromeUIGpuCrashURL[] = "chrome://gpucrash"; -const char kChromeUIGpuHangURL[] = "chrome://gpuhang"; -const char kChromeUIHangURL[] = "chrome://hang/"; const char kChromeUIHelpFrameURL[] = "chrome://help-frame/"; const char kChromeUIHistoryURL[] = "chrome://history/"; const char kChromeUIHungRendererDialogURL[] = "chrome://hung-renderer/"; const char kChromeUIInputWindowDialogURL[] = "chrome://input-window-dialog/"; const char kChromeUIIPCURL[] = "chrome://ipc/"; const char kChromeUIKeyboardURL[] = "chrome://keyboard/"; -const char kChromeUIKillURL[] = "chrome://kill/"; const char kChromeUIMemoryRedirectURL[] = "chrome://memory-redirect/"; const char kChromeUIMemoryURL[] = "chrome://memory/"; const char kChromeUINetInternalsURL[] = "chrome://net-internals/"; @@ -72,7 +66,6 @@ const char kChromeUISettingsURL[] = "chrome://settings/"; // settings-frame is the URL used to directly access the new settings page in // the UberPage, AKA options2. const char kChromeUISettingsFrameURL[] = "chrome://settings-frame/"; -const char kChromeUIShorthangURL[] = "chrome://shorthang/"; const char kChromeUISSLClientCertificateSelectorURL[] = "chrome://select-cert/"; const char kChromeUISyncPromoURL[] = "chrome://syncpromo/"; const char kChromeUITaskManagerURL[] = "chrome://tasks/"; @@ -124,7 +117,6 @@ const char kChromeUIAppCacheInternalsHost[] = "appcache-internals"; const char kChromeUIBlankHost[] = "blank"; const char kChromeUIBlobInternalsHost[] = "blob-internals"; const char kChromeUIBookmarksHost[] = "bookmarks"; -const char kChromeUIBrowserCrashHost[] = "inducebrowsercrashforrealz"; const char kChromeUICacheHost[] = "cache"; const char kChromeUICertificateViewerHost[] = "view-cert"; const char kChromeUIChromeURLsHost[] = "chrome-urls"; @@ -149,9 +141,6 @@ const char kChromeUIFaviconHost[] = "favicon"; const char kChromeUIFeedbackHost[] = "feedback"; const char kChromeUIFlagsHost[] = "flags"; const char kChromeUIFlashHost[] = "flash"; -const char kChromeUIGpuCleanHost[] = "gpuclean"; -const char kChromeUIGpuCrashHost[] = "gpucrash"; -const char kChromeUIGpuHangHost[] = "gpuhang"; const char kChromeUIGpuHost[] = "gpu"; const char kChromeUIGpuInternalsHost[] = "gpu-internals"; const char kChromeUIHangHost[] = "hang"; diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h index d2735af..637ad04 100644 --- a/chrome/common/url_constants.h +++ b/chrome/common/url_constants.h @@ -27,7 +27,6 @@ extern const char kChromeUICloudPrintResourcesURL[]; extern const char kChromeUIConflictsURL[]; extern const char kChromeUIConstrainedHTMLTestURL[]; extern const char kChromeUICrashesURL[]; -extern const char kChromeUICrashURL[]; extern const char kChromeUICreditsURL[]; extern const char kChromeUIDevToolsURL[]; extern const char kChromeUIDownloadsURL[]; @@ -40,17 +39,12 @@ extern const char kChromeUIFaviconURL[]; extern const char kChromeUIFeedbackURL[]; extern const char kChromeUIFlagsURL[]; extern const char kChromeUIFlashURL[]; -extern const char kChromeUIGpuCleanURL[]; -extern const char kChromeUIGpuCrashURL[]; -extern const char kChromeUIGpuHangURL[]; -extern const char kChromeUIHangURL[]; extern const char kChromeUIHelpFrameURL[]; extern const char kChromeUIHistoryURL[]; extern const char kChromeUIHungRendererDialogURL[]; extern const char kChromeUIInputWindowDialogURL[]; extern const char kChromeUIIPCURL[]; extern const char kChromeUIKeyboardURL[]; -extern const char kChromeUIKillURL[]; extern const char kChromeUIMemoryRedirectURL[]; extern const char kChromeUIMemoryURL[]; extern const char kChromeUINetInternalsURL[]; @@ -64,7 +58,6 @@ extern const char kChromeUIPrintURL[]; extern const char kChromeUISessionsURL[]; extern const char kChromeUISettingsURL[]; extern const char kChromeUISettingsFrameURL[]; -extern const char kChromeUIShorthangURL[]; extern const char kChromeUISSLClientCertificateSelectorURL[]; extern const char kChromeUISyncPromoURL[]; extern const char kChromeUITaskManagerURL[]; @@ -113,7 +106,6 @@ extern const char kChromeUIAppCacheInternalsHost[]; extern const char kChromeUIBlankHost[]; extern const char kChromeUIBlobInternalsHost[]; extern const char kChromeUIBookmarksHost[]; -extern const char kChromeUIBrowserCrashHost[]; extern const char kChromeUICacheHost[]; extern const char kChromeUICertificateViewerHost[]; extern const char kChromeUIChromeURLsHost[]; @@ -138,9 +130,6 @@ extern const char kChromeUIFaviconHost[]; extern const char kChromeUIFeedbackHost[]; extern const char kChromeUIFlagsHost[]; extern const char kChromeUIFlashHost[]; -extern const char kChromeUIGpuCleanHost[]; -extern const char kChromeUIGpuCrashHost[]; -extern const char kChromeUIGpuHangHost[]; extern const char kChromeUIHelpFrameHost[]; extern const char kChromeUIHelpHost[]; extern const char kChromeUIGpuHost[]; diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc index bac2301..217cfc0 100644 --- a/chrome/renderer/chrome_render_view_observer.cc +++ b/chrome/renderer/chrome_render_view_observer.cc @@ -17,7 +17,6 @@ #include "chrome/common/render_messages.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/url_constants.h" -#include "chrome/renderer/about_handler.h" #include "chrome/renderer/chrome_render_process_observer.h" #include "chrome/renderer/content_settings_observer.h" #include "chrome/renderer/extensions/extension_dispatcher.h" @@ -365,7 +364,6 @@ void ChromeRenderViewObserver::Navigate(const GURL& url) { // event (including tab reload). if (chrome_render_process_observer_) chrome_render_process_observer_->ExecutePendingClearCache(); - AboutHandler::MaybeHandle(url); } void ChromeRenderViewObserver::OnSetClientSidePhishingDetection( diff --git a/chrome/renderer/renderer_about_handler_unittest.cc b/chrome/renderer/renderer_about_handler_unittest.cc deleted file mode 100644 index 633663c..0000000 --- a/chrome/renderer/renderer_about_handler_unittest.cc +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/common/about_handler.h" -#include "chrome/renderer/about_handler.h" -#include "testing/gtest/include/gtest/gtest.h" - -// This is just to make sure the about_urls array in -// chrome/common/about_handler.cc matches up with the about_urls_handlers -// in chrome/renderer/about_handler.cc. They used to be in one array, but -// we broke them apart to break a browser <-> renderer dependency. -// We cannot test this with COMPILE_ASSERT because -// chrome/renderer/about_handler.cc doesn't know about the size of about_urls -// in chrome/common/about_handler.cc at compile time. - -TEST(RendererAboutHandlerTest, AboutUrlHandlerArray) { - ASSERT_EQ(chrome_about_handler::about_urls_size, - AboutHandler::AboutURLHandlerSize()); -} diff --git a/chrome/test/reliability/automated_ui_tests.cc b/chrome/test/reliability/automated_ui_tests.cc index 4b30bbc..7710f73 100644 --- a/chrome/test/reliability/automated_ui_tests.cc +++ b/chrome/test/reliability/automated_ui_tests.cc @@ -670,7 +670,7 @@ bool AutomatedUITest::FuzzyTestDialog(int num_actions) { bool AutomatedUITest::ForceCrash() { scoped_refptr<TabProxy> tab(GetActiveTab()); - GURL test_url(chrome::kAboutCrashURL); + GURL test_url(chrome::kChromeUICrashURL); AutomationMsg_NavigationResponseValues result = tab->NavigateToURL(test_url); if (result != AUTOMATION_MSG_NAVIGATION_SUCCESS) { AddErrorAttribute("navigation_failed"); diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc index 48160ac..d6454f6 100644 --- a/chrome/test/reliability/page_load_test.cc +++ b/chrome/test/reliability/page_load_test.cc @@ -505,7 +505,7 @@ class PageLoadTest : public UITest { EXPECT_EQ(0, metrics.plugin_crash_count); // Go to "about:crash" - NavigateToURLLogResult(chrome::kAboutCrashURL, + NavigateToURLLogResult(chrome::kChromeUICrashURL, log_file, &metrics, g_continuous_load, diff --git a/content/browser/browser_url_handler.cc b/content/browser/browser_url_handler.cc index c42024d..8bcb2d6 100644 --- a/content/browser/browser_url_handler.cc +++ b/content/browser/browser_url_handler.cc @@ -59,6 +59,15 @@ static bool ReverseViewSource(GURL* url, return true; } +static bool HandleDebugUrl(GURL* url, + content::BrowserContext* browser_context) { + // Circumvent processing URLs that the renderer process will handle. + return *url == GURL(chrome::kChromeUICrashURL) || + *url == GURL(chrome::kChromeUIHangURL) || + *url == GURL(chrome::kChromeUIKillURL) || + *url == GURL(chrome::kChromeUIShorthangURL); +} + // static BrowserURLHandler* BrowserURLHandler::GetInstance() { return Singleton<BrowserURLHandler>::get(); @@ -77,6 +86,8 @@ BrowserURLHandler::URLHandler BrowserURLHandler::null_handler() { } BrowserURLHandler::BrowserURLHandler() { + AddHandlerPair(&HandleDebugUrl, BrowserURLHandler::null_handler()); + content::GetContentClient()->browser()->BrowserURLHandlerCreated(this); // view-source: diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc index 032978f..02ebfa2 100644 --- a/content/browser/child_process_security_policy_unittest.cc +++ b/content/browser/child_process_security_policy_unittest.cc @@ -163,18 +163,9 @@ TEST_F(ChildProcessSecurityPolicyTest, AboutTest) { EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:CrASh"))); EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("abOuT:cAChe"))); - // These requests for about: pages should be denied. - p->GrantRequestURL(kRendererID, GURL(chrome::kTestGpuCleanURL)); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kTestGpuCleanURL))); - - p->GrantRequestURL(kRendererID, GURL(chrome::kAboutCrashURL)); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kAboutCrashURL))); - - p->GrantRequestURL(kRendererID, GURL(chrome::kTestCacheURL)); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kTestCacheURL))); - - p->GrantRequestURL(kRendererID, GURL(chrome::kTestHangURL)); - EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kTestHangURL))); + // Requests for about: pages should be denied. + p->GrantRequestURL(kRendererID, GURL("about:crash")); + EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:crash"))); // These requests for chrome:// pages should be granted. p->GrantRequestURL(kRendererID, GURL(chrome::kTestNewTabURL)); diff --git a/content/browser/mock_content_browser_client.cc b/content/browser/mock_content_browser_client.cc index 6b6bb9d..d5b8547 100644 --- a/content/browser/mock_content_browser_client.cc +++ b/content/browser/mock_content_browser_client.cc @@ -53,10 +53,6 @@ bool MockContentBrowserClient::ShouldUseProcessPerSite( return false; } -bool MockContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) { - return false; -} - bool MockContentBrowserClient::IsHandledURL(const GURL& url) { return false; } diff --git a/content/browser/mock_content_browser_client.h b/content/browser/mock_content_browser_client.h index f0a960f..4a0aaf3 100644 --- a/content/browser/mock_content_browser_client.h +++ b/content/browser/mock_content_browser_client.h @@ -34,7 +34,6 @@ class MockContentBrowserClient : public ContentBrowserClient { const GURL& url) OVERRIDE; virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context, const GURL& effective_url) OVERRIDE; - virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE; virtual bool IsHandledURL(const GURL& url) OVERRIDE; virtual bool IsSuitableHost(RenderProcessHost* process_host, const GURL& site_url) OVERRIDE; diff --git a/content/browser/renderer_host/resource_dispatcher_host_uitest.cc b/content/browser/renderer_host/resource_dispatcher_host_uitest.cc index 8fbb16d..a049b37 100644 --- a/content/browser/renderer_host/resource_dispatcher_host_uitest.cc +++ b/content/browser/renderer_host/resource_dispatcher_host_uitest.cc @@ -285,7 +285,7 @@ TEST_F(ResourceDispatcherTest, FAILS_CrossSiteAfterCrash) { #if defined(OS_WIN) || defined(USE_LINUX_BREAKPAD) expected_crashes_ = 1; #endif - ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL))); + ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kChromeUICrashURL))); // Wait for browser to notice the renderer crash. base::PlatformThread::Sleep(TestTimeouts::action_timeout()); diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc index feb5402..1212c17 100644 --- a/content/browser/site_instance_impl.cc +++ b/content/browser/site_instance_impl.cc @@ -27,8 +27,10 @@ static bool IsURLSameAsAnySiteInstance(const GURL& url) { if (url.SchemeIs(chrome::kJavaScriptScheme)) return true; - return - content::GetContentClient()->browser()->IsURLSameAsAnySiteInstance(url); + return url == GURL(chrome::kChromeUICrashURL) || + url == GURL(chrome::kChromeUIKillURL) || + url == GURL(chrome::kChromeUIHangURL) || + url == GURL(chrome::kChromeUIShorthangURL); } int32 SiteInstanceImpl::next_site_instance_id_ = 1; diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc index 77ae33c..c04b819 100644 --- a/content/browser/site_instance_impl_unittest.cc +++ b/content/browser/site_instance_impl_unittest.cc @@ -82,11 +82,6 @@ class SiteInstanceTestBrowserClient : public content::MockContentBrowserClient { return false; } - virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE { - return url == GURL(kSameAsAnyInstanceURL) || - url == GURL(chrome::kAboutCrashURL); - } - virtual bool IsSuitableHost(content::RenderProcessHost* process_host, const GURL& site_url) OVERRIDE { return (privileged_process_id_ == process_host->GetID()) == @@ -366,8 +361,6 @@ TEST_F(SiteInstanceTest, IsSameWebSite) { GURL url_foo_https = GURL("https://foo/a.html"); GURL url_foo_port = GURL("http://foo:8080/a.html"); GURL url_javascript = GURL("javascript:alert(1);"); - GURL url_crash = GURL(chrome::kAboutCrashURL); - GURL url_browser_specified = GURL(kSameAsAnyInstanceURL); // Same scheme and port -> same site. EXPECT_TRUE(SiteInstance::IsSameWebSite(NULL, url_foo, url_foo2)); @@ -383,12 +376,6 @@ TEST_F(SiteInstanceTest, IsSameWebSite) { EXPECT_TRUE(SiteInstance::IsSameWebSite(NULL, url_javascript, url_foo)); EXPECT_TRUE(SiteInstance::IsSameWebSite(NULL, url_javascript, url_foo_https)); EXPECT_TRUE(SiteInstance::IsSameWebSite(NULL, url_javascript, url_foo_port)); - - // The URLs specified by the ContentBrowserClient should also be treated as - // same site. - EXPECT_TRUE(SiteInstance::IsSameWebSite(NULL, url_crash, url_foo)); - EXPECT_TRUE(SiteInstance::IsSameWebSite(NULL, url_browser_specified, - url_foo)); } // Test to ensure that there is only one SiteInstance per site in a given diff --git a/content/browser/tab_contents/debug_urls.cc b/content/browser/tab_contents/debug_urls.cc new file mode 100644 index 0000000..17d4403 --- /dev/null +++ b/content/browser/tab_contents/debug_urls.cc @@ -0,0 +1,50 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/browser/tab_contents/debug_urls.h" + +#include "content/browser/gpu/gpu_process_host_ui_shim.h" +#include "content/public/common/url_constants.h" +#include "googleurl/src/gurl.h" + +namespace content { + +bool HandleDebugURL(const GURL& url, content::PageTransition transition) { + content::PageTransition base_transition = + content::PageTransitionStripQualifier(transition); + if (base_transition != content::PAGE_TRANSITION_TYPED) + return false; + + // Handle URLs to crash the browser or wreck the gpu process. + if (url.host() == chrome::kChromeUIBrowserCrashHost) { + // Induce an intentional crash in the browser process. + CHECK(false); + return true; + } + + if (url == GURL(chrome::kChromeUIGpuCleanURL)) { + GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); + if (shim) + shim->SimulateRemoveAllContext(); + return true; + } + + if (url == GURL(chrome::kChromeUIGpuCrashURL)) { + GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); + if (shim) + shim->SimulateCrash(); + return true; + } + + if (url == GURL(chrome::kChromeUIGpuHangURL)) { + GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); + if (shim) + shim->SimulateHang(); + return true; + } + + return false; +} + +} // namespace content diff --git a/content/browser/tab_contents/debug_urls.h b/content/browser/tab_contents/debug_urls.h new file mode 100644 index 0000000..a54a056 --- /dev/null +++ b/content/browser/tab_contents/debug_urls.h @@ -0,0 +1,21 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_BROWSER_TAB_CONTENTS_DEBUG_URLS_H_ +#define CONTENT_BROWSER_TAB_CONTENTS_DEBUG_URLS_H_ +#pragma once + +#include "content/public/common/page_transition_types.h" + +class GURL; + +namespace content { + +// Checks if the given url is a url used for debugging purposes, and if so +// handles it and returns true. +bool HandleDebugURL(const GURL& url, content::PageTransition transition); + +} // namespace content + +#endif // CONTENT_BROWSER_TAB_CONTENTS_DEBUG_URLS_H_ diff --git a/content/browser/tab_contents/navigation_controller_impl.cc b/content/browser/tab_contents/navigation_controller_impl.cc index a7baf9f..eba3157 100644 --- a/content/browser/tab_contents/navigation_controller_impl.cc +++ b/content/browser/tab_contents/navigation_controller_impl.cc @@ -15,6 +15,7 @@ #include "content/browser/in_process_webkit/session_storage_namespace.h" #include "content/browser/renderer_host/render_view_host.h" // Temporary #include "content/browser/site_instance_impl.h" +#include "content/browser/tab_contents/debug_urls.h" #include "content/browser/tab_contents/interstitial_page.h" #include "content/browser/tab_contents/navigation_entry_impl.h" #include "content/browser/tab_contents/tab_contents.h" @@ -565,6 +566,9 @@ void NavigationControllerImpl::LoadURL( const content::Referrer& referrer, content::PageTransition transition, const std::string& extra_headers) { + if (content::HandleDebugURL(url, transition)) + return; + // The user initiated a load, we don't need to reload anymore. needs_reload_ = false; diff --git a/content/common/test_url_constants.cc b/content/common/test_url_constants.cc index 9777124..49a4826 100644 --- a/content/common/test_url_constants.cc +++ b/content/common/test_url_constants.cc @@ -7,8 +7,6 @@ namespace chrome { const char kTestCacheURL[] = "about:cache"; -const char kTestHangURL[] = "about:hang"; -const char kTestGpuCleanURL[] = "about:gpuclean"; const char kTestNewTabURL[] = "chrome://newtab"; const char kTestHistoryURL[] = "chrome://history/"; const char kTestBookmarksURL[] = "chrome://bookmarks/"; diff --git a/content/common/test_url_constants.h b/content/common/test_url_constants.h index 71f9d2d..b04ace0 100644 --- a/content/common/test_url_constants.h +++ b/content/common/test_url_constants.h @@ -18,10 +18,6 @@ namespace chrome { // Various URLs used in security policy testing. extern const char kTestCacheURL[]; -extern const char kTestHangURL[]; - -// One of the few about pages that is not a WebUI page. -extern const char kTestGpuCleanURL[]; // The NTP is assumed in several tests to have the property that it is WebUI. extern const char kTestNewTabURL[]; diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 729bfc3..bdbbf88 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -621,6 +621,8 @@ 'browser/system_message_window_win.h', 'browser/tab_contents/drag_utils_gtk.cc', 'browser/tab_contents/drag_utils_gtk.h', + 'browser/tab_contents/debug_urls.cc', + 'browser/tab_contents/debug_urls.h', 'browser/tab_contents/interstitial_page.cc', 'browser/tab_contents/interstitial_page.h', 'browser/tab_contents/navigation_controller_impl.cc', diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index 3ffb71c..3c2fe1a 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -110,10 +110,6 @@ class ContentBrowserClient { virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context, const GURL& effective_url) = 0; - // Returns whether a specified URL is to be considered the same as any - // SiteInstance. - virtual bool IsURLSameAsAnySiteInstance(const GURL& url) = 0; - // Returns whether a specified URL is handled by the embedder's internal // protocol handlers. virtual bool IsHandledURL(const GURL& url) = 0; diff --git a/content/public/common/url_constants.cc b/content/public/common/url_constants.cc index 2c046d4..30f8ec3 100644 --- a/content/public/common/url_constants.cc +++ b/content/public/common/url_constants.cc @@ -44,7 +44,14 @@ const char kViewSourceScheme[] = "view-source"; const char kStandardSchemeSeparator[] = "://"; const char kAboutBlankURL[] = "about:blank"; -const char kAboutCrashURL[] = "about:crash"; +const char kChromeUIBrowserCrashHost[] = "inducebrowsercrashforrealz"; +const char kChromeUICrashURL[] = "chrome://crash/"; +const char kChromeUIGpuCleanURL[] = "chrome://gpuclean"; +const char kChromeUIGpuCrashURL[] = "chrome://gpucrash"; +const char kChromeUIGpuHangURL[] = "chrome://gpuhang"; +const char kChromeUIHangURL[] = "chrome://hang/"; +const char kChromeUIKillURL[] = "chrome://kill/"; +const char kChromeUIShorthangURL[] = "chrome://shorthang/"; const char kUnreachableWebDataURL[] = "chrome://chromewebdata/"; diff --git a/content/public/common/url_constants.h b/content/public/common/url_constants.h index 2c02972..cf910c0 100644 --- a/content/public/common/url_constants.h +++ b/content/public/common/url_constants.h @@ -10,6 +10,7 @@ #include "content/common/content_export.h" +// TODO(jam): rename this to content. namespace chrome { // Null terminated list of schemes that are savable. This function can be @@ -41,7 +42,14 @@ CONTENT_EXPORT extern const char kStandardSchemeSeparator[]; // About URLs (including schemes). CONTENT_EXPORT extern const char kAboutBlankURL[]; -CONTENT_EXPORT extern const char kAboutCrashURL[]; +CONTENT_EXPORT extern const char kChromeUIBrowserCrashHost[]; +CONTENT_EXPORT extern const char kChromeUICrashURL[]; +CONTENT_EXPORT extern const char kChromeUIGpuCleanURL[]; +CONTENT_EXPORT extern const char kChromeUIGpuCrashURL[]; +CONTENT_EXPORT extern const char kChromeUIGpuHangURL[]; +CONTENT_EXPORT extern const char kChromeUIHangURL[]; +CONTENT_EXPORT extern const char kChromeUIKillURL[]; +CONTENT_EXPORT extern const char kChromeUIShorthangURL[]; // Special URL used to start a navigation to an error page. extern const char kUnreachableWebDataURL[]; diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index 2194dd13..9214d7a 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -325,6 +325,29 @@ static WebReferrerPolicy getReferrerPolicyFromRequest( WebKit::WebReferrerPolicyDefault; } +static void MaybeHandleDebugURL(const GURL& url) { + if (!url.SchemeIs(chrome::kChromeUIScheme)) + return; + if (url == GURL(chrome::kChromeUICrashURL)) { + // NOTE(shess): Crash directly rather than using NOTREACHED() so + // that the signature is easier to triage in crash reports. + volatile int* zero = NULL; + *zero = 0; + + // Just in case the compiler decides the above is undefined and + // optimizes it away. + NOTREACHED(); + } else if (url == GURL(chrome::kChromeUIKillURL)) { + base::KillProcess(base::GetCurrentProcessHandle(), 1, false); + } else if (url == GURL(chrome::kChromeUIHangURL)) { + for (;;) { + base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); + } + } else if (url == GURL(chrome::kChromeUIShorthangURL)) { + base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); + } +} + /////////////////////////////////////////////////////////////////////////////// struct RenderViewImpl::PendingFileChooser { @@ -791,6 +814,7 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) { } void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { + MaybeHandleDebugURL(params.url); if (!webview()) return; diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc index 27019aa..b8dfbcd 100644 --- a/content/shell/shell_content_browser_client.cc +++ b/content/shell/shell_content_browser_client.cc @@ -75,10 +75,6 @@ bool ShellContentBrowserClient::ShouldUseProcessPerSite( return false; } -bool ShellContentBrowserClient::IsURLSameAsAnySiteInstance(const GURL& url) { - return false; -} - bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { return false; } diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h index eeaf5ac..4d265f2 100644 --- a/content/shell/shell_content_browser_client.h +++ b/content/shell/shell_content_browser_client.h @@ -38,7 +38,6 @@ class ShellContentBrowserClient : public ContentBrowserClient { const GURL& url) OVERRIDE; virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context, const GURL& effective_url) OVERRIDE; - virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE; virtual bool IsHandledURL(const GURL& url) OVERRIDE; virtual bool IsSuitableHost(RenderProcessHost* process_host, const GURL& site_url) OVERRIDE; |