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
return true;
}
void GetSanitizationInformation(const char* const** annotations_whitelist,
void GetSanitizationInformation(const char* const** crash_key_allowlist,
void** target_module,
bool* sanitize_stacks) override {
*annotations_whitelist = crash_keys::kWebViewCrashKeyWhiteList;
*crash_key_allowlist = crash_keys::kWebViewCrashKeyAllowList;
*target_module = nullptr;
*sanitize_stacks = true;
}
......@@ -173,15 +173,13 @@ static void JNI_AwDebug_InitCrashKeysForWebViewTesting(JNIEnv* env) {
crash_keys::InitCrashKeysForWebViewTesting();
}
static void JNI_AwDebug_SetWhiteListedKeyForTesting(JNIEnv* env) {
static ::crash_reporter::CrashKeyString<32> crash_key(
"AW_WHITELISTED_DEBUG_KEY");
static void JNI_AwDebug_SetAllowedKeyForTesting(JNIEnv* env) {
static ::crash_reporter::CrashKeyString<32> crash_key("AW_ALLOWED_DEBUG_KEY");
crash_key.Set("AW_DEBUG_VALUE");
}
static void JNI_AwDebug_SetNonWhiteListedKeyForTesting(JNIEnv* env) {
static ::crash_reporter::CrashKeyString<32> crash_key(
"AW_NONWHITELISTED_DEBUG_KEY");
static void JNI_AwDebug_SetDeniedKeyForTesting(JNIEnv* env) {
static ::crash_reporter::CrashKeyString<32> crash_key("AW_DENIED_DEBUG_KEY");
crash_key.Set("AW_DEBUG_VALUE");
}
......
......@@ -64,10 +64,10 @@ class AwCrashReporterClient : public crash_reporter::CrashReporterClient {
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,
bool* sanitize_stacks) override {
*annotations_whitelist = crash_keys::kWebViewCrashKeyWhiteList;
*crash_key_allowlist = crash_keys::kWebViewCrashKeyAllowList;
#if defined(COMPONENT_BUILD)
*target_module = nullptr;
#else
......
......@@ -21,8 +21,8 @@ extern const char kWeblayerWebViewCompatMode[] =
"WEBLAYER_WEB_VIEW_COMPAT_MODE";
// clang-format off
const char* const kWebViewCrashKeyWhiteList[] = {
"AW_WHITELISTED_DEBUG_KEY",
const char* const kWebViewCrashKeyAllowList[] = {
"AW_ALLOWED_DEBUG_KEY",
kAppPackageName,
kAppPackageVersionCode,
kAndroidSdkInt,
......
......@@ -12,7 +12,7 @@ namespace crash_keys {
// reporting server. Returns the size of the union of all keys.
void InitCrashKeysForWebViewTesting();
extern const char* const kWebViewCrashKeyWhiteList[];
extern const char* const kWebViewCrashKeyAllowList[];
// Crash Key Name Constants ////////////////////////////////////////////////////
......
......@@ -47,12 +47,12 @@ public class AwDebug {
AwDebugJni.get().initCrashKeysForWebViewTesting();
}
public static void setWhiteListedKeyForTesting() {
AwDebugJni.get().setWhiteListedKeyForTesting();
public static void setAllowedKeyForTesting() {
AwDebugJni.get().setAllowedKeyForTesting();
}
public static void setNonWhiteListedKeyForTesting() {
AwDebugJni.get().setNonWhiteListedKeyForTesting();
public static void setDeniedKeyForTesting() {
AwDebugJni.get().setDeniedKeyForTesting();
}
public static void setSupportLibraryWebkitVersionCrashKey(String version) {
......@@ -63,8 +63,8 @@ public class AwDebug {
interface Natives {
boolean dumpWithoutCrashing(String dumpPath);
void initCrashKeysForWebViewTesting();
void setWhiteListedKeyForTesting();
void setNonWhiteListedKeyForTesting();
void setAllowedKeyForTesting();
void setDeniedKeyForTesting();
void setSupportLibraryWebkitVersionCrashKey(String version);
}
}
......@@ -36,8 +36,8 @@ public class AwDebugTest {
private static final String TAG = "AwDebugTest";
// 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 NON_WHITELISTED_DEBUG_KEY = "AW_NONWHITELISTED_DEBUG_KEY";
private static final String ALLOWED_DEBUG_KEY = "AW_ALLOWED_DEBUG_KEY";
private static final String DENIED_DEBUG_KEY = "AW_DENIED_DEBUG_KEY";
private static final String DEBUG_VALUE = "AW_DEBUG_VALUE";
@Test
......@@ -59,13 +59,13 @@ public class AwDebugTest {
@SmallTest
@Feature({"AndroidWebView", "Debug"})
@DisabledTest(message = "crbug.com/913515")
public void testDumpContainsWhitelistedKey() throws Throwable {
public void testDumpContainsAlloweddKey() throws Throwable {
File f = File.createTempFile("dump", ".dmp");
try {
AwDebug.initCrashKeysForTesting();
AwDebug.setWhiteListedKeyForTesting();
AwDebug.setAllowedKeyForTesting();
Assert.assertTrue(AwDebug.dumpWithoutCrashing(f));
assertContainsCrashKeyValue(f, WHITELISTED_DEBUG_KEY, DEBUG_VALUE);
assertContainsCrashKeyValue(f, ALLOWED_DEBUG_KEY, DEBUG_VALUE);
} finally {
Assert.assertTrue(f.delete());
}
......@@ -75,13 +75,13 @@ public class AwDebugTest {
@SmallTest
@Feature({"AndroidWebView", "Debug"})
@DisabledTest(message = "crbug.com/913515")
public void testDumpDoesNotContainNonWhitelistedKey() throws Throwable {
public void testDumpDoesNotContainDeniedKey() throws Throwable {
File f = File.createTempFile("dump", ".dmp");
try {
AwDebug.initCrashKeysForTesting();
AwDebug.setNonWhiteListedKeyForTesting();
AwDebug.setDeniedKeyForTesting();
Assert.assertTrue(AwDebug.dumpWithoutCrashing(f));
assertNotContainsCrashKeyValue(f, NON_WHITELISTED_DEBUG_KEY);
assertNotContainsCrashKeyValue(f, DENIED_DEBUG_KEY);
} finally {
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