| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 IDBKeyRange* IDBKeyRange::lowerBound(ExecutionContext* context, const ScriptValu
e& boundValue, bool open, ExceptionState& exceptionState) | 104 IDBKeyRange* IDBKeyRange::lowerBound(ExecutionContext* context, const ScriptValu
e& boundValue, bool open, ExceptionState& exceptionState) |
| 105 { | 105 { |
| 106 IDBKey* bound = ScriptValue::to<IDBKey*>(toIsolate(context), boundValue, exc
eptionState); | 106 IDBKey* bound = ScriptValue::to<IDBKey*>(toIsolate(context), boundValue, exc
eptionState); |
| 107 if (exceptionState.hadException()) | 107 if (exceptionState.hadException()) |
| 108 return nullptr; | 108 return nullptr; |
| 109 if (!bound || !bound->isValid()) { | 109 if (!bound || !bound->isValid()) { |
| 110 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro
rMessage); | 110 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro
rMessage); |
| 111 return nullptr; | 111 return nullptr; |
| 112 } | 112 } |
| 113 | 113 |
| 114 return IDBKeyRange::create(bound, 0, open ? LowerBoundOpen : LowerBoundClose
d, UpperBoundOpen); | 114 return IDBKeyRange::create(bound, nullptr, open ? LowerBoundOpen : LowerBoun
dClosed, UpperBoundOpen); |
| 115 } | 115 } |
| 116 | 116 |
| 117 IDBKeyRange* IDBKeyRange::upperBound(ExecutionContext* context, const ScriptValu
e& boundValue, bool open, ExceptionState& exceptionState) | 117 IDBKeyRange* IDBKeyRange::upperBound(ExecutionContext* context, const ScriptValu
e& boundValue, bool open, ExceptionState& exceptionState) |
| 118 { | 118 { |
| 119 IDBKey* bound = ScriptValue::to<IDBKey*>(toIsolate(context), boundValue, exc
eptionState); | 119 IDBKey* bound = ScriptValue::to<IDBKey*>(toIsolate(context), boundValue, exc
eptionState); |
| 120 if (exceptionState.hadException()) | 120 if (exceptionState.hadException()) |
| 121 return nullptr; | 121 return nullptr; |
| 122 if (!bound || !bound->isValid()) { | 122 if (!bound || !bound->isValid()) { |
| 123 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro
rMessage); | 123 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro
rMessage); |
| 124 return nullptr; | 124 return nullptr; |
| 125 } | 125 } |
| 126 | 126 |
| 127 return IDBKeyRange::create(0, bound, LowerBoundOpen, open ? UpperBoundOpen :
UpperBoundClosed); | 127 return IDBKeyRange::create(nullptr, bound, LowerBoundOpen, open ? UpperBound
Open : UpperBoundClosed); |
| 128 } | 128 } |
| 129 | 129 |
| 130 IDBKeyRange* IDBKeyRange::bound(ExecutionContext* context, const ScriptValue& lo
werValue, const ScriptValue& upperValue, bool lowerOpen, bool upperOpen, Excepti
onState& exceptionState) | 130 IDBKeyRange* IDBKeyRange::bound(ExecutionContext* context, const ScriptValue& lo
werValue, const ScriptValue& upperValue, bool lowerOpen, bool upperOpen, Excepti
onState& exceptionState) |
| 131 { | 131 { |
| 132 IDBKey* lower = ScriptValue::to<IDBKey*>(toIsolate(context), lowerValue, exc
eptionState); | 132 IDBKey* lower = ScriptValue::to<IDBKey*>(toIsolate(context), lowerValue, exc
eptionState); |
| 133 if (exceptionState.hadException()) | 133 if (exceptionState.hadException()) |
| 134 return nullptr; | 134 return nullptr; |
| 135 if (!lower || !lower->isValid()) { | 135 if (!lower || !lower->isValid()) { |
| 136 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro
rMessage); | 136 exceptionState.throwDOMException(DataError, IDBDatabase::notValidKeyErro
rMessage); |
| 137 return nullptr; | 137 return nullptr; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 151 } | 151 } |
| 152 if (upper->isEqual(lower) && (lowerOpen || upperOpen)) { | 152 if (upper->isEqual(lower) && (lowerOpen || upperOpen)) { |
| 153 exceptionState.throwDOMException(DataError, "The lower key and upper key
are equal and one of the bounds is open."); | 153 exceptionState.throwDOMException(DataError, "The lower key and upper key
are equal and one of the bounds is open."); |
| 154 return nullptr; | 154 return nullptr; |
| 155 } | 155 } |
| 156 | 156 |
| 157 return IDBKeyRange::create(lower, upper, lowerOpen ? LowerBoundOpen : LowerB
oundClosed, upperOpen ? UpperBoundOpen : UpperBoundClosed); | 157 return IDBKeyRange::create(lower, upper, lowerOpen ? LowerBoundOpen : LowerB
oundClosed, upperOpen ? UpperBoundOpen : UpperBoundClosed); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace blink | 160 } // namespace blink |
| OLD | NEW |