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
// found in the LICENSE file.
......@@ -22,10 +22,6 @@ IndexedDBKey::IndexedDBKey(const WebIDBKey& key) {
IndexedDBKey::~IndexedDBKey() {
}
void IndexedDBKey::SetNull() {
type_ = WebIDBKey::NullType;
}
void IndexedDBKey::SetInvalid() {
type_ = WebIDBKey::InvalidType;
}
......@@ -55,8 +51,6 @@ void IndexedDBKey::Set(const WebIDBKey& key) {
IndexedDBKey::operator WebIDBKey() const {
switch (type_) {
case WebIDBKey::NullType:
return WebIDBKey::createNull();
case WebIDBKey::StringType:
return WebIDBKey::createString(string_);
case WebIDBKey::DateType:
......@@ -64,6 +58,7 @@ IndexedDBKey::operator WebIDBKey() const {
case WebIDBKey::NumberType:
return WebIDBKey::createNumber(number_);
case WebIDBKey::InvalidType:
default: // TODO(jsbell): Remove this case label once NullType is gone
return WebIDBKey::createInvalid();
}
NOTREACHED();
......
......@@ -17,7 +17,6 @@ class CONTENT_EXPORT IndexedDBKey {
explicit IndexedDBKey(const WebKit::WebIDBKey& key);
~IndexedDBKey();
void SetNull();
void SetInvalid();
void SetString(const string16& string);
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
// found in the LICENSE file.
......@@ -70,9 +70,6 @@ bool ParamTraits<IndexedDBKey>::Read(const Message* m,
if (!ok)
return false;
switch (type) {
case WebKit::WebIDBKey::NullType:
r->SetNull();
return true;
case WebKit::WebIDBKey::StringType:
r->SetString(string);
return true;
......@@ -83,6 +80,7 @@ bool ParamTraits<IndexedDBKey>::Read(const Message* m,
r->SetNumber(number);
return true;
case WebKit::WebIDBKey::InvalidType:
default: // TODO(jsbell): Remove this case label once NullType is gone
r->SetInvalid();
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