Commit c63924ce authored by Tobias Sargeant's avatar Tobias Sargeant Committed by Commit Bot

[aw] Rename crash key identifiers to allow/deny

Change-Id: I7133100a15cefe650e90561c3fca824bc5d8bf4a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2167440Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Commit-Queue: Tobias Sargeant <tobiasjs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762859}
parent 5dd9bfdf
...@@ -61,10 +61,10 @@ class AwDebugCrashReporterClient ...@@ -61,10 +61,10 @@ class AwDebugCrashReporterClient
return true; return true;
} }
void GetSanitizationInformation(const char* const** annotations_whitelist, void GetSanitizationInformation(const char* const** crash_key_allowlist,
void** target_module, void** target_module,
bool* sanitize_stacks) override { bool* sanitize_stacks) override {
*annotations_whitelist = crash_keys::kWebViewCrashKeyWhiteList; *crash_key_allowlist = crash_keys::kWebViewCrashKeyAllowList;
*target_module = nullptr; *target_module = nullptr;
*sanitize_stacks = true; *sanitize_stacks = true;
} }
...@@ -173,15 +173,13 @@ static void JNI_AwDebug_InitCrashKeysForWebViewTesting(JNIEnv* env) { ...@@ -173,15 +173,13 @@ static void JNI_AwDebug_InitCrashKeysForWebViewTesting(JNIEnv* env) {
crash_keys::InitCrashKeysForWebViewTesting(); crash_keys::InitCrashKeysForWebViewTesting();
} }
static void JNI_AwDebug_SetWhiteListedKeyForTesting(JNIEnv* env) { static void JNI_AwDebug_SetAllowedKeyForTesting(JNIEnv* env) {
static ::crash_reporter::CrashKeyString<32> crash_key( static ::crash_reporter::CrashKeyString<32> crash_key("AW_ALLOWED_DEBUG_KEY");
"AW_WHITELISTED_DEBUG_KEY");
crash_key.Set("AW_DEBUG_VALUE"); crash_key.Set("AW_DEBUG_VALUE");
} }
static void JNI_AwDebug_SetNonWhiteListedKeyForTesting(JNIEnv* env) { static void JNI_AwDebug_SetDeniedKeyForTesting(JNIEnv* env) {
static ::crash_reporter::CrashKeyString<32> crash_key( static ::crash_reporter::CrashKeyString<32> crash_key("AW_DENIED_DEBUG_KEY");
"AW_NONWHITELISTED_DEBUG_KEY");
crash_key.Set("AW_DEBUG_VALUE"); crash_key.Set("AW_DEBUG_VALUE");
} }
......
...@@ -64,10 +64,10 @@ class AwCrashReporterClient : public crash_reporter::CrashReporterClient { ...@@ -64,10 +64,10 @@ class AwCrashReporterClient : public crash_reporter::CrashReporterClient {
return base::PathService::Get(android_webview::DIR_CRASH_DUMPS, crash_dir); return base::PathService::Get(android_webview::DIR_CRASH_DUMPS, crash_dir);
} }
void GetSanitizationInformation(const char* const** annotations_whitelist, void GetSanitizationInformation(const char* const** crash_key_allowlist,
void** target_module, void** target_module,
bool* sanitize_stacks) override { bool* sanitize_stacks) override {
*annotations_whitelist = crash_keys::kWebViewCrashKeyWhiteList; *crash_key_allowlist = crash_keys::kWebViewCrashKeyAllowList;
#if defined(COMPONENT_BUILD) #if defined(COMPONENT_BUILD)
*target_module = nullptr; *target_module = nullptr;
#else #else
......
...@@ -21,8 +21,8 @@ extern const char kWeblayerWebViewCompatMode[] = ...@@ -21,8 +21,8 @@ extern const char kWeblayerWebViewCompatMode[] =
"WEBLAYER_WEB_VIEW_COMPAT_MODE"; "WEBLAYER_WEB_VIEW_COMPAT_MODE";
// clang-format off // clang-format off
const char* const kWebViewCrashKeyWhiteList[] = { const char* const kWebViewCrashKeyAllowList[] = {
"AW_WHITELISTED_DEBUG_KEY", "AW_ALLOWED_DEBUG_KEY",
kAppPackageName, kAppPackageName,
kAppPackageVersionCode, kAppPackageVersionCode,
kAndroidSdkInt, kAndroidSdkInt,
......
...@@ -12,7 +12,7 @@ namespace crash_keys { ...@@ -12,7 +12,7 @@ namespace crash_keys {
// reporting server. Returns the size of the union of all keys. // reporting server. Returns the size of the union of all keys.
void InitCrashKeysForWebViewTesting(); void InitCrashKeysForWebViewTesting();
extern const char* const kWebViewCrashKeyWhiteList[]; extern const char* const kWebViewCrashKeyAllowList[];
// Crash Key Name Constants //////////////////////////////////////////////////// // Crash Key Name Constants ////////////////////////////////////////////////////
......
...@@ -47,12 +47,12 @@ public class AwDebug { ...@@ -47,12 +47,12 @@ public class AwDebug {
AwDebugJni.get().initCrashKeysForWebViewTesting(); AwDebugJni.get().initCrashKeysForWebViewTesting();
} }
public static void setWhiteListedKeyForTesting() { public static void setAllowedKeyForTesting() {
AwDebugJni.get().setWhiteListedKeyForTesting(); AwDebugJni.get().setAllowedKeyForTesting();
} }
public static void setNonWhiteListedKeyForTesting() { public static void setDeniedKeyForTesting() {
AwDebugJni.get().setNonWhiteListedKeyForTesting(); AwDebugJni.get().setDeniedKeyForTesting();
} }
public static void setSupportLibraryWebkitVersionCrashKey(String version) { public static void setSupportLibraryWebkitVersionCrashKey(String version) {
...@@ -63,8 +63,8 @@ public class AwDebug { ...@@ -63,8 +63,8 @@ public class AwDebug {
interface Natives { interface Natives {
boolean dumpWithoutCrashing(String dumpPath); boolean dumpWithoutCrashing(String dumpPath);
void initCrashKeysForWebViewTesting(); void initCrashKeysForWebViewTesting();
void setWhiteListedKeyForTesting(); void setAllowedKeyForTesting();
void setNonWhiteListedKeyForTesting(); void setDeniedKeyForTesting();
void setSupportLibraryWebkitVersionCrashKey(String version); void setSupportLibraryWebkitVersionCrashKey(String version);
} }
} }
...@@ -36,8 +36,8 @@ public class AwDebugTest { ...@@ -36,8 +36,8 @@ public class AwDebugTest {
private static final String TAG = "AwDebugTest"; private static final String TAG = "AwDebugTest";
// These constants must match android_webview/browser/aw_debug.cc. // These constants must match android_webview/browser/aw_debug.cc.
private static final String WHITELISTED_DEBUG_KEY = "AW_WHITELISTED_DEBUG_KEY"; private static final String ALLOWED_DEBUG_KEY = "AW_ALLOWED_DEBUG_KEY";
private static final String NON_WHITELISTED_DEBUG_KEY = "AW_NONWHITELISTED_DEBUG_KEY"; private static final String DENIED_DEBUG_KEY = "AW_DENIED_DEBUG_KEY";
private static final String DEBUG_VALUE = "AW_DEBUG_VALUE"; private static final String DEBUG_VALUE = "AW_DEBUG_VALUE";
@Test @Test
...@@ -59,13 +59,13 @@ public class AwDebugTest { ...@@ -59,13 +59,13 @@ public class AwDebugTest {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Debug"}) @Feature({"AndroidWebView", "Debug"})
@DisabledTest(message = "crbug.com/913515") @DisabledTest(message = "crbug.com/913515")
public void testDumpContainsWhitelistedKey() throws Throwable { public void testDumpContainsAlloweddKey() throws Throwable {
File f = File.createTempFile("dump", ".dmp"); File f = File.createTempFile("dump", ".dmp");
try { try {
AwDebug.initCrashKeysForTesting(); AwDebug.initCrashKeysForTesting();
AwDebug.setWhiteListedKeyForTesting(); AwDebug.setAllowedKeyForTesting();
Assert.assertTrue(AwDebug.dumpWithoutCrashing(f)); Assert.assertTrue(AwDebug.dumpWithoutCrashing(f));
assertContainsCrashKeyValue(f, WHITELISTED_DEBUG_KEY, DEBUG_VALUE); assertContainsCrashKeyValue(f, ALLOWED_DEBUG_KEY, DEBUG_VALUE);
} finally { } finally {
Assert.assertTrue(f.delete()); Assert.assertTrue(f.delete());
} }
...@@ -75,13 +75,13 @@ public class AwDebugTest { ...@@ -75,13 +75,13 @@ public class AwDebugTest {
@SmallTest @SmallTest
@Feature({"AndroidWebView", "Debug"}) @Feature({"AndroidWebView", "Debug"})
@DisabledTest(message = "crbug.com/913515") @DisabledTest(message = "crbug.com/913515")
public void testDumpDoesNotContainNonWhitelistedKey() throws Throwable { public void testDumpDoesNotContainDeniedKey() throws Throwable {
File f = File.createTempFile("dump", ".dmp"); File f = File.createTempFile("dump", ".dmp");
try { try {
AwDebug.initCrashKeysForTesting(); AwDebug.initCrashKeysForTesting();
AwDebug.setNonWhiteListedKeyForTesting(); AwDebug.setDeniedKeyForTesting();
Assert.assertTrue(AwDebug.dumpWithoutCrashing(f)); Assert.assertTrue(AwDebug.dumpWithoutCrashing(f));
assertNotContainsCrashKeyValue(f, NON_WHITELISTED_DEBUG_KEY); assertNotContainsCrashKeyValue(f, DENIED_DEBUG_KEY);
} finally { } finally {
Assert.assertTrue(f.delete()); Assert.assertTrue(f.delete());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment