summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/tab_contents/render_view_host_delegate_helper.cc2
-rw-r--r--chrome/common/chrome_switches.cc4
-rw-r--r--chrome/common/chrome_switches.h1
-rw-r--r--chrome/common/render_messages.h2
-rw-r--r--webkit/glue/webpreferences.cc1
-rw-r--r--webkit/glue/webpreferences.h2
-rw-r--r--webkit/tools/test_shell/layout_test_controller.cc11
-rw-r--r--webkit/tools/test_shell/layout_test_controller.h1
-rw-r--r--webkit/tools/test_shell/test_shell.cc1
9 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
index 7ce522d..9b3be5d 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -188,6 +188,8 @@ WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs(
!command_line.HasSwitch(switches::kDisableSiteSpecificQuirks);
web_prefs.geolocation_enabled =
command_line.HasSwitch(switches::kEnableGeolocation);
+ web_prefs.allow_file_access_from_file_urls =
+ command_line.HasSwitch(switches::kAllowFileAccessFromFiles);
}
web_prefs.uses_universal_detector =
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 54453ec..f5f5663 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -17,6 +17,10 @@ namespace switches {
// is launched on the command line (e.g. by Selenium). Only needed on Mac.
const char kActivateOnLaunch[] = "activate-on-launch";
+// By default, file:/// URIs cannot read other file:/// URIs. This is an
+// override for developers who need the old behavior for testing.
+const char kAllowFileAccessFromFiles[] = "allow-file-access-from-files";
+
// Allows debugging of sandboxed processes (see zygote_main_linux.cc).
const char kAllowSandboxDebugging[] = "allow-sandbox-debugging";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index e50d5e8..fe61aa5 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -20,6 +20,7 @@ namespace switches {
// All switches in alphabetical order. The switches should be documented
// alongside the definition of their values in the .cc file.
extern const char kActivateOnLaunch[];
+extern const char kAllowFileAccessFromFiles[];
extern const char kAllowSandboxDebugging[];
extern const char kAlwaysEnableDevTools[];
extern const char kApp[];
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 533c92d..3020c81 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -1749,6 +1749,7 @@ struct ParamTraits<WebPreferences> {
WriteParam(m, p.user_style_sheet_enabled);
WriteParam(m, p.user_style_sheet_location);
WriteParam(m, p.allow_universal_access_from_file_urls);
+ WriteParam(m, p.allow_file_access_from_file_urls);
WriteParam(m, p.experimental_webgl_enabled);
WriteParam(m, p.geolocation_enabled);
}
@@ -1789,6 +1790,7 @@ struct ParamTraits<WebPreferences> {
ReadParam(m, iter, &p->user_style_sheet_enabled) &&
ReadParam(m, iter, &p->user_style_sheet_location) &&
ReadParam(m, iter, &p->allow_universal_access_from_file_urls) &&
+ ReadParam(m, iter, &p->allow_file_access_from_file_urls) &&
ReadParam(m, iter, &p->experimental_webgl_enabled) &&
ReadParam(m, iter, &p->geolocation_enabled);
}
diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc
index 2dcdc80..d14b600 100644
--- a/webkit/glue/webpreferences.cc
+++ b/webkit/glue/webpreferences.cc
@@ -74,6 +74,7 @@ void WebPreferences::Apply(WebView* web_view) const {
// universal access. Only test shell will enable this.
settings->setAllowUniversalAccessFromFileURLs(
allow_universal_access_from_file_urls);
+ settings->setAllowFileAccessFromFileURLs(allow_file_access_from_file_urls);
// We prevent WebKit from checking if it needs to add a "text direction"
// submenu to a context menu. it is not only because we don't need the result
diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h
index 58daa58..daf0043 100644
--- a/webkit/glue/webpreferences.h
+++ b/webkit/glue/webpreferences.h
@@ -58,6 +58,7 @@ struct WebPreferences {
GURL user_style_sheet_location;
bool allow_universal_access_from_file_urls;
+ bool allow_file_access_from_file_urls;
bool experimental_webgl_enabled;
@@ -100,6 +101,7 @@ struct WebPreferences {
tabs_to_links(true),
user_style_sheet_enabled(false),
allow_universal_access_from_file_urls(false),
+ allow_file_access_from_file_urls(false),
experimental_webgl_enabled(false),
geolocation_enabled(false) {
}
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc
index 0552538d..f06de24 100644
--- a/webkit/tools/test_shell/layout_test_controller.cc
+++ b/webkit/tools/test_shell/layout_test_controller.cc
@@ -152,6 +152,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) :
BindMethod("evaluateScriptInIsolatedWorld", &LayoutTestController::evaluateScriptInIsolatedWorld);
BindMethod("overridePreference", &LayoutTestController::overridePreference);
BindMethod("setAllowUniversalAccessFromFileURLs", &LayoutTestController::setAllowUniversalAccessFromFileURLs);
+ BindMethod("setAllowFileAccessFromFileURLs", &LayoutTestController::setAllowFileAccessFromFileURLs);
BindMethod("setTimelineProfilingEnabled", &LayoutTestController::setTimelineProfilingEnabled);
BindMethod("evaluateInWebInspector", &LayoutTestController::evaluateInWebInspector);
BindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelectionColors);
@@ -899,6 +900,16 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(
result->SetNull();
}
+void LayoutTestController::setAllowFileAccessFromFileURLs(
+ const CppArgumentList& args, CppVariant* result) {
+ if (args.size() > 0 && args[0].isBool()) {
+ WebPreferences* prefs = shell_->GetWebPreferences();
+ prefs->allow_file_access_from_file_urls = args[0].value.boolValue;
+ prefs->Apply(shell_->webView());
+ }
+ result->SetNull();
+}
+
// Need these conversions because the format of the value for booleans
// may vary - for example, on mac "1" and "0" are used for boolean.
bool LayoutTestController::CppVariantToBool(const CppVariant& value) {
diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h
index 8705468..50d7c91 100644
--- a/webkit/tools/test_shell/layout_test_controller.h
+++ b/webkit/tools/test_shell/layout_test_controller.h
@@ -199,6 +199,7 @@ class LayoutTestController : public CppBoundClass {
void evaluateScriptInIsolatedWorld(const CppArgumentList& args, CppVariant* result);
void overridePreference(const CppArgumentList& args, CppVariant* result);
void setAllowUniversalAccessFromFileURLs(const CppArgumentList& args, CppVariant* result);
+ void setAllowFileAccessFromFileURLs(const CppArgumentList& args, CppVariant* result);
// The fallback method is called when a nonexistent method is called on
// the layout test controller object.
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 8d37a81..f7449b5 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -464,6 +464,7 @@ void TestShell::ResetWebPreferences() {
web_prefs_->local_storage_enabled = true;
web_prefs_->application_cache_enabled = true;
web_prefs_->databases_enabled = true;
+ web_prefs_->allow_file_access_from_file_urls = true;
// LayoutTests were written with Safari Mac in mind which does not allow
// tabbing to links by default.
web_prefs_->tabs_to_links = false;