| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
lgtm
GURL GetDefaultSearchEngineUrl(content::BrowserContext* browser_context) {can this be null?
std::string_view query_piece = url.query();
url::Component query(0, query_piece.length());
url::Component key;
url::Component value;
while (url::ExtractQueryKeyValue(query_piece, &query, &key, &value)) {
std::string_view key_view = query_piece.substr(key.begin, key.len);
std::string_view value_view = query_piece.substr(value.begin, value.len);
if (key_view != "pf") {
continue;
}
if (value_view == kNavigationPrefetchParam.Get() ||
value_view == kSuggestPrefetchParam.Get()) {
return true;
}
}not sure about the intention here but can we use existing helper like `net::GetValueForKeyInQuery()` instead?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
LGTM, thank you!
if (url.ReplaceComponents(replacements) != host) {`url.GetHost()` should work?
// It should not happen in our case?Yeah, this happens only when the API is the FetchLater:
https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/keep_alive_request_tracker.h;l=74-76;drc=5be55f3378e1097bdd863956de2a4baac12b3f03
EXPECT_NE(nullptr, search_prefetch_service);`ASSERT` may be more appropriate? (this is a pre-condition of the test)
fetch("$1", { method: "POST",keepalive: true})nit: `{ method: "POST", keepalive: true }` (adding spaces before "keepalive" and after "true" for consistency)
"/ack?pf=" + kSuggestPrefetchParam.Get());Can we add other random query parameters to check if the implementation correctly extract the pf?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
GURL GetDefaultSearchEngineUrl(content::BrowserContext* browser_context) {can this be null?
in most cases no..
It will be null only if the corresponding storage partition is being destroyed. And I'm not sure if we will hit this case or not, so I use pointer here.
Should I add a DumpWithoutCrash to ensure it will never be null when reaching here?
if (url.ReplaceComponents(replacements) != host) {Lingqi Chi`url.GetHost()` should work?
Done
std::string_view query_piece = url.query();
url::Component query(0, query_piece.length());
url::Component key;
url::Component value;
while (url::ExtractQueryKeyValue(query_piece, &query, &key, &value)) {
std::string_view key_view = query_piece.substr(key.begin, key.len);
std::string_view value_view = query_piece.substr(value.begin, value.len);
if (key_view != "pf") {
continue;
}
if (value_view == kNavigationPrefetchParam.Get() ||
value_view == kSuggestPrefetchParam.Get()) {
return true;
}
}not sure about the intention here but can we use existing helper like `net::GetValueForKeyInQuery()` instead?
TIL!!
Yeah, this happens only when the API is the FetchLater:
https://source.chromium.org/chromium/chromium/src/+/main:content/public/browser/keep_alive_request_tracker.h;l=74-76;drc=5be55f3378e1097bdd863956de2a4baac12b3f03
Thanks!!
`ASSERT` may be more appropriate? (this is a pre-condition of the test)
Done
nit: `{ method: "POST", keepalive: true }` (adding spaces before "keepalive" and after "true" for consistency)
Done
"/ack?pf=" + kSuggestPrefetchParam.Get());Can we add other random query parameters to check if the implementation correctly extract the pf?
I updated the unit tests a little bit, to enrich the test cases.
Ideally the unit tests can catch a bug if the implementation cannot correctly extract the pf
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
oops, I forgot to commit the patch that removing the debugging code.. sorry.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
"/ack?pf=" + kSuggestPrefetchParam.Get());Lingqi ChiCan we add other random query parameters to check if the implementation correctly extract the pf?
I updated the unit tests a little bit, to enrich the test cases.
Ideally the unit tests can catch a bug if the implementation cannot correctly extract the pf
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |