diff options
author | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-30 16:29:56 +0000 |
---|---|---|
committer | rafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-30 16:29:56 +0000 |
commit | 5c7c19d83d201fa23d5097cce108c033ece5c63b (patch) | |
tree | d6f21e73962eda73fa274b6390b22458435c4ebd | |
parent | b9f934e6a60e8d55820a12cfb88af153458fbb7d (diff) | |
download | chromium_src-5c7c19d83d201fa23d5097cce108c033ece5c63b.zip chromium_src-5c7c19d83d201fa23d5097cce108c033ece5c63b.tar.gz chromium_src-5c7c19d83d201fa23d5097cce108c033ece5c63b.tar.bz2 |
Fixes issue where dragging a .crx to a chrome:// TabContents, and then navigating to another chrome:// url, the destination DOMUI won't be able to retrieve the data it needs (and thus not function)
BUG=14505
R=brettw
Review URL: http://codereview.chromium.org/132009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19594 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_resources.grd | 2 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_view_host_manager.cc | 13 | ||||
-rwxr-xr-x | chrome/browser/renderer_host/render_view_host_manager_browsertest.cc | 47 | ||||
-rw-r--r-- | chrome/browser/resources/extensions_ui.html | 6 | ||||
-rw-r--r-- | chrome/chrome.gyp | 1 |
5 files changed, 63 insertions, 6 deletions
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index e8938c4..a43bc82 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- This comment is only here because changes to resources are not picked up -without changes to the corresponding grd file. --> +without changes to the corresponding grd file. --> <grit latest_public_release="0" current_release="1"> <outputs> <output filename="grit/browser_resources.h" type="rc_header"> diff --git a/chrome/browser/renderer_host/render_view_host_manager.cc b/chrome/browser/renderer_host/render_view_host_manager.cc index 90548cf..c0be053 100644 --- a/chrome/browser/renderer_host/render_view_host_manager.cc +++ b/chrome/browser/renderer_host/render_view_host_manager.cc @@ -65,11 +65,6 @@ void RenderViewHostManager::Init(Profile* profile, } RenderViewHost* RenderViewHostManager::Navigate(const NavigationEntry& entry) { - // This will possibly create (set to NULL) a DOM UI object for the pending - // page. We'll use this later to give the page special access. This must - // happen before the new renderer is created below so it will get bindings. - pending_dom_ui_.reset(delegate_->CreateDOMUIForRenderManager(entry.url())); - // Create a pending RenderViewHost. It will give us the one we should use RenderViewHost* dest_render_view_host = UpdateRendererStateForNavigate(entry); if (!dest_render_view_host) @@ -493,6 +488,14 @@ RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate( cross_navigation_pending_ = false; } + // This will possibly create (set to NULL) a DOM UI object for the pending + // page. We'll use this later to give the page special access. This must + // happen before the new renderer is created below so it will get bindings. + // It must also happen after the above conditional call to CancelPending(), + // otherwise CancelPending may clear the pending_dom_ui_ and the page will + // not have it's bindings set appropriately. + pending_dom_ui_.reset(delegate_->CreateDOMUIForRenderManager(entry.url())); + // render_view_host_ will not be deleted before the end of this method, so we // don't have to worry about this SiteInstance's ref count dropping to zero. SiteInstance* curr_instance = render_view_host_->site_instance(); diff --git a/chrome/browser/renderer_host/render_view_host_manager_browsertest.cc b/chrome/browser/renderer_host/render_view_host_manager_browsertest.cc new file mode 100755 index 0000000..a0fb805 --- /dev/null +++ b/chrome/browser/renderer_host/render_view_host_manager_browsertest.cc @@ -0,0 +1,47 @@ +// Copyright (c) 2009 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/browser/browser.h" +#include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/common/extensions/extension_error_reporter.h" +#include "chrome/test/in_process_browser_test.h" +#include "chrome/test/ui_test_utils.h" +#include "net/base/net_util.h" + +class RenderViewHostManagerTest : public InProcessBrowserTest { + public: + RenderViewHostManagerTest() { + EnableDOMAutomation(); + } + virtual void SetUpCommandLine(CommandLine* command_line) { + command_line->AppendSwitch(switches::kEnableExtensions); + } +}; + +// Test for crbug.com/14505. This tests that chrome:// urls are still functional +// after download of a file while viewing another chrome://. +IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ChromeURLAfterDownload) { + GURL downloads_url("chrome://downloads"); + GURL extensions_url("chrome://extensions"); + FilePath zip_download; + ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &zip_download)); + zip_download = zip_download.AppendASCII("zip").AppendASCII("test.zip"); + GURL zip_url = net::FilePathToFileURL(zip_download); + + ui_test_utils::NavigateToURL(browser(), downloads_url); + ui_test_utils::NavigateToURL(browser(), zip_url); + ui_test_utils::NavigateToURL(browser(), extensions_url); + + TabContents *contents = browser()->GetSelectedTabContents(); + ASSERT_TRUE(contents); + bool domui_responded = false; + EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( + contents, + L"", + L"window.domAutomationController.send(window.domui_responded_);", + &domui_responded)); + EXPECT_TRUE(domui_responded); +} diff --git a/chrome/browser/resources/extensions_ui.html b/chrome/browser/resources/extensions_ui.html index 9893741..d2f3ec8 100644 --- a/chrome/browser/resources/extensions_ui.html +++ b/chrome/browser/resources/extensions_ui.html @@ -97,7 +97,13 @@ function showExtensionsData(extensionsData) { function requestExtensionsData() { chrome.send("requestExtensionsData", []); } + +// Used for observing function of the backend datasource for this page by +// tests. +window.domui_responded_ = false; + function returnExtensionsData(extensionsData) { + window.domui_responded_ = true; showExtensionsData(extensionsData); // We are currently hiding the body because the first call to jstProcess() to diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index c5011db..fe52fcf 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -31,6 +31,7 @@ # TODO(jam): http://crbug.com/15101 These tests fail on Linux and Mac. 'browser/child_process_security_policy_browser_test.cc', 'browser/renderer_host/web_cache_manager_browser_test.cc', + 'browser/renderer_host/render_view_host_manager_browsertest.cc', # TODO(jcampan): once the task manager works on Mac, move this test to the # non win specific section. 'browser/task_manager_browsertest.cc', |