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

Unified Diff: extensions/browser/api/guest_view/web_view/web_view_internal_api.cc

Issue 1365563003: Prevent guest views from issuing a search for empty text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lint Created 5 years, 3 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
Index: extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
diff --git a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
index cee2f5ea0b9c61505800981b0fec2a3909eb1101..0c1f7a0cc264fef8519619737cb5eb02d70066fd 100644
--- a/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
+++ b/extensions/browser/api/guest_view/web_view/web_view_internal_api.cc
@@ -45,10 +45,12 @@ const char kIndexedDBKey[] = "indexedDB";
const char kLocalStorageKey[] = "localStorage";
const char kWebSQLKey[] = "webSQL";
const char kSinceKey[] = "since";
-const char kLoadFileError[] = "Failed to load file: \"*\". ";
-const char kViewInstanceIdError[] = "view_instance_id is missing.";
+
const char kDuplicatedContentScriptNamesError[] =
"The given content script name already exists.";
+const char kEmptyFindTextError[] = "Find called with no text";
+const char kLoadFileError[] = "Failed to load file: \"*\". ";
+const char kViewInstanceIdError[] = "view_instance_id is missing.";
uint32 MaskForKey(const char* key) {
if (strcmp(key, kAppCacheKey) == 0)
@@ -632,6 +634,11 @@ bool WebViewInternalFindFunction::RunAsyncSafe(WebViewGuest* guest) {
base::string16 search_text;
base::UTF8ToUTF16(
params->search_text.c_str(), params->search_text.length(), &search_text);
+ if (search_text.empty()) {
Fady Samuel 2015/09/26 00:14:34 I don't think this is the correct solution. I thin
Lei Zhang 2015/09/26 00:22:01 You are referring to https://developer.chrome.com/
Charlie Reis 2015/09/28 19:35:17 It does seem like a nonsensical case to me. I'd b
+ error_ = kEmptyFindTextError;
+ SendResponse(false);
+ return true;
+ }
// Set the find options to their default values.
blink::WebFindOptions options;

Powered by Google App Engine
This is Rietveld 408576698