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

Unified Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11434079: Adding dart:indexed_db. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Syncing with latest. Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/libraries.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/html/dart2js/html_dart2js.dart
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index d7ab0e52ec47884c7224fd0a4c10499c83e8a8c3..e7ca906d9c48153ccf9b955b08a833f2211520af 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -2,6 +2,7 @@ library html;
import 'dart:collection';
import 'dart:html_common';
+import 'dart:indexed_db';
import 'dart:isolate';
import 'dart:json';
import 'dart:svg' as svg;
@@ -9625,916 +9626,6 @@ class HttpRequestUploadEvents extends Events {
// BSD-style license that can be found in the LICENSE file.
-/// @domName IDBAny; @docsEditable true
-class IDBAny native "*IDBAny" {
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBCursor; @docsEditable true
-class IDBCursor native "*IDBCursor" {
-
- static const int NEXT = 0;
-
- static const int NEXT_NO_DUPLICATE = 1;
-
- static const int PREV = 2;
-
- static const int PREV_NO_DUPLICATE = 3;
-
- /// @domName IDBCursor.direction; @docsEditable true
- final String direction;
-
- /// @domName IDBCursor.key; @docsEditable true
- @_annotation_Creates_IDBKey @_annotation_Returns_IDBKey
- final Object key;
-
- /// @domName IDBCursor.primaryKey; @docsEditable true
- final Object primaryKey;
-
- /// @domName IDBCursor.source; @docsEditable true
- final dynamic source;
-
- /// @domName IDBCursor.advance; @docsEditable true
- void advance(int count) native;
-
- /// @domName IDBCursor.continueFunction; @docsEditable true
- void continueFunction([/*IDBKey*/ key]) {
- if (?key) {
- var key_1 = _convertDartToNative_IDBKey(key);
- _continueFunction_1(key_1);
- return;
- }
- _continueFunction_2();
- return;
- }
- @JSName('continue')
- void _continueFunction_1(key) native;
- @JSName('continue')
- void _continueFunction_2() native;
-
- /// @domName IDBCursor.delete; @docsEditable true
- IDBRequest delete() native;
-
- /// @domName IDBCursor.update; @docsEditable true
- IDBRequest update(/*any*/ value) {
- var value_1 = convertDartToNative_SerializedScriptValue(value);
- return _update_1(value_1);
- }
- @JSName('update')
- IDBRequest _update_1(value) native;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBCursorWithValue; @docsEditable true
-class IDBCursorWithValue extends IDBCursor native "*IDBCursorWithValue" {
-
- /// @domName IDBCursorWithValue.value; @docsEditable true
- @annotation_Creates_SerializedScriptValue @annotation_Returns_SerializedScriptValue
- final Object value;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBDatabase
-class IDBDatabase extends EventTarget native "*IDBDatabase" {
-
- IDBTransaction transaction(storeName_OR_storeNames, String mode) {
- if (mode != 'readonly' && mode != 'readwrite') {
- throw new ArgumentError(mode);
- }
-
- // TODO(sra): Ensure storeName_OR_storeNames is a string or List<String>,
- // and copy to JavaScript array if necessary.
-
- if (_transaction_fn != null) {
- return _transaction_fn(this, storeName_OR_storeNames, mode);
- }
-
- // Try and create a transaction with a string mode. Browsers that expect a
- // numeric mode tend to convert the string into a number. This fails
- // silently, resulting in zero ('readonly').
- var txn = _transaction(storeName_OR_storeNames, mode);
- if (_hasNumericMode(txn)) {
- _transaction_fn = _transaction_numeric_mode;
- txn = _transaction_fn(this, storeName_OR_storeNames, mode);
- } else {
- _transaction_fn = _transaction_string_mode;
- }
- return txn;
- }
-
- static IDBTransaction _transaction_string_mode(IDBDatabase db, stores, mode) {
- return db._transaction(stores, mode);
- }
-
- static IDBTransaction _transaction_numeric_mode(IDBDatabase db, stores, mode) {
- int intMode;
- if (mode == 'readonly') intMode = IDBTransaction.READ_ONLY;
- if (mode == 'readwrite') intMode = IDBTransaction.READ_WRITE;
- return db._transaction(stores, intMode);
- }
-
- @JSName('transaction')
- IDBTransaction _transaction(stores, mode) native;
-
- static bool _hasNumericMode(txn) =>
- JS('bool', 'typeof(#.mode) === "number"', txn);
-
-
- /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
- IDBDatabaseEvents get on =>
- new IDBDatabaseEvents(this);
-
- /// @domName IDBDatabase.name; @docsEditable true
- final String name;
-
- /// @domName IDBDatabase.objectStoreNames; @docsEditable true
- @Returns('_DOMStringList') @Creates('_DOMStringList')
- final List<String> objectStoreNames;
-
- /// @domName IDBDatabase.version; @docsEditable true
- final dynamic version;
-
- /// @domName IDBDatabase.addEventListener; @docsEditable true
- @JSName('addEventListener')
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- /// @domName IDBDatabase.close; @docsEditable true
- void close() native;
-
- /// @domName IDBDatabase.createObjectStore; @docsEditable true
- IDBObjectStore createObjectStore(String name, [Map options]) {
- if (?options) {
- var options_1 = convertDartToNative_Dictionary(options);
- return _createObjectStore_1(name, options_1);
- }
- return _createObjectStore_2(name);
- }
- @JSName('createObjectStore')
- IDBObjectStore _createObjectStore_1(name, options) native;
- @JSName('createObjectStore')
- IDBObjectStore _createObjectStore_2(name) native;
-
- /// @domName IDBDatabase.deleteObjectStore; @docsEditable true
- void deleteObjectStore(String name) native;
-
- /// @domName IDBDatabase.dispatchEvent; @docsEditable true
- @JSName('dispatchEvent')
- bool $dom_dispatchEvent(Event evt) native;
-
- /// @domName IDBDatabase.removeEventListener; @docsEditable true
- @JSName('removeEventListener')
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- /// @domName IDBDatabase.setVersion; @docsEditable true
- IDBVersionChangeRequest setVersion(String version) native;
-}
-
-// TODO(sra): This should be a static member of IDBTransaction but dart2js
-// can't handle that. Move it back after dart2js is completely done.
-var _transaction_fn; // Assigned one of the static methods.
-
-class IDBDatabaseEvents extends Events {
- IDBDatabaseEvents(EventTarget _ptr) : super(_ptr);
-
- EventListenerList get abort => this['abort'];
-
- EventListenerList get error => this['error'];
-
- EventListenerList get versionChange => this['versionchange'];
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBDatabaseException; @docsEditable true
-class IDBDatabaseException native "*IDBDatabaseException" {
-
- static const int ABORT_ERR = 20;
-
- static const int CONSTRAINT_ERR = 4;
-
- static const int DATA_ERR = 5;
-
- static const int NON_TRANSIENT_ERR = 2;
-
- static const int NOT_ALLOWED_ERR = 6;
-
- static const int NOT_FOUND_ERR = 8;
-
- static const int NO_ERR = 0;
-
- static const int QUOTA_ERR = 22;
-
- static const int READ_ONLY_ERR = 9;
-
- static const int TIMEOUT_ERR = 23;
-
- static const int TRANSACTION_INACTIVE_ERR = 7;
-
- static const int UNKNOWN_ERR = 1;
-
- static const int VER_ERR = 12;
-
- /// @domName IDBDatabaseException.code; @docsEditable true
- final int code;
-
- /// @domName IDBDatabaseException.message; @docsEditable true
- final String message;
-
- /// @domName IDBDatabaseException.name; @docsEditable true
- final String name;
-
- /// @domName IDBDatabaseException.toString; @docsEditable true
- String toString() native;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBFactory; @docsEditable true
-class IDBFactory native "*IDBFactory" {
-
- /// @domName IDBFactory.cmp; @docsEditable true
- int cmp(/*IDBKey*/ first, /*IDBKey*/ second) {
- var first_1 = _convertDartToNative_IDBKey(first);
- var second_2 = _convertDartToNative_IDBKey(second);
- return _cmp_1(first_1, second_2);
- }
- @JSName('cmp')
- int _cmp_1(first, second) native;
-
- /// @domName IDBFactory.deleteDatabase; @docsEditable true
- IDBVersionChangeRequest deleteDatabase(String name) native;
-
- /// @domName IDBFactory.open; @docsEditable true
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBDatabase')
- IDBOpenDBRequest open(String name, [int version]) native;
-
- /// @domName IDBFactory.webkitGetDatabaseNames; @docsEditable true
- IDBRequest webkitGetDatabaseNames() native;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBIndex; @docsEditable true
-class IDBIndex native "*IDBIndex" {
-
- /// @domName IDBIndex.keyPath; @docsEditable true
- final dynamic keyPath;
-
- /// @domName IDBIndex.multiEntry; @docsEditable true
- final bool multiEntry;
-
- /// @domName IDBIndex.name; @docsEditable true
- final String name;
-
- /// @domName IDBIndex.objectStore; @docsEditable true
- final IDBObjectStore objectStore;
-
- /// @domName IDBIndex.unique; @docsEditable true
- final bool unique;
-
- /// @domName IDBIndex.count; @docsEditable true
- IDBRequest count([key_OR_range]) {
- if (!?key_OR_range) {
- return _count_1();
- }
- if ((?key_OR_range && (key_OR_range is IDBKeyRange || key_OR_range == null))) {
- return _count_2(key_OR_range);
- }
- if (?key_OR_range) {
- var key_1 = _convertDartToNative_IDBKey(key_OR_range);
- return _count_3(key_1);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
- @JSName('count')
- IDBRequest _count_1() native;
- @JSName('count')
- IDBRequest _count_2(IDBKeyRange range) native;
- @JSName('count')
- IDBRequest _count_3(key) native;
-
- /// @domName IDBIndex.get; @docsEditable true
- IDBRequest get(key) {
- if ((?key && (key is IDBKeyRange || key == null))) {
- return _get_1(key);
- }
- if (?key) {
- var key_1 = _convertDartToNative_IDBKey(key);
- return _get_2(key_1);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
- @JSName('get')
- @Returns('IDBRequest') @Creates('IDBRequest') @annotation_Creates_SerializedScriptValue
- IDBRequest _get_1(IDBKeyRange key) native;
- @JSName('get')
- @Returns('IDBRequest') @Creates('IDBRequest') @annotation_Creates_SerializedScriptValue
- IDBRequest _get_2(key) native;
-
- /// @domName IDBIndex.getKey; @docsEditable true
- IDBRequest getKey(key) {
- if ((?key && (key is IDBKeyRange || key == null))) {
- return _getKey_1(key);
- }
- if (?key) {
- var key_1 = _convertDartToNative_IDBKey(key);
- return _getKey_2(key_1);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
- @JSName('getKey')
- @Returns('IDBRequest') @Creates('IDBRequest') @annotation_Creates_SerializedScriptValue @Creates('IDBObjectStore')
- IDBRequest _getKey_1(IDBKeyRange key) native;
- @JSName('getKey')
- @Returns('IDBRequest') @Creates('IDBRequest') @annotation_Creates_SerializedScriptValue @Creates('IDBObjectStore')
- IDBRequest _getKey_2(key) native;
-
- /// @domName IDBIndex.openCursor; @docsEditable true
- IDBRequest openCursor([key_OR_range, String direction]) {
- if (!?key_OR_range &&
- !?direction) {
- return _openCursor_1();
- }
- if ((?key_OR_range && (key_OR_range is IDBKeyRange || key_OR_range == null)) &&
- !?direction) {
- return _openCursor_2(key_OR_range);
- }
- if ((?key_OR_range && (key_OR_range is IDBKeyRange || key_OR_range == null))) {
- return _openCursor_3(key_OR_range, direction);
- }
- if (?key_OR_range &&
- !?direction) {
- var key_1 = _convertDartToNative_IDBKey(key_OR_range);
- return _openCursor_4(key_1);
- }
- if (?key_OR_range) {
- var key_2 = _convertDartToNative_IDBKey(key_OR_range);
- return _openCursor_5(key_2, direction);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
- @JSName('openCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openCursor_1() native;
- @JSName('openCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openCursor_2(IDBKeyRange range) native;
- @JSName('openCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openCursor_3(IDBKeyRange range, direction) native;
- @JSName('openCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openCursor_4(key) native;
- @JSName('openCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openCursor_5(key, direction) native;
-
- /// @domName IDBIndex.openKeyCursor; @docsEditable true
- IDBRequest openKeyCursor([key_OR_range, String direction]) {
- if (!?key_OR_range &&
- !?direction) {
- return _openKeyCursor_1();
- }
- if ((?key_OR_range && (key_OR_range is IDBKeyRange || key_OR_range == null)) &&
- !?direction) {
- return _openKeyCursor_2(key_OR_range);
- }
- if ((?key_OR_range && (key_OR_range is IDBKeyRange || key_OR_range == null))) {
- return _openKeyCursor_3(key_OR_range, direction);
- }
- if (?key_OR_range &&
- !?direction) {
- var key_1 = _convertDartToNative_IDBKey(key_OR_range);
- return _openKeyCursor_4(key_1);
- }
- if (?key_OR_range) {
- var key_2 = _convertDartToNative_IDBKey(key_OR_range);
- return _openKeyCursor_5(key_2, direction);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
- @JSName('openKeyCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openKeyCursor_1() native;
- @JSName('openKeyCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openKeyCursor_2(IDBKeyRange range) native;
- @JSName('openKeyCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openKeyCursor_3(IDBKeyRange range, direction) native;
- @JSName('openKeyCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openKeyCursor_4(key) native;
- @JSName('openKeyCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openKeyCursor_5(key, direction) native;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBKey; @docsEditable true
-class IDBKey native "*IDBKey" {
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBKeyRange
-class IDBKeyRange native "*IDBKeyRange" {
- /**
- * @domName IDBKeyRange.only
- */
- factory IDBKeyRange.only(/*IDBKey*/ value) =>
- _IDBKeyRangeFactoryProvider.createIDBKeyRange_only(value);
-
- /**
- * @domName IDBKeyRange.lowerBound
- */
- factory IDBKeyRange.lowerBound(/*IDBKey*/ bound, [bool open = false]) =>
- _IDBKeyRangeFactoryProvider.createIDBKeyRange_lowerBound(bound, open);
-
- /**
- * @domName IDBKeyRange.upperBound
- */
- factory IDBKeyRange.upperBound(/*IDBKey*/ bound, [bool open = false]) =>
- _IDBKeyRangeFactoryProvider.createIDBKeyRange_upperBound(bound, open);
-
- /**
- * @domName IDBKeyRange.bound
- */
- factory IDBKeyRange.bound(/*IDBKey*/ lower, /*IDBKey*/ upper,
- [bool lowerOpen = false, bool upperOpen = false]) =>
- _IDBKeyRangeFactoryProvider.createIDBKeyRange_bound(
- lower, upper, lowerOpen, upperOpen);
-
-
- /// @domName IDBKeyRange.lower; @docsEditable true
- dynamic get lower => _convertNativeToDart_IDBKey(this._lower);
- @JSName('lower')
- final dynamic _lower;
-
- /// @domName IDBKeyRange.lowerOpen; @docsEditable true
- final bool lowerOpen;
-
- /// @domName IDBKeyRange.upper; @docsEditable true
- dynamic get upper => _convertNativeToDart_IDBKey(this._upper);
- @JSName('upper')
- final dynamic _upper;
-
- /// @domName IDBKeyRange.upperOpen; @docsEditable true
- final bool upperOpen;
-
- /// @domName IDBKeyRange.bound_; @docsEditable true
- static IDBKeyRange bound_(/*IDBKey*/ lower, /*IDBKey*/ upper, [bool lowerOpen, bool upperOpen]) {
- if (?upperOpen) {
- var lower_1 = _convertDartToNative_IDBKey(lower);
- var upper_2 = _convertDartToNative_IDBKey(upper);
- return _bound__1(lower_1, upper_2, lowerOpen, upperOpen);
- }
- if (?lowerOpen) {
- var lower_3 = _convertDartToNative_IDBKey(lower);
- var upper_4 = _convertDartToNative_IDBKey(upper);
- return _bound__2(lower_3, upper_4, lowerOpen);
- }
- var lower_5 = _convertDartToNative_IDBKey(lower);
- var upper_6 = _convertDartToNative_IDBKey(upper);
- return _bound__3(lower_5, upper_6);
- }
- @JSName('bound')
- static IDBKeyRange _bound__1(lower, upper, lowerOpen, upperOpen) native;
- @JSName('bound')
- static IDBKeyRange _bound__2(lower, upper, lowerOpen) native;
- @JSName('bound')
- static IDBKeyRange _bound__3(lower, upper) native;
-
- /// @domName IDBKeyRange.lowerBound_; @docsEditable true
- static IDBKeyRange lowerBound_(/*IDBKey*/ bound, [bool open]) {
- if (?open) {
- var bound_1 = _convertDartToNative_IDBKey(bound);
- return _lowerBound__1(bound_1, open);
- }
- var bound_2 = _convertDartToNative_IDBKey(bound);
- return _lowerBound__2(bound_2);
- }
- @JSName('lowerBound')
- static IDBKeyRange _lowerBound__1(bound, open) native;
- @JSName('lowerBound')
- static IDBKeyRange _lowerBound__2(bound) native;
-
- /// @domName IDBKeyRange.only_; @docsEditable true
- static IDBKeyRange only_(/*IDBKey*/ value) {
- var value_1 = _convertDartToNative_IDBKey(value);
- return _only__1(value_1);
- }
- @JSName('only')
- static IDBKeyRange _only__1(value) native;
-
- /// @domName IDBKeyRange.upperBound_; @docsEditable true
- static IDBKeyRange upperBound_(/*IDBKey*/ bound, [bool open]) {
- if (?open) {
- var bound_1 = _convertDartToNative_IDBKey(bound);
- return _upperBound__1(bound_1, open);
- }
- var bound_2 = _convertDartToNative_IDBKey(bound);
- return _upperBound__2(bound_2);
- }
- @JSName('upperBound')
- static IDBKeyRange _upperBound__1(bound, open) native;
- @JSName('upperBound')
- static IDBKeyRange _upperBound__2(bound) native;
-
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBObjectStore; @docsEditable true
-class IDBObjectStore native "*IDBObjectStore" {
-
- /// @domName IDBObjectStore.autoIncrement; @docsEditable true
- final bool autoIncrement;
-
- /// @domName IDBObjectStore.indexNames; @docsEditable true
- @Returns('_DOMStringList') @Creates('_DOMStringList')
- final List<String> indexNames;
-
- /// @domName IDBObjectStore.keyPath; @docsEditable true
- final dynamic keyPath;
-
- /// @domName IDBObjectStore.name; @docsEditable true
- final String name;
-
- /// @domName IDBObjectStore.transaction; @docsEditable true
- final IDBTransaction transaction;
-
- /// @domName IDBObjectStore.add; @docsEditable true
- IDBRequest add(/*any*/ value, [/*IDBKey*/ key]) {
- if (?key) {
- var value_1 = convertDartToNative_SerializedScriptValue(value);
- var key_2 = _convertDartToNative_IDBKey(key);
- return _add_1(value_1, key_2);
- }
- var value_3 = convertDartToNative_SerializedScriptValue(value);
- return _add_2(value_3);
- }
- @JSName('add')
- @Returns('IDBRequest') @Creates('IDBRequest') @_annotation_Creates_IDBKey
- IDBRequest _add_1(value, key) native;
- @JSName('add')
- @Returns('IDBRequest') @Creates('IDBRequest') @_annotation_Creates_IDBKey
- IDBRequest _add_2(value) native;
-
- /// @domName IDBObjectStore.clear; @docsEditable true
- IDBRequest clear() native;
-
- /// @domName IDBObjectStore.count; @docsEditable true
- IDBRequest count([key_OR_range]) {
- if (!?key_OR_range) {
- return _count_1();
- }
- if ((?key_OR_range && (key_OR_range is IDBKeyRange || key_OR_range == null))) {
- return _count_2(key_OR_range);
- }
- if (?key_OR_range) {
- var key_1 = _convertDartToNative_IDBKey(key_OR_range);
- return _count_3(key_1);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
- @JSName('count')
- IDBRequest _count_1() native;
- @JSName('count')
- IDBRequest _count_2(IDBKeyRange range) native;
- @JSName('count')
- IDBRequest _count_3(key) native;
-
- /// @domName IDBObjectStore.createIndex; @docsEditable true
- IDBIndex createIndex(String name, keyPath, [Map options]) {
- if ((?keyPath && (keyPath is List<String> || keyPath == null)) &&
- !?options) {
- List keyPath_1 = convertDartToNative_StringArray(keyPath);
- return _createIndex_1(name, keyPath_1);
- }
- if ((?keyPath && (keyPath is List<String> || keyPath == null))) {
- List keyPath_2 = convertDartToNative_StringArray(keyPath);
- var options_3 = convertDartToNative_Dictionary(options);
- return _createIndex_2(name, keyPath_2, options_3);
- }
- if ((?keyPath && (keyPath is String || keyPath == null)) &&
- !?options) {
- return _createIndex_3(name, keyPath);
- }
- if ((?keyPath && (keyPath is String || keyPath == null))) {
- var options_4 = convertDartToNative_Dictionary(options);
- return _createIndex_4(name, keyPath, options_4);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
- @JSName('createIndex')
- IDBIndex _createIndex_1(name, List keyPath) native;
- @JSName('createIndex')
- IDBIndex _createIndex_2(name, List keyPath, options) native;
- @JSName('createIndex')
- IDBIndex _createIndex_3(name, String keyPath) native;
- @JSName('createIndex')
- IDBIndex _createIndex_4(name, String keyPath, options) native;
-
- /// @domName IDBObjectStore.delete; @docsEditable true
- IDBRequest delete(key_OR_keyRange) {
- if ((?key_OR_keyRange && (key_OR_keyRange is IDBKeyRange || key_OR_keyRange == null))) {
- return _delete_1(key_OR_keyRange);
- }
- if (?key_OR_keyRange) {
- var key_1 = _convertDartToNative_IDBKey(key_OR_keyRange);
- return _delete_2(key_1);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
- @JSName('delete')
- IDBRequest _delete_1(IDBKeyRange keyRange) native;
- @JSName('delete')
- IDBRequest _delete_2(key) native;
-
- /// @domName IDBObjectStore.deleteIndex; @docsEditable true
- void deleteIndex(String name) native;
-
- /// @domName IDBObjectStore.getObject; @docsEditable true
- IDBRequest getObject(key) {
- if ((?key && (key is IDBKeyRange || key == null))) {
- return _getObject_1(key);
- }
- if (?key) {
- var key_1 = _convertDartToNative_IDBKey(key);
- return _getObject_2(key_1);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
- @JSName('get')
- @Returns('IDBRequest') @Creates('IDBRequest') @annotation_Creates_SerializedScriptValue
- IDBRequest _getObject_1(IDBKeyRange key) native;
- @JSName('get')
- @Returns('IDBRequest') @Creates('IDBRequest') @annotation_Creates_SerializedScriptValue
- IDBRequest _getObject_2(key) native;
-
- /// @domName IDBObjectStore.index; @docsEditable true
- IDBIndex index(String name) native;
-
- /// @domName IDBObjectStore.openCursor; @docsEditable true
- IDBRequest openCursor([key_OR_range, String direction]) {
- if (!?key_OR_range &&
- !?direction) {
- return _openCursor_1();
- }
- if ((?key_OR_range && (key_OR_range is IDBKeyRange || key_OR_range == null)) &&
- !?direction) {
- return _openCursor_2(key_OR_range);
- }
- if ((?key_OR_range && (key_OR_range is IDBKeyRange || key_OR_range == null))) {
- return _openCursor_3(key_OR_range, direction);
- }
- if (?key_OR_range &&
- !?direction) {
- var key_1 = _convertDartToNative_IDBKey(key_OR_range);
- return _openCursor_4(key_1);
- }
- if (?key_OR_range) {
- var key_2 = _convertDartToNative_IDBKey(key_OR_range);
- return _openCursor_5(key_2, direction);
- }
- throw new ArgumentError("Incorrect number or type of arguments");
- }
- @JSName('openCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openCursor_1() native;
- @JSName('openCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openCursor_2(IDBKeyRange range) native;
- @JSName('openCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openCursor_3(IDBKeyRange range, direction) native;
- @JSName('openCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openCursor_4(key) native;
- @JSName('openCursor')
- @Returns('IDBRequest') @Creates('IDBRequest') @Creates('IDBCursor')
- IDBRequest _openCursor_5(key, direction) native;
-
- /// @domName IDBObjectStore.put; @docsEditable true
- IDBRequest put(/*any*/ value, [/*IDBKey*/ key]) {
- if (?key) {
- var value_1 = convertDartToNative_SerializedScriptValue(value);
- var key_2 = _convertDartToNative_IDBKey(key);
- return _put_1(value_1, key_2);
- }
- var value_3 = convertDartToNative_SerializedScriptValue(value);
- return _put_2(value_3);
- }
- @JSName('put')
- @Returns('IDBRequest') @Creates('IDBRequest') @_annotation_Creates_IDBKey
- IDBRequest _put_1(value, key) native;
- @JSName('put')
- @Returns('IDBRequest') @Creates('IDBRequest') @_annotation_Creates_IDBKey
- IDBRequest _put_2(value) native;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBOpenDBRequest; @docsEditable true
-class IDBOpenDBRequest extends IDBRequest implements EventTarget native "*IDBOpenDBRequest" {
-
- /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
- IDBOpenDBRequestEvents get on =>
- new IDBOpenDBRequestEvents(this);
-}
-
-class IDBOpenDBRequestEvents extends IDBRequestEvents {
- IDBOpenDBRequestEvents(EventTarget _ptr) : super(_ptr);
-
- EventListenerList get blocked => this['blocked'];
-
- EventListenerList get upgradeNeeded => this['upgradeneeded'];
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBRequest; @docsEditable true
-class IDBRequest extends EventTarget native "*IDBRequest" {
-
- /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
- IDBRequestEvents get on =>
- new IDBRequestEvents(this);
-
- /// @domName IDBRequest.error; @docsEditable true
- final DOMError error;
-
- /// @domName IDBRequest.errorCode; @docsEditable true
- final int errorCode;
-
- /// @domName IDBRequest.readyState; @docsEditable true
- final String readyState;
-
- /// @domName IDBRequest.result; @docsEditable true
- dynamic get result => _convertNativeToDart_IDBAny(this._result);
- @JSName('result')
- @Creates('Null')
- final dynamic _result;
-
- /// @domName IDBRequest.source; @docsEditable true
- @Creates('Null')
- final dynamic source;
-
- /// @domName IDBRequest.transaction; @docsEditable true
- final IDBTransaction transaction;
-
- /// @domName IDBRequest.webkitErrorMessage; @docsEditable true
- final String webkitErrorMessage;
-
- /// @domName IDBRequest.addEventListener; @docsEditable true
- @JSName('addEventListener')
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- /// @domName IDBRequest.dispatchEvent; @docsEditable true
- @JSName('dispatchEvent')
- bool $dom_dispatchEvent(Event evt) native;
-
- /// @domName IDBRequest.removeEventListener; @docsEditable true
- @JSName('removeEventListener')
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-}
-
-class IDBRequestEvents extends Events {
- IDBRequestEvents(EventTarget _ptr) : super(_ptr);
-
- EventListenerList get error => this['error'];
-
- EventListenerList get success => this['success'];
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBTransaction; @docsEditable true
-class IDBTransaction extends EventTarget native "*IDBTransaction" {
-
- /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
- IDBTransactionEvents get on =>
- new IDBTransactionEvents(this);
-
- static const int READ_ONLY = 0;
-
- static const int READ_WRITE = 1;
-
- static const int VERSION_CHANGE = 2;
-
- /// @domName IDBTransaction.db; @docsEditable true
- final IDBDatabase db;
-
- /// @domName IDBTransaction.error; @docsEditable true
- final DOMError error;
-
- /// @domName IDBTransaction.mode; @docsEditable true
- final String mode;
-
- /// @domName IDBTransaction.abort; @docsEditable true
- void abort() native;
-
- /// @domName IDBTransaction.addEventListener; @docsEditable true
- @JSName('addEventListener')
- void $dom_addEventListener(String type, EventListener listener, [bool useCapture]) native;
-
- /// @domName IDBTransaction.dispatchEvent; @docsEditable true
- @JSName('dispatchEvent')
- bool $dom_dispatchEvent(Event evt) native;
-
- /// @domName IDBTransaction.objectStore; @docsEditable true
- IDBObjectStore objectStore(String name) native;
-
- /// @domName IDBTransaction.removeEventListener; @docsEditable true
- @JSName('removeEventListener')
- void $dom_removeEventListener(String type, EventListener listener, [bool useCapture]) native;
-}
-
-class IDBTransactionEvents extends Events {
- IDBTransactionEvents(EventTarget _ptr) : super(_ptr);
-
- EventListenerList get abort => this['abort'];
-
- EventListenerList get complete => this['complete'];
-
- EventListenerList get error => this['error'];
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBVersionChangeEvent; @docsEditable true
-class IDBUpgradeNeededEvent extends Event native "*IDBVersionChangeEvent" {
-
- /// @domName IDBVersionChangeEvent.newVersion; @docsEditable true
- final int newVersion;
-
- /// @domName IDBVersionChangeEvent.oldVersion; @docsEditable true
- final int oldVersion;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBVersionChangeEvent; @docsEditable true
-class IDBVersionChangeEvent extends Event native "*IDBVersionChangeEvent" {
-
- /// @domName IDBVersionChangeEvent.version; @docsEditable true
- final String version;
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-/// @domName IDBVersionChangeRequest; @docsEditable true
-class IDBVersionChangeRequest extends IDBRequest implements EventTarget native "*IDBVersionChangeRequest" {
-
- /// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
- IDBVersionChangeRequestEvents get on =>
- new IDBVersionChangeRequestEvents(this);
-}
-
-class IDBVersionChangeRequestEvents extends IDBRequestEvents {
- IDBVersionChangeRequestEvents(EventTarget _ptr) : super(_ptr);
-
- EventListenerList get blocked => this['blocked'];
-}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
/// @domName HTMLIFrameElement; @docsEditable true
class IFrameElement extends Element implements Element native "*HTMLIFrameElement" {
@@ -11731,8 +10822,8 @@ class LocalWindow extends EventTarget implements Window native "@*DOMWindow" {
this);
}
- IDBFactory get indexedDB =>
- JS('IDBFactory',
+ IdbFactory get indexedDB =>
+ JS('IdbFactory',
'#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB',
this, this, this);
@@ -11899,9 +10990,6 @@ class LocalWindow extends EventTarget implements Window native "@*DOMWindow" {
@Creates('LocalWindow|=Object') @Returns('LocalWindow|=Object')
final dynamic _top;
- /// @domName DOMWindow.webkitIndexedDB; @docsEditable true
- final IDBFactory webkitIndexedDB;
-
/// @domName DOMWindow.webkitNotifications; @docsEditable true
final NotificationCenter webkitNotifications;
@@ -20009,7 +19097,7 @@ class WorkerEvents extends AbstractWorkerEvents {
// BSD-style license that can be found in the LICENSE file.
-/// @domName WorkerContext; @docsEditable true
+/// @domName WorkerContext
class WorkerContext extends EventTarget native "*WorkerContext" {
/// @domName EventTarget.addEventListener, EventTarget.removeEventListener, EventTarget.dispatchEvent; @docsEditable true
@@ -20020,9 +19108,6 @@ class WorkerContext extends EventTarget native "*WorkerContext" {
static const int TEMPORARY = 0;
- /// @domName WorkerContext.indexedDB; @docsEditable true
- final IDBFactory indexedDB;
-
/// @domName WorkerContext.location; @docsEditable true
final WorkerLocation location;
@@ -20032,9 +19117,6 @@ class WorkerContext extends EventTarget native "*WorkerContext" {
/// @domName WorkerContext.self; @docsEditable true
final WorkerContext self;
- /// @domName WorkerContext.webkitIndexedDB; @docsEditable true
- final IDBFactory webkitIndexedDB;
-
/// @domName WorkerContext.webkitNotifications; @docsEditable true
final NotificationCenter webkitNotifications;
@@ -20087,6 +19169,12 @@ class WorkerContext extends EventTarget native "*WorkerContext" {
/// @domName WorkerContext.webkitResolveLocalFileSystemURL; @docsEditable true
@JSName('webkitResolveLocalFileSystemURL')
void webkitResolveLocalFileSystemUrl(String url, EntryCallback successCallback, [ErrorCallback errorCallback]) native;
+
+
+ IdbFactory get indexedDB =>
+ JS('IdbFactory',
+ '#.indexedDB || #.webkitIndexedDB || #.mozIndexedDB',
+ this, this, this);
}
class WorkerContextEvents extends Events {
@@ -24646,60 +23734,6 @@ _convertDartToNative_ImageData(ImageData imageData) {
}
return imageData;
}
-
-
-// -----------------------------------------------------------------------------
-
-/**
- * Converts a native IDBKey into a Dart object.
- *
- * May return the original input. May mutate the original input (but will be
- * idempotent if mutation occurs). It is assumed that this conversion happens
- * on native IDBKeys on all paths that return IDBKeys from native DOM calls.
- *
- * If necessary, JavaScript Dates are converted into Dart Dates.
- */
-_convertNativeToDart_IDBKey(nativeKey) {
- containsDate(object) {
- if (isJavaScriptDate(object)) return true;
- if (object is List) {
- for (int i = 0; i < object.length; i++) {
- if (containsDate(object[i])) return true;
- }
- }
- return false; // number, string.
- }
- if (containsDate(nativeKey)) {
- throw new UnimplementedError('IDBKey containing Date');
- }
- // TODO: Cache conversion somewhere?
- return nativeKey;
-}
-
-/**
- * Converts a Dart object into a valid IDBKey.
- *
- * May return the original input. Does not mutate input.
- *
- * If necessary, [dartKey] may be copied to ensure all lists are converted into
- * JavaScript Arrays and Dart Dates into JavaScript Dates.
- */
-_convertDartToNative_IDBKey(dartKey) {
- // TODO: Implement.
- return dartKey;
-}
-
-
-
-/// May modify original. If so, action is idempotent.
-_convertNativeToDart_IDBAny(object) {
- return convertNativeToDart_AcceptStructuredClone(object, mustCopy: false);
-}
-
-
-const String _idbKey = '=List|=Object|num|String'; // TODO(sra): Add Date.
-const _annotation_Creates_IDBKey = const Creates(_idbKey);
-const _annotation_Returns_IDBKey = const Returns(_idbKey);
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -24926,56 +23960,6 @@ class _TextFactoryProvider {
static Text createText(String data) =>
JS('Text', 'document.createTextNode(#)', data);
}
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-
-class _IDBKeyRangeFactoryProvider {
-
- static IDBKeyRange createIDBKeyRange_only(/*IDBKey*/ value) =>
- _only(_class(), _translateKey(value));
-
- static IDBKeyRange createIDBKeyRange_lowerBound(
- /*IDBKey*/ bound, [bool open = false]) =>
- _lowerBound(_class(), _translateKey(bound), open);
-
- static IDBKeyRange createIDBKeyRange_upperBound(
- /*IDBKey*/ bound, [bool open = false]) =>
- _upperBound(_class(), _translateKey(bound), open);
-
- static IDBKeyRange createIDBKeyRange_bound(/*IDBKey*/ lower, /*IDBKey*/ upper,
- [bool lowerOpen = false, bool upperOpen = false]) =>
- _bound(_class(), _translateKey(lower), _translateKey(upper),
- lowerOpen, upperOpen);
-
- static var _cachedClass;
-
- static _class() {
- if (_cachedClass != null) return _cachedClass;
- return _cachedClass = _uncachedClass();
- }
-
- static _uncachedClass() =>
- JS('var',
- '''window.webkitIDBKeyRange || window.mozIDBKeyRange ||
- window.msIDBKeyRange || window.IDBKeyRange''');
-
- static _translateKey(idbkey) => idbkey; // TODO: fixme.
-
- static IDBKeyRange _only(cls, value) =>
- JS('IDBKeyRange', '#.only(#)', cls, value);
-
- static IDBKeyRange _lowerBound(cls, bound, open) =>
- JS('IDBKeyRange', '#.lowerBound(#, #)', cls, bound, open);
-
- static IDBKeyRange _upperBound(cls, bound, open) =>
- JS('IDBKeyRange', '#.upperBound(#, #)', cls, bound, open);
-
- static IDBKeyRange _bound(cls, lower, upper, lowerOpen, upperOpen) =>
- JS('IDBKeyRange', '#.bound(#, #, #, #)',
- cls, lower, upper, lowerOpen, upperOpen);
-}
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
« no previous file with comments | « sdk/lib/_internal/libraries.dart ('k') | sdk/lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698