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

Side by Side Diff: content/common/indexed_db_param_traits.cc

Issue 8276023: IndexedDB: Wrong exception types thrown for invalid keys (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated copyright years Created 9 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « content/common/indexed_db_key.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/indexed_db_param_traits.h" 5 #include "content/common/indexed_db_param_traits.h"
6 6
7 #include "content/common/indexed_db_key.h" 7 #include "content/common/indexed_db_key.h"
8 #include "content/public/common/serialized_script_value.h" 8 #include "content/public/common/serialized_script_value.h"
9 #include "ipc/ipc_message_utils.h" 9 #include "ipc/ipc_message_utils.h"
10 10
11 namespace IPC { 11 namespace IPC {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 double number; 63 double number;
64 bool ok = 64 bool ok =
65 ReadParam(m, iter, &type) && 65 ReadParam(m, iter, &type) &&
66 ReadParam(m, iter, &string) && 66 ReadParam(m, iter, &string) &&
67 ReadParam(m, iter, &date) && 67 ReadParam(m, iter, &date) &&
68 ReadParam(m, iter, &number); 68 ReadParam(m, iter, &number);
69 69
70 if (!ok) 70 if (!ok)
71 return false; 71 return false;
72 switch (type) { 72 switch (type) {
73 case WebKit::WebIDBKey::NullType:
74 r->SetNull();
75 return true;
76 case WebKit::WebIDBKey::StringType: 73 case WebKit::WebIDBKey::StringType:
77 r->SetString(string); 74 r->SetString(string);
78 return true; 75 return true;
79 case WebKit::WebIDBKey::DateType: 76 case WebKit::WebIDBKey::DateType:
80 r->SetDate(date); 77 r->SetDate(date);
81 return true; 78 return true;
82 case WebKit::WebIDBKey::NumberType: 79 case WebKit::WebIDBKey::NumberType:
83 r->SetNumber(number); 80 r->SetNumber(number);
84 return true; 81 return true;
85 case WebKit::WebIDBKey::InvalidType: 82 case WebKit::WebIDBKey::InvalidType:
83 default: // TODO(jsbell): Remove this case label once NullType is gone
86 r->SetInvalid(); 84 r->SetInvalid();
87 return true; 85 return true;
88 } 86 }
89 NOTREACHED(); 87 NOTREACHED();
90 return false; 88 return false;
91 } 89 }
92 90
93 void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) { 91 void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::string* l) {
94 l->append("<IndexedDBKey>("); 92 l->append("<IndexedDBKey>(");
95 LogParam(int(p.type()), l); 93 LogParam(int(p.type()), l);
96 l->append(", "); 94 l->append(", ");
97 LogParam(p.string(), l); 95 LogParam(p.string(), l);
98 l->append(", "); 96 l->append(", ");
99 LogParam(p.date(), l); 97 LogParam(p.date(), l);
100 l->append(", "); 98 l->append(", ");
101 LogParam(p.number(), l); 99 LogParam(p.number(), l);
102 l->append(")"); 100 l->append(")");
103 } 101 }
104 102
105 } // namespace IPC 103 } // namespace IPC
OLDNEW
« no previous file with comments | « content/common/indexed_db_key.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698