diff options
author | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-30 21:21:47 +0000 |
---|---|---|
committer | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-30 21:21:47 +0000 |
commit | e8c5c2e12ec609f59a2f69ca8a3296823d855881 (patch) | |
tree | 6c2460f5f8355a44e7323dfb3e13fa1292d70cae | |
parent | c410e02b297c491b5ad1cf49606679edaf018dba (diff) | |
download | chromium_src-e8c5c2e12ec609f59a2f69ca8a3296823d855881.zip chromium_src-e8c5c2e12ec609f59a2f69ca8a3296823d855881.tar.gz chromium_src-e8c5c2e12ec609f59a2f69ca8a3296823d855881.tar.bz2 |
Disable synchronous XMLHttpRequests in platform app documents.
Depends on http://webkit.org/b/87540
R=darin@chromium.org
BUG=130185
Review URL: https://chromiumcodereview.appspot.com/10443047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139637 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/extension_webkit_preferences.cc | 1 | ||||
-rw-r--r-- | chrome/test/data/extensions/platform_apps/restrictions/test.js | 14 | ||||
-rw-r--r-- | content/common/view_messages.h | 1 | ||||
-rw-r--r-- | webkit/glue/webpreferences.cc | 4 | ||||
-rw-r--r-- | webkit/glue/webpreferences.h | 3 |
5 files changed, 18 insertions, 5 deletions
diff --git a/chrome/browser/extensions/extension_webkit_preferences.cc b/chrome/browser/extensions/extension_webkit_preferences.cc index 14fbbbe..b15f3398 100644 --- a/chrome/browser/extensions/extension_webkit_preferences.cc +++ b/chrome/browser/extensions/extension_webkit_preferences.cc @@ -38,6 +38,7 @@ void SetPreferences(const extensions::Extension* extension, if (extension->is_platform_app()) { webkit_prefs->databases_enabled = false; webkit_prefs->local_storage_enabled = false; + webkit_prefs->sync_xhr_in_documents_enabled = false; } // Enable WebGL features that regular pages can't access, since they add diff --git a/chrome/test/data/extensions/platform_apps/restrictions/test.js b/chrome/test/data/extensions/platform_apps/restrictions/test.js index 25008d6..25b45f9 100644 --- a/chrome/test/data/extensions/platform_apps/restrictions/test.js +++ b/chrome/test/data/extensions/platform_apps/restrictions/test.js @@ -6,14 +6,14 @@ var assertEq = chrome.test.assertEq; var fail = chrome.test.fail; var succeed = chrome.test.succeed; -var error = "Not available for platform apps."; +var DEFAULT_EXPECTED_ERROR = "Not available for platform apps."; -function assertThrowsError(method) { +function assertThrowsError(method, opt_expectedError) { try { method(); fail("error not thrown"); } catch (e) { - assertEq(e, error); + assertEq(e.message || e, opt_expectedError || DEFAULT_EXPECTED_ERROR); } } @@ -113,5 +113,13 @@ chrome.test.runTests([ }); } succeed(); + }, + + function testSyncXhr() { + var xhr = new XMLHttpRequest(); + assertThrowsError(function() { + xhr.open('GET', 'data:should not load', false); + }, 'INVALID_ACCESS_ERR: DOM Exception 15'); + succeed(); } ]); diff --git a/content/common/view_messages.h b/content/common/view_messages.h index e9de89c..a63d0c7 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -213,6 +213,7 @@ IPC_STRUCT_TRAITS_BEGIN(webkit_glue::WebPreferences) IPC_STRUCT_TRAITS_MEMBER(max_untiled_layer_width) IPC_STRUCT_TRAITS_MEMBER(max_untiled_layer_height) IPC_STRUCT_TRAITS_MEMBER(fixed_position_creates_stacking_context) + IPC_STRUCT_TRAITS_MEMBER(sync_xhr_in_documents_enabled) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(WebMenuItem) diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc index a49ae7d..ed089f7 100644 --- a/webkit/glue/webpreferences.cc +++ b/webkit/glue/webpreferences.cc @@ -112,7 +112,8 @@ WebPreferences::WebPreferences() default_tile_height(256), max_untiled_layer_width(512), max_untiled_layer_height(512), - fixed_position_creates_stacking_context(false) { + fixed_position_creates_stacking_context(false), + sync_xhr_in_documents_enabled(true) { standard_font_family_map[kCommonScript] = ASCIIToUTF16("Times New Roman"); fixed_font_family_map[kCommonScript] = @@ -229,6 +230,7 @@ void WebPreferences::Apply(WebView* web_view) const { settings->setXSSAuditorEnabled(xss_auditor_enabled); settings->setDNSPrefetchingEnabled(dns_prefetching_enabled); settings->setLocalStorageEnabled(local_storage_enabled); + settings->setSyncXHRInDocumentsEnabled(sync_xhr_in_documents_enabled); WebRuntimeFeatures::enableDatabase(databases_enabled); settings->setOfflineWebApplicationCacheEnabled(application_cache_enabled); settings->setCaretBrowsingEnabled(caret_browsing_enabled); diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h index 7e43982..bdc324b 100644 --- a/webkit/glue/webpreferences.h +++ b/webkit/glue/webpreferences.h @@ -5,7 +5,7 @@ // A struct for managing webkit's settings. // // Adding new values to this class probably involves updating -// WebKit::WebSettings, common/render_messages.cc, browser/tab_contents/ +// WebKit::WebSettings, content/common/view_messages.h, browser/tab_contents/ // render_view_host_delegate_helper.cc, and browser/profiles/profile.cc. #ifndef WEBKIT_GLUE_WEBPREFERENCES_H__ @@ -129,6 +129,7 @@ struct WEBKIT_GLUE_EXPORT WebPreferences { int max_untiled_layer_width; int max_untiled_layer_height; bool fixed_position_creates_stacking_context; + bool sync_xhr_in_documents_enabled; // We try to keep the default values the same as the default values in // chrome, except for the cases where it would require lots of extra work for |