| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 exception_state.ThrowDOMException( | 82 exception_state.ThrowDOMException( |
| 83 kInvalidStateError, | 83 kInvalidStateError, |
| 84 IDBDatabase::kNotVersionChangeTransactionErrorMessage); | 84 IDBDatabase::kNotVersionChangeTransactionErrorMessage); |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 if (IsDeleted()) { | 87 if (IsDeleted()) { |
| 88 exception_state.ThrowDOMException( | 88 exception_state.ThrowDOMException( |
| 89 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 89 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 90 return; | 90 return; |
| 91 } | 91 } |
| 92 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 93 exception_state.ThrowDOMException( | |
| 94 kTransactionInactiveError, | |
| 95 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 96 return; | |
| 97 } | |
| 98 if (!transaction_->IsActive()) { | 92 if (!transaction_->IsActive()) { |
| 99 exception_state.ThrowDOMException( | 93 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 100 kTransactionInactiveError, | 94 transaction_->InactiveErrorMessage()); |
| 101 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 102 return; | 95 return; |
| 103 } | 96 } |
| 104 | 97 |
| 105 if (this->name() == name) | 98 if (this->name() == name) |
| 106 return; | 99 return; |
| 107 if (transaction_->db()->ContainsObjectStore(name)) { | 100 if (transaction_->db()->ContainsObjectStore(name)) { |
| 108 exception_state.ThrowDOMException( | 101 exception_state.ThrowDOMException( |
| 109 kConstraintError, IDBDatabase::kObjectStoreNameTakenErrorMessage); | 102 kConstraintError, IDBDatabase::kObjectStoreNameTakenErrorMessage); |
| 110 return; | 103 return; |
| 111 } | 104 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 133 | 126 |
| 134 IDBRequest* IDBObjectStore::get(ScriptState* script_state, | 127 IDBRequest* IDBObjectStore::get(ScriptState* script_state, |
| 135 const ScriptValue& key, | 128 const ScriptValue& key, |
| 136 ExceptionState& exception_state) { | 129 ExceptionState& exception_state) { |
| 137 IDB_TRACE("IDBObjectStore::get"); | 130 IDB_TRACE("IDBObjectStore::get"); |
| 138 if (IsDeleted()) { | 131 if (IsDeleted()) { |
| 139 exception_state.ThrowDOMException( | 132 exception_state.ThrowDOMException( |
| 140 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 133 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 141 return nullptr; | 134 return nullptr; |
| 142 } | 135 } |
| 143 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 144 exception_state.ThrowDOMException( | |
| 145 kTransactionInactiveError, | |
| 146 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 147 return nullptr; | |
| 148 } | |
| 149 if (!transaction_->IsActive()) { | 136 if (!transaction_->IsActive()) { |
| 150 exception_state.ThrowDOMException( | 137 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 151 kTransactionInactiveError, | 138 transaction_->InactiveErrorMessage()); |
| 152 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 153 return nullptr; | 139 return nullptr; |
| 154 } | 140 } |
| 155 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 141 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 156 ExecutionContext::From(script_state), key, exception_state); | 142 ExecutionContext::From(script_state), key, exception_state); |
| 157 if (exception_state.HadException()) | 143 if (exception_state.HadException()) |
| 158 return nullptr; | 144 return nullptr; |
| 159 if (!key_range) { | 145 if (!key_range) { |
| 160 exception_state.ThrowDOMException( | 146 exception_state.ThrowDOMException( |
| 161 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); | 147 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); |
| 162 return nullptr; | 148 return nullptr; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 177 | 163 |
| 178 IDBRequest* IDBObjectStore::getKey(ScriptState* script_state, | 164 IDBRequest* IDBObjectStore::getKey(ScriptState* script_state, |
| 179 const ScriptValue& key, | 165 const ScriptValue& key, |
| 180 ExceptionState& exception_state) { | 166 ExceptionState& exception_state) { |
| 181 IDB_TRACE("IDBObjectStore::getKey"); | 167 IDB_TRACE("IDBObjectStore::getKey"); |
| 182 if (IsDeleted()) { | 168 if (IsDeleted()) { |
| 183 exception_state.ThrowDOMException( | 169 exception_state.ThrowDOMException( |
| 184 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 170 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 185 return nullptr; | 171 return nullptr; |
| 186 } | 172 } |
| 187 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 188 exception_state.ThrowDOMException( | |
| 189 kTransactionInactiveError, | |
| 190 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 191 return nullptr; | |
| 192 } | |
| 193 if (!transaction_->IsActive()) { | 173 if (!transaction_->IsActive()) { |
| 194 exception_state.ThrowDOMException( | 174 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 195 kTransactionInactiveError, | 175 transaction_->InactiveErrorMessage()); |
| 196 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 197 return nullptr; | 176 return nullptr; |
| 198 } | 177 } |
| 199 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 178 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 200 ExecutionContext::From(script_state), key, exception_state); | 179 ExecutionContext::From(script_state), key, exception_state); |
| 201 if (exception_state.HadException()) | 180 if (exception_state.HadException()) |
| 202 return nullptr; | 181 return nullptr; |
| 203 if (!key_range) { | 182 if (!key_range) { |
| 204 exception_state.ThrowDOMException( | 183 exception_state.ThrowDOMException( |
| 205 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); | 184 kDataError, IDBDatabase::kNoKeyOrKeyRangeErrorMessage); |
| 206 return nullptr; | 185 return nullptr; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 232 ExceptionState& exception_state) { | 211 ExceptionState& exception_state) { |
| 233 IDB_TRACE("IDBObjectStore::getAll"); | 212 IDB_TRACE("IDBObjectStore::getAll"); |
| 234 if (!max_count) | 213 if (!max_count) |
| 235 max_count = std::numeric_limits<uint32_t>::max(); | 214 max_count = std::numeric_limits<uint32_t>::max(); |
| 236 | 215 |
| 237 if (IsDeleted()) { | 216 if (IsDeleted()) { |
| 238 exception_state.ThrowDOMException( | 217 exception_state.ThrowDOMException( |
| 239 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 218 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 240 return nullptr; | 219 return nullptr; |
| 241 } | 220 } |
| 242 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 243 exception_state.ThrowDOMException( | |
| 244 kTransactionInactiveError, | |
| 245 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 246 return nullptr; | |
| 247 } | |
| 248 if (!transaction_->IsActive()) { | 221 if (!transaction_->IsActive()) { |
| 249 exception_state.ThrowDOMException( | 222 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 250 kTransactionInactiveError, | 223 transaction_->InactiveErrorMessage()); |
| 251 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 252 return nullptr; | 224 return nullptr; |
| 253 } | 225 } |
| 254 IDBKeyRange* range = IDBKeyRange::FromScriptValue( | 226 IDBKeyRange* range = IDBKeyRange::FromScriptValue( |
| 255 ExecutionContext::From(script_state), key_range, exception_state); | 227 ExecutionContext::From(script_state), key_range, exception_state); |
| 256 if (exception_state.HadException()) | 228 if (exception_state.HadException()) |
| 257 return nullptr; | 229 return nullptr; |
| 258 if (!BackendDB()) { | 230 if (!BackendDB()) { |
| 259 exception_state.ThrowDOMException(kInvalidStateError, | 231 exception_state.ThrowDOMException(kInvalidStateError, |
| 260 IDBDatabase::kDatabaseClosedErrorMessage); | 232 IDBDatabase::kDatabaseClosedErrorMessage); |
| 261 return nullptr; | 233 return nullptr; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 282 ExceptionState& exception_state) { | 254 ExceptionState& exception_state) { |
| 283 IDB_TRACE("IDBObjectStore::getAll"); | 255 IDB_TRACE("IDBObjectStore::getAll"); |
| 284 if (!max_count) | 256 if (!max_count) |
| 285 max_count = std::numeric_limits<uint32_t>::max(); | 257 max_count = std::numeric_limits<uint32_t>::max(); |
| 286 | 258 |
| 287 if (IsDeleted()) { | 259 if (IsDeleted()) { |
| 288 exception_state.ThrowDOMException( | 260 exception_state.ThrowDOMException( |
| 289 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 261 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 290 return nullptr; | 262 return nullptr; |
| 291 } | 263 } |
| 292 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 293 exception_state.ThrowDOMException( | |
| 294 kTransactionInactiveError, | |
| 295 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 296 return nullptr; | |
| 297 } | |
| 298 if (!transaction_->IsActive()) { | 264 if (!transaction_->IsActive()) { |
| 299 exception_state.ThrowDOMException( | 265 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 300 kTransactionInactiveError, | 266 transaction_->InactiveErrorMessage()); |
| 301 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 302 return nullptr; | 267 return nullptr; |
| 303 } | 268 } |
| 304 IDBKeyRange* range = IDBKeyRange::FromScriptValue( | 269 IDBKeyRange* range = IDBKeyRange::FromScriptValue( |
| 305 ExecutionContext::From(script_state), key_range, exception_state); | 270 ExecutionContext::From(script_state), key_range, exception_state); |
| 306 if (exception_state.HadException()) | 271 if (exception_state.HadException()) |
| 307 return nullptr; | 272 return nullptr; |
| 308 if (!BackendDB()) { | 273 if (!BackendDB()) { |
| 309 exception_state.ThrowDOMException(kInvalidStateError, | 274 exception_state.ThrowDOMException(kInvalidStateError, |
| 310 IDBDatabase::kDatabaseClosedErrorMessage); | 275 IDBDatabase::kDatabaseClosedErrorMessage); |
| 311 return nullptr; | 276 return nullptr; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 WebIDBPutMode put_mode, | 356 WebIDBPutMode put_mode, |
| 392 IDBAny* source, | 357 IDBAny* source, |
| 393 const ScriptValue& value, | 358 const ScriptValue& value, |
| 394 IDBKey* key, | 359 IDBKey* key, |
| 395 ExceptionState& exception_state) { | 360 ExceptionState& exception_state) { |
| 396 if (IsDeleted()) { | 361 if (IsDeleted()) { |
| 397 exception_state.ThrowDOMException( | 362 exception_state.ThrowDOMException( |
| 398 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 363 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 399 return nullptr; | 364 return nullptr; |
| 400 } | 365 } |
| 401 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 402 exception_state.ThrowDOMException( | |
| 403 kTransactionInactiveError, | |
| 404 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 405 return nullptr; | |
| 406 } | |
| 407 if (!transaction_->IsActive()) { | 366 if (!transaction_->IsActive()) { |
| 408 exception_state.ThrowDOMException( | 367 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 409 kTransactionInactiveError, | 368 transaction_->InactiveErrorMessage()); |
| 410 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 411 return nullptr; | 369 return nullptr; |
| 412 } | 370 } |
| 413 if (transaction_->IsReadOnly()) { | 371 if (transaction_->IsReadOnly()) { |
| 414 exception_state.ThrowDOMException( | 372 exception_state.ThrowDOMException( |
| 415 kReadOnlyError, IDBDatabase::kTransactionReadOnlyErrorMessage); | 373 kReadOnlyError, IDBDatabase::kTransactionReadOnlyErrorMessage); |
| 416 return nullptr; | 374 return nullptr; |
| 417 } | 375 } |
| 418 | 376 |
| 419 v8::Isolate* isolate = script_state->GetIsolate(); | 377 v8::Isolate* isolate = script_state->GetIsolate(); |
| 420 DCHECK(isolate->InContext()); | 378 DCHECK(isolate->InContext()); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 515 |
| 558 IDBRequest* IDBObjectStore::deleteFunction(ScriptState* script_state, | 516 IDBRequest* IDBObjectStore::deleteFunction(ScriptState* script_state, |
| 559 const ScriptValue& key, | 517 const ScriptValue& key, |
| 560 ExceptionState& exception_state) { | 518 ExceptionState& exception_state) { |
| 561 IDB_TRACE("IDBObjectStore::delete"); | 519 IDB_TRACE("IDBObjectStore::delete"); |
| 562 if (IsDeleted()) { | 520 if (IsDeleted()) { |
| 563 exception_state.ThrowDOMException( | 521 exception_state.ThrowDOMException( |
| 564 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 522 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 565 return nullptr; | 523 return nullptr; |
| 566 } | 524 } |
| 567 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 568 exception_state.ThrowDOMException( | |
| 569 kTransactionInactiveError, | |
| 570 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 571 return nullptr; | |
| 572 } | |
| 573 if (!transaction_->IsActive()) { | 525 if (!transaction_->IsActive()) { |
| 574 exception_state.ThrowDOMException( | 526 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 575 kTransactionInactiveError, | 527 transaction_->InactiveErrorMessage()); |
| 576 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 577 return nullptr; | 528 return nullptr; |
| 578 } | 529 } |
| 579 if (transaction_->IsReadOnly()) { | 530 if (transaction_->IsReadOnly()) { |
| 580 exception_state.ThrowDOMException( | 531 exception_state.ThrowDOMException( |
| 581 kReadOnlyError, IDBDatabase::kTransactionReadOnlyErrorMessage); | 532 kReadOnlyError, IDBDatabase::kTransactionReadOnlyErrorMessage); |
| 582 return nullptr; | 533 return nullptr; |
| 583 } | 534 } |
| 584 | 535 |
| 585 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 536 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 586 ExecutionContext::From(script_state), key, exception_state); | 537 ExecutionContext::From(script_state), key, exception_state); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 605 } | 556 } |
| 606 | 557 |
| 607 IDBRequest* IDBObjectStore::clear(ScriptState* script_state, | 558 IDBRequest* IDBObjectStore::clear(ScriptState* script_state, |
| 608 ExceptionState& exception_state) { | 559 ExceptionState& exception_state) { |
| 609 IDB_TRACE("IDBObjectStore::clear"); | 560 IDB_TRACE("IDBObjectStore::clear"); |
| 610 if (IsDeleted()) { | 561 if (IsDeleted()) { |
| 611 exception_state.ThrowDOMException( | 562 exception_state.ThrowDOMException( |
| 612 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 563 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 613 return nullptr; | 564 return nullptr; |
| 614 } | 565 } |
| 615 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 616 exception_state.ThrowDOMException( | |
| 617 kTransactionInactiveError, | |
| 618 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 619 return nullptr; | |
| 620 } | |
| 621 if (!transaction_->IsActive()) { | 566 if (!transaction_->IsActive()) { |
| 622 exception_state.ThrowDOMException( | 567 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 623 kTransactionInactiveError, | 568 transaction_->InactiveErrorMessage()); |
| 624 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 625 return nullptr; | 569 return nullptr; |
| 626 } | 570 } |
| 627 if (transaction_->IsReadOnly()) { | 571 if (transaction_->IsReadOnly()) { |
| 628 exception_state.ThrowDOMException( | 572 exception_state.ThrowDOMException( |
| 629 kReadOnlyError, IDBDatabase::kTransactionReadOnlyErrorMessage); | 573 kReadOnlyError, IDBDatabase::kTransactionReadOnlyErrorMessage); |
| 630 return nullptr; | 574 return nullptr; |
| 631 } | 575 } |
| 632 if (!BackendDB()) { | 576 if (!BackendDB()) { |
| 633 exception_state.ThrowDOMException(kInvalidStateError, | 577 exception_state.ThrowDOMException(kInvalidStateError, |
| 634 IDBDatabase::kDatabaseClosedErrorMessage); | 578 IDBDatabase::kDatabaseClosedErrorMessage); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 exception_state.ThrowDOMException( | 693 exception_state.ThrowDOMException( |
| 750 kInvalidStateError, | 694 kInvalidStateError, |
| 751 IDBDatabase::kNotVersionChangeTransactionErrorMessage); | 695 IDBDatabase::kNotVersionChangeTransactionErrorMessage); |
| 752 return nullptr; | 696 return nullptr; |
| 753 } | 697 } |
| 754 if (IsDeleted()) { | 698 if (IsDeleted()) { |
| 755 exception_state.ThrowDOMException( | 699 exception_state.ThrowDOMException( |
| 756 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 700 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 757 return nullptr; | 701 return nullptr; |
| 758 } | 702 } |
| 759 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 760 exception_state.ThrowDOMException( | |
| 761 kTransactionInactiveError, | |
| 762 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 763 return nullptr; | |
| 764 } | |
| 765 if (!transaction_->IsActive()) { | 703 if (!transaction_->IsActive()) { |
| 766 exception_state.ThrowDOMException( | 704 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 767 kTransactionInactiveError, | 705 transaction_->InactiveErrorMessage()); |
| 768 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 769 return nullptr; | 706 return nullptr; |
| 770 } | 707 } |
| 771 if (ContainsIndex(name)) { | 708 if (ContainsIndex(name)) { |
| 772 exception_state.ThrowDOMException(kConstraintError, | 709 exception_state.ThrowDOMException(kConstraintError, |
| 773 IDBDatabase::kIndexNameTakenErrorMessage); | 710 IDBDatabase::kIndexNameTakenErrorMessage); |
| 774 return nullptr; | 711 return nullptr; |
| 775 } | 712 } |
| 776 if (!key_path.IsValid()) { | 713 if (!key_path.IsValid()) { |
| 777 exception_state.ThrowDOMException( | 714 exception_state.ThrowDOMException( |
| 778 kSyntaxError, "The keyPath argument contains an invalid key path."); | 715 kSyntaxError, "The keyPath argument contains an invalid key path."); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 exception_state.ThrowDOMException( | 799 exception_state.ThrowDOMException( |
| 863 kInvalidStateError, | 800 kInvalidStateError, |
| 864 IDBDatabase::kNotVersionChangeTransactionErrorMessage); | 801 IDBDatabase::kNotVersionChangeTransactionErrorMessage); |
| 865 return; | 802 return; |
| 866 } | 803 } |
| 867 if (IsDeleted()) { | 804 if (IsDeleted()) { |
| 868 exception_state.ThrowDOMException( | 805 exception_state.ThrowDOMException( |
| 869 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 806 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 870 return; | 807 return; |
| 871 } | 808 } |
| 872 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 873 exception_state.ThrowDOMException( | |
| 874 kTransactionInactiveError, | |
| 875 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 876 return; | |
| 877 } | |
| 878 if (!transaction_->IsActive()) { | 809 if (!transaction_->IsActive()) { |
| 879 exception_state.ThrowDOMException( | 810 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 880 kTransactionInactiveError, | 811 transaction_->InactiveErrorMessage()); |
| 881 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 882 return; | 812 return; |
| 883 } | 813 } |
| 884 int64_t index_id = FindIndexId(name); | 814 int64_t index_id = FindIndexId(name); |
| 885 if (index_id == IDBIndexMetadata::kInvalidId) { | 815 if (index_id == IDBIndexMetadata::kInvalidId) { |
| 886 exception_state.ThrowDOMException(kNotFoundError, | 816 exception_state.ThrowDOMException(kNotFoundError, |
| 887 IDBDatabase::kNoSuchIndexErrorMessage); | 817 IDBDatabase::kNoSuchIndexErrorMessage); |
| 888 return; | 818 return; |
| 889 } | 819 } |
| 890 if (!BackendDB()) { | 820 if (!BackendDB()) { |
| 891 exception_state.ThrowDOMException(kInvalidStateError, | 821 exception_state.ThrowDOMException(kInvalidStateError, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 907 IDBRequest* IDBObjectStore::openCursor(ScriptState* script_state, | 837 IDBRequest* IDBObjectStore::openCursor(ScriptState* script_state, |
| 908 const ScriptValue& range, | 838 const ScriptValue& range, |
| 909 const String& direction_string, | 839 const String& direction_string, |
| 910 ExceptionState& exception_state) { | 840 ExceptionState& exception_state) { |
| 911 IDB_TRACE("IDBObjectStore::openCursor"); | 841 IDB_TRACE("IDBObjectStore::openCursor"); |
| 912 if (IsDeleted()) { | 842 if (IsDeleted()) { |
| 913 exception_state.ThrowDOMException( | 843 exception_state.ThrowDOMException( |
| 914 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 844 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 915 return nullptr; | 845 return nullptr; |
| 916 } | 846 } |
| 917 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 918 exception_state.ThrowDOMException( | |
| 919 kTransactionInactiveError, | |
| 920 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 921 return nullptr; | |
| 922 } | |
| 923 if (!transaction_->IsActive()) { | 847 if (!transaction_->IsActive()) { |
| 924 exception_state.ThrowDOMException( | 848 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 925 kTransactionInactiveError, | 849 transaction_->InactiveErrorMessage()); |
| 926 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 927 return nullptr; | 850 return nullptr; |
| 928 } | 851 } |
| 929 | 852 |
| 930 WebIDBCursorDirection direction = | 853 WebIDBCursorDirection direction = |
| 931 IDBCursor::StringToDirection(direction_string); | 854 IDBCursor::StringToDirection(direction_string); |
| 932 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 855 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 933 ExecutionContext::From(script_state), range, exception_state); | 856 ExecutionContext::From(script_state), range, exception_state); |
| 934 if (exception_state.HadException()) | 857 if (exception_state.HadException()) |
| 935 return nullptr; | 858 return nullptr; |
| 936 | 859 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 960 IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* script_state, | 883 IDBRequest* IDBObjectStore::openKeyCursor(ScriptState* script_state, |
| 961 const ScriptValue& range, | 884 const ScriptValue& range, |
| 962 const String& direction_string, | 885 const String& direction_string, |
| 963 ExceptionState& exception_state) { | 886 ExceptionState& exception_state) { |
| 964 IDB_TRACE("IDBObjectStore::openKeyCursor"); | 887 IDB_TRACE("IDBObjectStore::openKeyCursor"); |
| 965 if (IsDeleted()) { | 888 if (IsDeleted()) { |
| 966 exception_state.ThrowDOMException( | 889 exception_state.ThrowDOMException( |
| 967 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 890 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 968 return nullptr; | 891 return nullptr; |
| 969 } | 892 } |
| 970 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 971 exception_state.ThrowDOMException( | |
| 972 kTransactionInactiveError, | |
| 973 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 974 return nullptr; | |
| 975 } | |
| 976 if (!transaction_->IsActive()) { | 893 if (!transaction_->IsActive()) { |
| 977 exception_state.ThrowDOMException( | 894 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 978 kTransactionInactiveError, | 895 transaction_->InactiveErrorMessage()); |
| 979 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 980 return nullptr; | 896 return nullptr; |
| 981 } | 897 } |
| 982 | 898 |
| 983 WebIDBCursorDirection direction = | 899 WebIDBCursorDirection direction = |
| 984 IDBCursor::StringToDirection(direction_string); | 900 IDBCursor::StringToDirection(direction_string); |
| 985 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 901 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 986 ExecutionContext::From(script_state), range, exception_state); | 902 ExecutionContext::From(script_state), range, exception_state); |
| 987 if (exception_state.HadException()) | 903 if (exception_state.HadException()) |
| 988 return nullptr; | 904 return nullptr; |
| 989 | 905 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1006 | 922 |
| 1007 IDBRequest* IDBObjectStore::count(ScriptState* script_state, | 923 IDBRequest* IDBObjectStore::count(ScriptState* script_state, |
| 1008 const ScriptValue& range, | 924 const ScriptValue& range, |
| 1009 ExceptionState& exception_state) { | 925 ExceptionState& exception_state) { |
| 1010 IDB_TRACE("IDBObjectStore::count"); | 926 IDB_TRACE("IDBObjectStore::count"); |
| 1011 if (IsDeleted()) { | 927 if (IsDeleted()) { |
| 1012 exception_state.ThrowDOMException( | 928 exception_state.ThrowDOMException( |
| 1013 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); | 929 kInvalidStateError, IDBDatabase::kObjectStoreDeletedErrorMessage); |
| 1014 return nullptr; | 930 return nullptr; |
| 1015 } | 931 } |
| 1016 if (transaction_->IsFinished() || transaction_->IsFinishing()) { | |
| 1017 exception_state.ThrowDOMException( | |
| 1018 kTransactionInactiveError, | |
| 1019 IDBDatabase::kTransactionFinishedErrorMessage); | |
| 1020 return nullptr; | |
| 1021 } | |
| 1022 if (!transaction_->IsActive()) { | 932 if (!transaction_->IsActive()) { |
| 1023 exception_state.ThrowDOMException( | 933 exception_state.ThrowDOMException(kTransactionInactiveError, |
| 1024 kTransactionInactiveError, | 934 transaction_->InactiveErrorMessage()); |
| 1025 IDBDatabase::kTransactionInactiveErrorMessage); | |
| 1026 return nullptr; | 935 return nullptr; |
| 1027 } | 936 } |
| 1028 | 937 |
| 1029 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( | 938 IDBKeyRange* key_range = IDBKeyRange::FromScriptValue( |
| 1030 ExecutionContext::From(script_state), range, exception_state); | 939 ExecutionContext::From(script_state), range, exception_state); |
| 1031 if (exception_state.HadException()) | 940 if (exception_state.HadException()) |
| 1032 return nullptr; | 941 return nullptr; |
| 1033 | 942 |
| 1034 if (!BackendDB()) { | 943 if (!BackendDB()) { |
| 1035 exception_state.ThrowDOMException(kInvalidStateError, | 944 exception_state.ThrowDOMException(kInvalidStateError, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1143 } | 1052 } |
| 1144 } | 1053 } |
| 1145 return IDBIndexMetadata::kInvalidId; | 1054 return IDBIndexMetadata::kInvalidId; |
| 1146 } | 1055 } |
| 1147 | 1056 |
| 1148 WebIDBDatabase* IDBObjectStore::BackendDB() const { | 1057 WebIDBDatabase* IDBObjectStore::BackendDB() const { |
| 1149 return transaction_->BackendDB(); | 1058 return transaction_->BackendDB(); |
| 1150 } | 1059 } |
| 1151 | 1060 |
| 1152 } // namespace blink | 1061 } // namespace blink |
| OLD | NEW |