Commit d200a0c5 authored by jsbell@chromium.org's avatar jsbell@chromium.org

IndexedDB: Wrong exception types thrown for invalid keys

Chromium side of WebKit patch: https://bugs.webkit.org/show_bug.cgi?id=70065
This drops the Chromium dependency on WebIDBKey::NullType and treats it the
same as WebIDBKey::InvalidType. Once this has landed, the second half of
the WebKit side can go in and (finally) the default: cases herein ensuring
all enumeration parameters are handled can be removed.

BUG=98930
TEST=

Review URL: http://codereview.chromium.org/8276023

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107744 0039d316-1c4b-4281-b951-d872f2087c98
parent fdd3f84a
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -22,10 +22,6 @@ IndexedDBKey::IndexedDBKey(const WebIDBKey& key) { ...@@ -22,10 +22,6 @@ IndexedDBKey::IndexedDBKey(const WebIDBKey& key) {
IndexedDBKey::~IndexedDBKey() { IndexedDBKey::~IndexedDBKey() {
} }
void IndexedDBKey::SetNull() {
type_ = WebIDBKey::NullType;
}
void IndexedDBKey::SetInvalid() { void IndexedDBKey::SetInvalid() {
type_ = WebIDBKey::InvalidType; type_ = WebIDBKey::InvalidType;
} }
...@@ -55,8 +51,6 @@ void IndexedDBKey::Set(const WebIDBKey& key) { ...@@ -55,8 +51,6 @@ void IndexedDBKey::Set(const WebIDBKey& key) {
IndexedDBKey::operator WebIDBKey() const { IndexedDBKey::operator WebIDBKey() const {
switch (type_) { switch (type_) {
case WebIDBKey::NullType:
return WebIDBKey::createNull();
case WebIDBKey::StringType: case WebIDBKey::StringType:
return WebIDBKey::createString(string_); return WebIDBKey::createString(string_);
case WebIDBKey::DateType: case WebIDBKey::DateType:
...@@ -64,6 +58,7 @@ IndexedDBKey::operator WebIDBKey() const { ...@@ -64,6 +58,7 @@ IndexedDBKey::operator WebIDBKey() const {
case WebIDBKey::NumberType: case WebIDBKey::NumberType:
return WebIDBKey::createNumber(number_); return WebIDBKey::createNumber(number_);
case WebIDBKey::InvalidType: case WebIDBKey::InvalidType:
default: // TODO(jsbell): Remove this case label once NullType is gone
return WebIDBKey::createInvalid(); return WebIDBKey::createInvalid();
} }
NOTREACHED(); NOTREACHED();
......
...@@ -17,7 +17,6 @@ class CONTENT_EXPORT IndexedDBKey { ...@@ -17,7 +17,6 @@ class CONTENT_EXPORT IndexedDBKey {
explicit IndexedDBKey(const WebKit::WebIDBKey& key); explicit IndexedDBKey(const WebKit::WebIDBKey& key);
~IndexedDBKey(); ~IndexedDBKey();
void SetNull();
void SetInvalid(); void SetInvalid();
void SetString(const string16& string); void SetString(const string16& string);
void SetDate(double date); void SetDate(double date);
......
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -70,9 +70,6 @@ bool ParamTraits<IndexedDBKey>::Read(const Message* m, ...@@ -70,9 +70,6 @@ bool ParamTraits<IndexedDBKey>::Read(const Message* m,
if (!ok) if (!ok)
return false; return false;
switch (type) { switch (type) {
case WebKit::WebIDBKey::NullType:
r->SetNull();
return true;
case WebKit::WebIDBKey::StringType: case WebKit::WebIDBKey::StringType:
r->SetString(string); r->SetString(string);
return true; return true;
...@@ -83,6 +80,7 @@ bool ParamTraits<IndexedDBKey>::Read(const Message* m, ...@@ -83,6 +80,7 @@ bool ParamTraits<IndexedDBKey>::Read(const Message* m,
r->SetNumber(number); r->SetNumber(number);
return true; return true;
case WebKit::WebIDBKey::InvalidType: case WebKit::WebIDBKey::InvalidType:
default: // TODO(jsbell): Remove this case label once NullType is gone
r->SetInvalid(); r->SetInvalid();
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment