Commit 561da39a authored by satorux's avatar satorux Committed by Commit bot

chromeos: Remove blanket file access logic from chromeos chrome on Linux

crrev.com/472352 removed kTestType conditional from ChromeNetworkDelegate
for Chrome OS, but this change adds it back, and instead remove blanket file
access logic based on IsRunningOnChromeOS().

This blanket file access logic was problematic when it comes to write an end-to-end
browser test that ensures access control of file: scheme is working correctly
(i.e. with this logic, browser_tests for Chrome OS that runs on Linux desktop can
access to any files).

If you need to load your files with Chrome for Chrome OS on Linux
desktop [1], please place these files under /tmp, that's white listed
in ChromeNetworkDelegate::IsAccessAllowed().

[1] This build config is for development only, not for production.

BUG=677933
TEST=access to file:///tmp is allowed on Linux desktop, but file:/// is not

Review-Url: https://codereview.chromium.org/2890123004
Cr-Commit-Position: refs/heads/master@{#473821}
parent a7e8c1c7
...@@ -450,9 +450,9 @@ bool ChromeNetworkDelegate::OnCanSetCookie(const net::URLRequest& request, ...@@ -450,9 +450,9 @@ bool ChromeNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request, bool ChromeNetworkDelegate::OnCanAccessFile(const net::URLRequest& request,
const base::FilePath& path) const { const base::FilePath& path) const {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// If we're running Chrome for ChromeOS on Linux, we want to allow file // browser_tests and interactive_ui_tests rely on the ability to open any
// access. This is checked here to make IsAccessAllowed() unit-testable. // files via file: scheme.
if (!base::SysInfo::IsRunningOnChromeOS()) if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType))
return true; return true;
#endif #endif
......
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