Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: sdk/lib/indexed_db/dartium/indexed_db_dartium.dart

Issue 15138002: Added tests to previously broken functionality and added null checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library dart.dom.indexed_db; 1 library dart.dom.indexed_db;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:html'; 4 import 'dart:html';
5 import 'dart:html_common'; 5 import 'dart:html_common';
6 import 'dart:nativewrappers'; 6 import 'dart:nativewrappers';
7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 7 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
8 // for details. All rights reserved. Use of this source code is governed by a 8 // for details. All rights reserved. Use of this source code is governed by a
9 // BSD-style license that can be found in the LICENSE file. 9 // BSD-style license that can be found in the LICENSE file.
10 10
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 ObjectStore get objectStore native "IDBIndex_objectStore_Getter"; 464 ObjectStore get objectStore native "IDBIndex_objectStore_Getter";
465 465
466 @DomName('IDBIndex.unique') 466 @DomName('IDBIndex.unique')
467 @DocsEditable 467 @DocsEditable
468 bool get unique native "IDBIndex_unique_Getter"; 468 bool get unique native "IDBIndex_unique_Getter";
469 469
470 Request $dom_count([key_OR_range]) { 470 Request $dom_count([key_OR_range]) {
471 if ((key_OR_range is KeyRange || key_OR_range == null)) { 471 if ((key_OR_range is KeyRange || key_OR_range == null)) {
472 return _count_1(key_OR_range); 472 return _count_1(key_OR_range);
473 } 473 }
474 if (?key_OR_range) { 474 if (?key_OR_range && key_OR_range != null) {
475 return _count_2(key_OR_range); 475 return _count_2(key_OR_range);
476 } 476 }
477 throw new ArgumentError("Incorrect number or type of arguments"); 477 throw new ArgumentError("Incorrect number or type of arguments");
478 } 478 }
479 479
480 Request _count_1(key_OR_range) native "IDBIndex__count_1_Callback"; 480 Request _count_1(key_OR_range) native "IDBIndex__count_1_Callback";
481 481
482 Request _count_2(key_OR_range) native "IDBIndex__count_2_Callback"; 482 Request _count_2(key_OR_range) native "IDBIndex__count_2_Callback";
483 483
484 Request $dom_get(key) { 484 Request $dom_get(key) {
485 if ((key is KeyRange || key == null)) { 485 if ((key is KeyRange || key == null)) {
486 return _get_1(key); 486 return _get_1(key);
487 } 487 }
488 if (?key) { 488 if (?key && key != null) {
Anton Muhin 2013/05/21 13:24:08 why there are both checks?
Andrei Mouravski 2013/05/21 18:39:14 Because removing the question mark is in the next
489 return _get_2(key); 489 return _get_2(key);
490 } 490 }
491 throw new ArgumentError("Incorrect number or type of arguments"); 491 throw new ArgumentError("Incorrect number or type of arguments");
492 } 492 }
493 493
494 Request _get_1(key) native "IDBIndex__get_1_Callback"; 494 Request _get_1(key) native "IDBIndex__get_1_Callback";
495 495
496 Request _get_2(key) native "IDBIndex__get_2_Callback"; 496 Request _get_2(key) native "IDBIndex__get_2_Callback";
497 497
498 Request $dom_getKey(key) { 498 Request $dom_getKey(key) {
499 if ((key is KeyRange || key == null)) { 499 if ((key is KeyRange || key == null)) {
500 return _getKey_1(key); 500 return _getKey_1(key);
501 } 501 }
502 if (?key) { 502 if (?key && key != null) {
503 return _getKey_2(key); 503 return _getKey_2(key);
504 } 504 }
505 throw new ArgumentError("Incorrect number or type of arguments"); 505 throw new ArgumentError("Incorrect number or type of arguments");
506 } 506 }
507 507
508 Request _getKey_1(key) native "IDBIndex__getKey_1_Callback"; 508 Request _getKey_1(key) native "IDBIndex__getKey_1_Callback";
509 509
510 Request _getKey_2(key) native "IDBIndex__getKey_2_Callback"; 510 Request _getKey_2(key) native "IDBIndex__getKey_2_Callback";
511 511
512 Request $dom_openCursor([key_OR_range, String direction]) { 512 Request $dom_openCursor([key_OR_range, String direction]) {
513 if ((key_OR_range is KeyRange || key_OR_range == null) && (direction is Stri ng || direction == null)) { 513 if ((key_OR_range is KeyRange || key_OR_range == null) && (direction is Stri ng || direction == null)) {
514 return _openCursor_1(key_OR_range, direction); 514 return _openCursor_1(key_OR_range, direction);
515 } 515 }
516 if (?key_OR_range && (direction is String || direction == null)) { 516 if (?key_OR_range && key_OR_range != null && (direction is String || directi on == null)) {
517 return _openCursor_2(key_OR_range, direction); 517 return _openCursor_2(key_OR_range, direction);
518 } 518 }
519 throw new ArgumentError("Incorrect number or type of arguments"); 519 throw new ArgumentError("Incorrect number or type of arguments");
520 } 520 }
521 521
522 Request _openCursor_1(key_OR_range, direction) native "IDBIndex__openCursor_1_ Callback"; 522 Request _openCursor_1(key_OR_range, direction) native "IDBIndex__openCursor_1_ Callback";
523 523
524 Request _openCursor_2(key_OR_range, direction) native "IDBIndex__openCursor_2_ Callback"; 524 Request _openCursor_2(key_OR_range, direction) native "IDBIndex__openCursor_2_ Callback";
525 525
526 Request $dom_openKeyCursor([key_OR_range, String direction]) { 526 Request $dom_openKeyCursor([key_OR_range, String direction]) {
527 if ((key_OR_range is KeyRange || key_OR_range == null) && (direction is Stri ng || direction == null)) { 527 if ((key_OR_range is KeyRange || key_OR_range == null) && (direction is Stri ng || direction == null)) {
528 return _openKeyCursor_1(key_OR_range, direction); 528 return _openKeyCursor_1(key_OR_range, direction);
529 } 529 }
530 if (?key_OR_range && (direction is String || direction == null)) { 530 if (?key_OR_range && key_OR_range != null && (direction is String || directi on == null)) {
531 return _openKeyCursor_2(key_OR_range, direction); 531 return _openKeyCursor_2(key_OR_range, direction);
532 } 532 }
533 throw new ArgumentError("Incorrect number or type of arguments"); 533 throw new ArgumentError("Incorrect number or type of arguments");
534 } 534 }
535 535
536 Request _openKeyCursor_1(key_OR_range, direction) native "IDBIndex__openKeyCur sor_1_Callback"; 536 Request _openKeyCursor_1(key_OR_range, direction) native "IDBIndex__openKeyCur sor_1_Callback";
537 537
538 Request _openKeyCursor_2(key_OR_range, direction) native "IDBIndex__openKeyCur sor_2_Callback"; 538 Request _openKeyCursor_2(key_OR_range, direction) native "IDBIndex__openKeyCur sor_2_Callback";
539 539
540 } 540 }
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 Request $dom_add(Object value, [Object key]) native "IDBObjectStore_add_Callba ck"; 764 Request $dom_add(Object value, [Object key]) native "IDBObjectStore_add_Callba ck";
765 765
766 @DomName('IDBObjectStore.clear') 766 @DomName('IDBObjectStore.clear')
767 @DocsEditable 767 @DocsEditable
768 Request $dom_clear() native "IDBObjectStore_clear_Callback"; 768 Request $dom_clear() native "IDBObjectStore_clear_Callback";
769 769
770 Request $dom_count([key_OR_range]) { 770 Request $dom_count([key_OR_range]) {
771 if ((key_OR_range is KeyRange || key_OR_range == null)) { 771 if ((key_OR_range is KeyRange || key_OR_range == null)) {
772 return _count_1(key_OR_range); 772 return _count_1(key_OR_range);
773 } 773 }
774 if (?key_OR_range) { 774 if (?key_OR_range && key_OR_range != null) {
775 return _count_2(key_OR_range); 775 return _count_2(key_OR_range);
776 } 776 }
777 throw new ArgumentError("Incorrect number or type of arguments"); 777 throw new ArgumentError("Incorrect number or type of arguments");
778 } 778 }
779 779
780 Request _count_1(key_OR_range) native "IDBObjectStore__count_1_Callback"; 780 Request _count_1(key_OR_range) native "IDBObjectStore__count_1_Callback";
781 781
782 Request _count_2(key_OR_range) native "IDBObjectStore__count_2_Callback"; 782 Request _count_2(key_OR_range) native "IDBObjectStore__count_2_Callback";
783 783
784 Index $dom_createIndex(String name, keyPath, [Map options]) { 784 Index $dom_createIndex(String name, keyPath, [Map options]) {
785 if ((name is String || name == null) && (keyPath is List<String> || keyPath == null) && (options is Map || options == null)) { 785 if ((name is String || name == null) && (keyPath is List<String> || keyPath == null) && (options is Map || options == null)) {
786 return _createIndex_1(name, keyPath, options); 786 return _createIndex_1(name, keyPath, options);
787 } 787 }
788 if ((name is String || name == null) && (keyPath is String || keyPath == nul l) && (options is Map || options == null)) { 788 if ((name is String || name == null) && (keyPath is String || keyPath == nul l) && (options is Map || options == null)) {
789 return _createIndex_2(name, keyPath, options); 789 return _createIndex_2(name, keyPath, options);
790 } 790 }
791 throw new ArgumentError("Incorrect number or type of arguments"); 791 throw new ArgumentError("Incorrect number or type of arguments");
792 } 792 }
793 793
794 Index _createIndex_1(name, keyPath, options) native "IDBObjectStore__createInd ex_1_Callback"; 794 Index _createIndex_1(name, keyPath, options) native "IDBObjectStore__createInd ex_1_Callback";
795 795
796 Index _createIndex_2(name, keyPath, options) native "IDBObjectStore__createInd ex_2_Callback"; 796 Index _createIndex_2(name, keyPath, options) native "IDBObjectStore__createInd ex_2_Callback";
797 797
798 Request $dom_delete(key_OR_keyRange) { 798 Request $dom_delete(key_OR_keyRange) {
799 if ((key_OR_keyRange is KeyRange || key_OR_keyRange == null)) { 799 if ((key_OR_keyRange is KeyRange || key_OR_keyRange == null)) {
800 return _delete_1(key_OR_keyRange); 800 return _delete_1(key_OR_keyRange);
801 } 801 }
802 if (?key_OR_keyRange) { 802 if (?key_OR_keyRange && key_OR_keyRange != null) {
803 return _delete_2(key_OR_keyRange); 803 return _delete_2(key_OR_keyRange);
804 } 804 }
805 throw new ArgumentError("Incorrect number or type of arguments"); 805 throw new ArgumentError("Incorrect number or type of arguments");
806 } 806 }
807 807
808 Request _delete_1(key_OR_keyRange) native "IDBObjectStore__delete_1_Callback"; 808 Request _delete_1(key_OR_keyRange) native "IDBObjectStore__delete_1_Callback";
809 809
810 Request _delete_2(key_OR_keyRange) native "IDBObjectStore__delete_2_Callback"; 810 Request _delete_2(key_OR_keyRange) native "IDBObjectStore__delete_2_Callback";
811 811
812 @DomName('IDBObjectStore.deleteIndex') 812 @DomName('IDBObjectStore.deleteIndex')
813 @DocsEditable 813 @DocsEditable
814 void deleteIndex(String name) native "IDBObjectStore_deleteIndex_Callback"; 814 void deleteIndex(String name) native "IDBObjectStore_deleteIndex_Callback";
815 815
816 Request $dom_get(key) { 816 Request $dom_get(key) {
817 if ((key is KeyRange || key == null)) { 817 if ((key is KeyRange || key == null)) {
818 return _get_1(key); 818 return _get_1(key);
819 } 819 }
820 if (?key) { 820 if (?key && key != null) {
821 return _get_2(key); 821 return _get_2(key);
822 } 822 }
823 throw new ArgumentError("Incorrect number or type of arguments"); 823 throw new ArgumentError("Incorrect number or type of arguments");
824 } 824 }
825 825
826 Request _get_1(key) native "IDBObjectStore__get_1_Callback"; 826 Request _get_1(key) native "IDBObjectStore__get_1_Callback";
827 827
828 Request _get_2(key) native "IDBObjectStore__get_2_Callback"; 828 Request _get_2(key) native "IDBObjectStore__get_2_Callback";
829 829
830 @DomName('IDBObjectStore.index') 830 @DomName('IDBObjectStore.index')
831 @DocsEditable 831 @DocsEditable
832 Index index(String name) native "IDBObjectStore_index_Callback"; 832 Index index(String name) native "IDBObjectStore_index_Callback";
833 833
834 Request $dom_openCursor([key_OR_range, String direction]) { 834 Request $dom_openCursor([key_OR_range, String direction]) {
835 if ((key_OR_range is KeyRange || key_OR_range == null) && (direction is Stri ng || direction == null)) { 835 if ((key_OR_range is KeyRange || key_OR_range == null) && (direction is Stri ng || direction == null)) {
836 return _openCursor_1(key_OR_range, direction); 836 return _openCursor_1(key_OR_range, direction);
837 } 837 }
838 if (?key_OR_range && (direction is String || direction == null)) { 838 if (?key_OR_range && key_OR_range != null && (direction is String || directi on == null)) {
839 return _openCursor_2(key_OR_range, direction); 839 return _openCursor_2(key_OR_range, direction);
840 } 840 }
841 throw new ArgumentError("Incorrect number or type of arguments"); 841 throw new ArgumentError("Incorrect number or type of arguments");
842 } 842 }
843 843
844 Request _openCursor_1(key_OR_range, direction) native "IDBObjectStore__openCur sor_1_Callback"; 844 Request _openCursor_1(key_OR_range, direction) native "IDBObjectStore__openCur sor_1_Callback";
845 845
846 Request _openCursor_2(key_OR_range, direction) native "IDBObjectStore__openCur sor_2_Callback"; 846 Request _openCursor_2(key_OR_range, direction) native "IDBObjectStore__openCur sor_2_Callback";
847 847
848 @DomName('IDBObjectStore.put') 848 @DomName('IDBObjectStore.put')
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 1102
1103 // WARNING: Do not edit - generated code. 1103 // WARNING: Do not edit - generated code.
1104 1104
1105 1105
1106 @DocsEditable 1106 @DocsEditable
1107 @DomName('IDBAny') 1107 @DomName('IDBAny')
1108 abstract class _IDBAny extends NativeFieldWrapperClass1 { 1108 abstract class _IDBAny extends NativeFieldWrapperClass1 {
1109 _IDBAny.internal(); 1109 _IDBAny.internal();
1110 1110
1111 } 1111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698