Index: chrome/test/webdriver/webdriver_util.cc |
diff --git a/chrome/test/webdriver/webdriver_util.cc b/chrome/test/webdriver/webdriver_util.cc |
index b17abb2cb31f6d799375ddf375f2f2c14fe13772..568e842da36dfa269c9ff0d4fa4b3b5ebb63a95c 100644 |
--- a/chrome/test/webdriver/webdriver_util.cc |
+++ b/chrome/test/webdriver/webdriver_util.cc |
@@ -409,19 +409,17 @@ void TruncateString(std::string* data) { |
// Truncates all strings contained in the given value. |
void TruncateContainedStrings(Value* value) { |
- ListValue* list; |
- if (value->IsType(Value::TYPE_DICTIONARY)) { |
- DictionaryValue* dict = static_cast<DictionaryValue*>(value); |
- DictionaryValue::key_iterator key = dict->begin_keys(); |
- for (; key != dict->end_keys(); ++key) { |
- Value* child; |
- if (!dict->GetWithoutPathExpansion(*key, &child)) |
- continue; |
+ ListValue* list = NULL; |
+ DictionaryValue* dict = NULL; |
+ if (value->GetAsDictionary(&dict)) { |
+ for (DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { |
std::string data; |
- if (child->GetAsString(&data)) { |
+ if (it.value().GetAsString(&data)) { |
TruncateString(&data); |
- dict->SetWithoutPathExpansion(*key, new base::StringValue(data)); |
+ dict->SetWithoutPathExpansion(it.key(), new base::StringValue(data)); |
} else { |
+ Value* child = NULL; |
+ dict->GetWithoutPathExpansion(it.key(), &child); |
TruncateContainedStrings(child); |
} |
} |