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

Unified Diff: chrome/test/webdriver/commands/cookie_commands.cc

Issue 10834004: Correct const accessors in base/values.(h|cc) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reverting webdriver:Command::parameters_ to const Created 8 years, 5 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 | « chrome/test/webdriver/commands/command.cc ('k') | chrome/test/webdriver/commands/create_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/webdriver/commands/cookie_commands.cc
diff --git a/chrome/test/webdriver/commands/cookie_commands.cc b/chrome/test/webdriver/commands/cookie_commands.cc
index 1779d59d540d1ad9ab5ca7471d06d48752ce67ef..d3a8ae366e954972f57ba70b93ce4073c38328f4 100644
--- a/chrome/test/webdriver/commands/cookie_commands.cc
+++ b/chrome/test/webdriver/commands/cookie_commands.cc
@@ -48,15 +48,16 @@ void CookieCommand::ExecuteGet(Response* const response) {
}
void CookieCommand::ExecutePost(Response* const response) {
- DictionaryValue* cookie_dict;
+ const DictionaryValue* cookie_dict;
if (!GetDictionaryParameter("cookie", &cookie_dict)) {
response->SetError(new Error(
kBadRequest, "Missing or invalid |cookie| parameter"));
return;
}
+ scoped_ptr<DictionaryValue> cookie_dict_copy(cookie_dict->DeepCopy());
std::string domain;
- if (cookie_dict->GetString("domain", &domain)) {
+ if (cookie_dict_copy->GetString("domain", &domain)) {
std::vector<std::string> split_domain;
base::SplitString(domain, ':', &split_domain);
if (split_domain.size() > 2) {
@@ -65,14 +66,14 @@ void CookieCommand::ExecutePost(Response* const response) {
return;
} else if (split_domain.size() == 2) {
// Remove the port number.
- cookie_dict->SetString("domain", split_domain[0]);
+ cookie_dict_copy->SetString("domain", split_domain[0]);
}
}
std::string url;
Error* error = session_->GetURL(&url);
if (!error)
- error = session_->SetCookie(url, cookie_dict);
+ error = session_->SetCookie(url, cookie_dict_copy.get());
if (error) {
response->SetError(error);
return;
« no previous file with comments | « chrome/test/webdriver/commands/command.cc ('k') | chrome/test/webdriver/commands/create_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698