OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
30 #include "bindings/modules/v8/IDBBindingUtilities.h" | 30 #include "bindings/modules/v8/IDBBindingUtilities.h" |
31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
32 #include "modules/indexeddb/IDBDatabase.h" | 32 #include "modules/indexeddb/IDBDatabase.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 IDBKeyRange* IDBKeyRange::fromScriptValue(ExecutionContext* context, const Scrip
tValue& value, ExceptionState& exceptionState) | 36 IDBKeyRange* IDBKeyRange::fromScriptValue(ExecutionContext* context, const Scrip
tValue& value, ExceptionState& exceptionState) |
37 { | 37 { |
38 if (value.isUndefined() || value.isNull()) | 38 if (value.isEmpty() || value.isUndefined() || value.isNull()) |
39 return 0; | 39 return 0; |
40 | 40 |
41 IDBKeyRange* range = scriptValueToIDBKeyRange(toIsolate(context), value); | 41 IDBKeyRange* range = scriptValueToIDBKeyRange(toIsolate(context), value); |
42 if (range) | 42 if (range) |
43 return range; | 43 return range; |
44 | 44 |
45 IDBKey* key = scriptValueToIDBKey(toIsolate(context), value); | 45 IDBKey* key = scriptValueToIDBKey(toIsolate(context), value); |
46 if (!key || !key->isValid()) { | 46 if (!key || !key->isValid()) { |
47 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro
rMessage); | 47 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro
rMessage); |
48 return 0; | 48 return 0; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 if (upper->isEqual(lower) && (lowerOpen || upperOpen)) { | 135 if (upper->isEqual(lower) && (lowerOpen || upperOpen)) { |
136 exceptionState.throwDOMException(DataError, "The lower key and upper key
are equal and one of the bounds is open."); | 136 exceptionState.throwDOMException(DataError, "The lower key and upper key
are equal and one of the bounds is open."); |
137 return 0; | 137 return 0; |
138 } | 138 } |
139 | 139 |
140 return IDBKeyRange::create(lower, upper, lowerOpen ? LowerBoundOpen : LowerB
oundClosed, upperOpen ? UpperBoundOpen : UpperBoundClosed); | 140 return IDBKeyRange::create(lower, upper, lowerOpen ? LowerBoundOpen : LowerB
oundClosed, upperOpen ? UpperBoundOpen : UpperBoundClosed); |
141 } | 141 } |
142 | 142 |
143 } // namespace blink | 143 } // namespace blink |
OLD | NEW |