[Extensions] Update navigations across hypothetical extension extents
Update code to treat navigations across hypothetical extension extents
(e.g. for nonexistent extensions) the same as we do for navigations
crossing installed extension extents.
Bug: 598265
Change-Id: Ibdf2f563ce1fd108ead279077901020a24de732b
Reviewed-on: https://chromium-review.googlesource.com/617180
Commit-Queue: Devlin <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Reviewed-by: Nasko Oskov <[email protected]>
Cr-Commit-Position: refs/heads/master@{#495779}
diff --git a/chrome/browser/extensions/window_open_apitest.cc b/chrome/browser/extensions/window_open_apitest.cc
index 3f6bf2e0..86af3e2 100644
--- a/chrome/browser/extensions/window_open_apitest.cc
+++ b/chrome/browser/extensions/window_open_apitest.cc
@@ -246,7 +246,7 @@
WebContents* newtab = NULL;
ASSERT_NO_FATAL_FAILURE(
OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(),
- start_url.Resolve("newtab.html"), true, &newtab));
+ start_url.Resolve("newtab.html"), true, true, &newtab));
bool result = false;
ASSERT_TRUE(content::ExecuteScriptAndExtractBool(newtab, "testExtensionApi()",
@@ -264,25 +264,15 @@
GURL start_url = extension->GetResourceURL("/test.html");
ui_test_utils::NavigateToURL(browser(), start_url);
WebContents* newtab = nullptr;
- bool expect_error_page_in_new_process =
- content::IsBrowserSideNavigationEnabled();
+ bool new_page_in_same_process = true;
+ bool expect_success = false;
ASSERT_NO_FATAL_FAILURE(OpenWindow(
browser()->tab_strip_model()->GetActiveWebContents(),
GURL("chrome-extension://thisissurelynotavalidextensionid/newtab.html"),
- expect_error_page_in_new_process, &newtab));
+ new_page_in_same_process, expect_success, &newtab));
- // This is expected to commit an error page.
- ASSERT_EQ(content::PAGE_TYPE_ERROR,
- newtab->GetController().GetLastCommittedEntry()->GetPageType());
-
- std::string document_body;
- EXPECT_TRUE(content::ExecuteScriptAndExtractString(
- newtab, "domAutomationController.send(document.body.innerText.trim());",
- &document_body));
-
- EXPECT_TRUE(base::StartsWith(document_body,
- "thisissurelynotavalidextensionid is blocked",
- base::CompareCase::SENSITIVE));
+ // This is expected to redirect to about:blank.
+ EXPECT_EQ(GURL(url::kAboutBlankURL), newtab->GetLastCommittedURL());
}
// Tests that calling window.open from the newtab page to an extension URL
@@ -298,10 +288,9 @@
ASSERT_NO_FATAL_FAILURE(
OpenWindow(browser()->tab_strip_model()->GetActiveWebContents(),
GURL(std::string(extensions::kExtensionScheme) +
- url::kStandardSchemeSeparator +
- last_loaded_extension_id() + "/newtab.html"),
- false,
- &newtab));
+ url::kStandardSchemeSeparator +
+ last_loaded_extension_id() + "/newtab.html"),
+ false, true, &newtab));
// Extension API should succeed.
bool result = false;