diff options
author | bauerb <bauerb@chromium.org> | 2015-07-13 04:05:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-13 11:06:17 +0000 |
commit | b1704d0c90a6eb1e4d5eb1e83976e5964ee378b7 (patch) | |
tree | 3fc9c84049911645710aa2a9bb5f06e38ed84b5d /components/test | |
parent | f8633deb9da835a863a5f77bdc1c52ee701d8ae2 (diff) | |
download | chromium_src-b1704d0c90a6eb1e4d5eb1e83976e5964ee378b7.zip chromium_src-b1704d0c90a6eb1e4d5eb1e83976e5964ee378b7.tar.gz chromium_src-b1704d0c90a6eb1e4d5eb1e83976e5964ee378b7.tar.bz2 |
Add a JSON sanitizer.
On Android, the JSON sanitizer parses the untrusted JSON in Java and checks it for wellformedness before serializing it again. On desktop platforms it uses SafeJsonParser to parse the JSON out of process, then serializes it again.
Also, on Android (where JsonSanitizer is not implemented in terms of the SafeJsonParser) the SafeJsonParser now uses the JsonSanitizer to sanitize its input before parsing it directly in process, instead of starting a new process, which is very costly on Android.
BUG=501333
Review URL: https://codereview.chromium.org/1203083002
Cr-Commit-Position: refs/heads/master@{#338495}
Diffstat (limited to 'components/test')
-rw-r--r-- | components/test/DEPS | 1 | ||||
-rw-r--r-- | components/test/run_all_unittests.cc | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/components/test/DEPS b/components/test/DEPS index b734027..ad24217 100644 --- a/components/test/DEPS +++ b/components/test/DEPS @@ -2,6 +2,7 @@ include_rules = [ # To initialize the global data of content_settings. "+components/content_settings/core/common", "+components/invalidation/impl/android/component_jni_registrar.h", + "+components/safe_json/android/component_jni_registrar.h", "+content/public/android/java/src/org/chromium/content/browser", "+content/public/app/content_jni_onload.h", "+content/public/app/content_main.h", diff --git a/components/test/run_all_unittests.cc b/components/test/run_all_unittests.cc index 0c2dd10..a24c284 100644 --- a/components/test/run_all_unittests.cc +++ b/components/test/run_all_unittests.cc @@ -23,6 +23,7 @@ #if defined(OS_ANDROID) #include "base/android/jni_android.h" #include "components/invalidation/impl/android/component_jni_registrar.h" +#include "components/safe_json/android/component_jni_registrar.h" #include "ui/base/android/ui_base_jni_registrar.h" #include "ui/gfx/android/gfx_jni_registrar.h" #endif @@ -48,9 +49,10 @@ class ComponentsTestSuite : public base::TestSuite { #if defined(OS_ANDROID) // Register JNI bindings for android. JNIEnv* env = base::android::AttachCurrentThread(); - gfx::android::RegisterJni(env); - ui::android::RegisterJni(env); - invalidation::android::RegisterInvalidationJni(env); + ASSERT_TRUE(gfx::android::RegisterJni(env)); + ASSERT_TRUE(ui::android::RegisterJni(env)); + ASSERT_TRUE(invalidation::android::RegisterInvalidationJni(env)); + ASSERT_TRUE(safe_json::android::RegisterSafeJsonJni(env)); #endif ui::RegisterPathProvider(); |