Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1295)

Unified Diff: content/browser/frame_host/render_frame_host_manager_browsertest.cc

Issue 2151323003: Add a check for mismatching URL and origin in the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test to exercise allow_universal_access_from_file_urls Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/render_frame_host_manager_browsertest.cc
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
index 23a249db2ce61e8744e0c9ab861297bd60b6b4eb..b85907a07823f235e489a02ef68596cfda3ffe80 100644
--- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc
+++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -41,6 +41,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/page_state.h"
#include "content/public/common/url_constants.h"
+#include "content/public/common/web_preferences.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
@@ -2802,4 +2803,26 @@ IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
EXPECT_EQ(title, entry->GetTitle());
}
+// Ensure that document hosted on file: URL can successfully execute pushState
+// with arbitrary origin, when universal access setting is enabled.
+IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest,
+ EnsureUniversalAccessFromFileSchemeSucceeds) {
+ StartEmbeddedServer();
+ WebContentsImpl* web_contents =
+ static_cast<WebContentsImpl*>(shell()->web_contents());
+ FrameTreeNode* root = web_contents->GetFrameTree()->root();
+
+ WebPreferences prefs =
+ web_contents->GetRenderViewHost()->GetWebkitPreferences();
+ prefs.allow_universal_access_from_file_urls = true;
+ web_contents->GetRenderViewHost()->UpdateWebkitPreferences(prefs);
+
+ GURL file_url = GetTestUrl("", "title1.html");
+ ASSERT_TRUE(NavigateToURL(shell(), file_url));
+ EXPECT_EQ(1, web_contents->GetController().GetEntryCount());
+ EXPECT_TRUE(ExecuteScript(
+ root, "window.history.pushState({}, '', 'https://chromium.org');"));
+ EXPECT_EQ(2, web_contents->GetController().GetEntryCount());
Charlie Reis 2016/07/15 22:30:40 Maybe verify that the renderer process is still li
nasko 2016/07/15 22:35:54 Done.
+}
+
} // namespace content
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698