Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: headless/lib/browser/headless_devtools_client_impl.cc

Issue 1898633006: headless: Fix handling of replies without any parameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | headless/lib/headless_devtools_client_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/headless_devtools_client_impl.cc
diff --git a/headless/lib/browser/headless_devtools_client_impl.cc b/headless/lib/browser/headless_devtools_client_impl.cc
index 8ce845336da9241c4b8f15627b67140bc28dc6a7..0fe3f9845a793e020a26962fc8dede231e61a2c7 100644
--- a/headless/lib/browser/headless_devtools_client_impl.cc
+++ b/headless/lib/browser/headless_devtools_client_impl.cc
@@ -95,10 +95,14 @@ void HeadlessDevToolsClientImpl::DispatchProtocolMessage(
NOTREACHED() << "Unexpected reply";
return;
}
- base::DictionaryValue* result_dict;
- if (message_dict->GetDictionary("result", &result_dict)) {
+ if (!it->second.callback_with_result.is_null()) {
+ base::DictionaryValue* result_dict;
+ if (!message_dict->GetDictionary("result", &result_dict)) {
+ NOTREACHED() << "Badly formed reply result";
+ return;
+ }
it->second.callback_with_result.Run(*result_dict);
- } else {
+ } else if (!it->second.callback.is_null()) {
it->second.callback.Run();
}
pending_messages_.erase(it);
« no previous file with comments | « no previous file | headless/lib/headless_devtools_client_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698