diff options
author | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-17 22:58:43 +0000 |
---|---|---|
committer | cevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-17 22:58:43 +0000 |
commit | 44c504386e206b172696538f02ae3df7217c6ee2 (patch) | |
tree | 0769dac72cd613cfcb60b5f93758a14e8e60754c /webkit | |
parent | 7855cdf9f74be8e3456c6985aa5a0f2aa6487cba (diff) | |
download | chromium_src-44c504386e206b172696538f02ae3df7217c6ee2.zip chromium_src-44c504386e206b172696538f02ae3df7217c6ee2.tar.gz chromium_src-44c504386e206b172696538f02ae3df7217c6ee2.tar.bz2 |
Chromium pieces to use the WebKit support for isolation file:// documents in
their own unique domains.
By default, we use this isolation for security. We provide a command line switch
override for developers: --allow-file-access-from-files
BUG=4197
TEST=WebKit test pending
Review URL: http://codereview.chromium.org/625001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39287 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-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 |
5 files changed, 16 insertions, 0 deletions
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; |