diff options
author | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-18 04:18:25 +0000 |
---|---|---|
committer | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-18 04:18:25 +0000 |
commit | bed2242142e1dda956947ce6bf2429fe44922c1c (patch) | |
tree | ea0cb014a7eb410cc1783d8801f4f8ac7f98649c | |
parent | 70aa23a21ac0d7a3f136b1e8acda479edd2b8cd7 (diff) | |
download | chromium_src-bed2242142e1dda956947ce6bf2429fe44922c1c.zip chromium_src-bed2242142e1dda956947ce6bf2429fe44922c1c.tar.gz chromium_src-bed2242142e1dda956947ce6bf2429fe44922c1c.tar.bz2 |
Chromium plumbing for new file:// security flag, including test_shell support.
This change does not alter behaviour but will enable a WebKit test to be
written.
BUG=4197
TEST=WebKit test pending
TBR=abarth
Review URL: http://codereview.chromium.org/625009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39334 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/common/render_messages.h | 2 | ||||
-rw-r--r-- | webkit/glue/webpreferences.cc | 1 | ||||
-rw-r--r-- | webkit/glue/webpreferences.h | 2 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.cc | 11 | ||||
-rw-r--r-- | webkit/tools/test_shell/layout_test_controller.h | 1 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 1 |
6 files changed, 18 insertions, 0 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index c163e82..dad92805 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -1772,6 +1772,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); } @@ -1812,6 +1813,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..4c33fee 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(true), 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; |