Commit 90fbfe18 authored by shinyak@google.com's avatar shinyak@google.com

New windows opened in javascript with target = "_blank" should

have an empty name. 

BUG=88129
TEST=InProcessRenderViewBrowserTest::*


Review URL: http://codereview.chromium.org/7497058

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98946 0039d316-1c4b-4281-b951-d872f2087c98
parent 52a4afa3
<!DOCTYPE html>
<html>
<head>
<title>88129</title>
<script>
function openWindow1() {
var name = window.open('window.open.blank.html', 'blank').name;
window.domAutomationController.send(name);
}
function openWindow2() {
var name = window.open('window.open.blank.html', '_blank').name;
window.domAutomationController.send(name);
}
</script>
</head>
<body>
<h1>88129</h1>
</body>
</html>
...@@ -50,7 +50,9 @@ class ExecuteNotificationObserver : public NotificationObserver { ...@@ -50,7 +50,9 @@ class ExecuteNotificationObserver : public NotificationObserver {
class RenderViewHostTest : public InProcessBrowserTest { class RenderViewHostTest : public InProcessBrowserTest {
public: public:
RenderViewHostTest() : last_execute_id_(0) {} RenderViewHostTest() : last_execute_id_(0) {
EnableDOMAutomation();
}
void ExecuteJavascriptAndGetValue(const char* script, void ExecuteJavascriptAndGetValue(const char* script,
ExecuteNotificationObserver* out_result) { ExecuteNotificationObserver* out_result) {
...@@ -71,6 +73,17 @@ class RenderViewHostTest : public InProcessBrowserTest { ...@@ -71,6 +73,17 @@ class RenderViewHostTest : public InProcessBrowserTest {
last_execute_id_ = execute_id; last_execute_id_ = execute_id;
} }
protected:
bool GetCreatedWindowName(const GURL& url,
const wchar_t* function,
std::string* window_name) {
ui_test_utils::NavigateToURL(browser(), url);
return ui_test_utils::ExecuteJavaScriptAndExtractString(
browser()->GetSelectedTabContents()->render_view_host(),
L"", function, window_name);
}
private: private:
int last_execute_id_; int last_execute_id_;
}; };
...@@ -235,7 +248,7 @@ class RenderViewHostTestTabContentsObserver : public TabContentsObserver { ...@@ -235,7 +248,7 @@ class RenderViewHostTestTabContentsObserver : public TabContentsObserver {
IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) { IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) {
ASSERT_TRUE(test_server()->Start()); ASSERT_TRUE(test_server()->Start());
RenderViewHostTestTabContentsObserver observer( RenderViewHostTestTabContentsObserver observer(
browser()->GetSelectedTabContents()); browser()->GetSelectedTabContents());
GURL test_url = test_server()->GetURL("files/simple.html"); GURL test_url = test_server()->GetURL("files/simple.html");
ui_test_utils::NavigateToURL(browser(), test_url); ui_test_utils::NavigateToURL(browser(), test_url);
...@@ -244,3 +257,25 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) { ...@@ -244,3 +257,25 @@ IN_PROC_BROWSER_TEST_F(RenderViewHostTest, FrameNavigateSocketAddress) {
observer.observed_socket_address().ToString()); observer.observed_socket_address().ToString());
EXPECT_EQ(1, observer.navigation_count()); EXPECT_EQ(1, observer.navigation_count());
} }
// Regression test for http://crbug.com/88129
IN_PROC_BROWSER_TEST_F(RenderViewHostTest, WindowOpen1) {
ASSERT_TRUE(test_server()->Start());
GURL url(test_server()->GetURL("files/window.open.blank.html"));
std::string window_name;
ASSERT_TRUE(GetCreatedWindowName(url, L"openWindow1();", &window_name));
EXPECT_EQ(window_name, "blank") << "Actual Window Name: " << window_name;
}
// Regression test for http://crbug.com/88129
IN_PROC_BROWSER_TEST_F(RenderViewHostTest, WindowOpen2) {
ASSERT_TRUE(test_server()->Start());
GURL url(test_server()->GetURL("files/window.open.blank.html"));
std::string window_name;
ASSERT_TRUE(GetCreatedWindowName(url, L"openWindow2();", &window_name));
EXPECT_EQ(window_name, "") << "Actual Window Name: " << window_name;
}
...@@ -405,8 +405,6 @@ RenderView::RenderView(RenderThreadBase* render_thread, ...@@ -405,8 +405,6 @@ RenderView::RenderView(RenderThreadBase* render_thread,
g_view_map.Get().insert(std::make_pair(webview(), this)); g_view_map.Get().insert(std::make_pair(webview(), this));
webkit_preferences_.Apply(webview()); webkit_preferences_.Apply(webview());
webview()->initializeMainFrame(this); webview()->initializeMainFrame(this);
if (!frame_name.empty())
webview()->mainFrame()->setName(frame_name);
webview()->settings()->setMinimumTimerInterval( webview()->settings()->setMinimumTimerInterval(
is_hidden() ? webkit_glue::kBackgroundTabTimerInterval : is_hidden() ? webkit_glue::kBackgroundTabTimerInterval :
webkit_glue::kForegroundTabTimerInterval); webkit_glue::kForegroundTabTimerInterval);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment