Index: chrome/browser/prerender/prerender_local_predictor.cc |
diff --git a/chrome/browser/prerender/prerender_local_predictor.cc b/chrome/browser/prerender/prerender_local_predictor.cc |
index d3f757801d2e7ef7d398c9dc3a3d8a01d273d962..0f50b7197d8af174a09f1e092a1b3e2406d6c6aa 100644 |
--- a/chrome/browser/prerender/prerender_local_predictor.cc |
+++ b/chrome/browser/prerender/prerender_local_predictor.cc |
@@ -840,9 +840,12 @@ bool PrerenderLocalPredictor::ApplyParsedPrerenderServiceResponse( |
if (!list->GetDictionary(i, &d)) |
return false; |
string url; |
+ if (!d->GetString("url", &url) || !GURL(url).is_valid()) { |
+ return false; |
+ } |
double priority; |
- if (!d->GetString("url", &url) || !d->GetDouble("likelihood", &priority) |
- || !GURL(url).is_valid()) { |
+ if (!d->GetDouble("likelihood", &priority) || priority < 0.0 || |
+ priority > 1.0) { |
Peter Kasting
2014/07/03 01:18:50
Note: These rather arbitrary-looking changes make
|
return false; |
} |
int in_index_timed_out = 0; |
@@ -852,8 +855,8 @@ bool PrerenderLocalPredictor::ApplyParsedPrerenderServiceResponse( |
!d->GetInteger("in_index", &in_index)) { |
return false; |
} |
- if (priority < 0.0 || priority > 1.0 || in_index < 0 || in_index > 1 || |
- in_index_timed_out < 0 || in_index_timed_out > 1) { |
+ if (in_index < 0 || in_index > 1 || in_index_timed_out < 0 || |
+ in_index_timed_out > 1) { |
return false; |
} |
if (in_index_timed_out == 1) |
@@ -861,7 +864,7 @@ bool PrerenderLocalPredictor::ApplyParsedPrerenderServiceResponse( |
info->MaybeAddCandidateURLFromService(GURL(url), |
priority, |
in_index == 1, |
- (1 - in_index_timed_out) == 1); |
+ !in_index_timed_out); |
} |
if (list->GetSize() > 0) |
RecordEvent(EVENT_PRERENDER_SERIVCE_RETURNED_HINTING_CANDIDATES); |