Revert "Revert "Revert "Revert "Constructors for IDBKeyRange""""

Re-apply "Constructors for IDBKeyRange" with more status file changes.

Review URL: https://chromiumcodereview.appspot.com//10151002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6775 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
sra@google.com 2012-04-19 22:18:47 +00:00
parent d86ae6c3ff
commit f0ff872d3f
13 changed files with 242 additions and 151 deletions

View file

@ -4,7 +4,6 @@
[ $compiler == dart2js ]
dom/DOMIsolatesTest: Fail # error: cannot resolve spawnDomIsolate
dom/IndexedDB4Test: Fail # error: cannot instantiate interface 'IDBKeyRange'
[ $compiler == dart2js && $runtime == drt ]
@ -21,9 +20,9 @@ dom/TypedArrays1Test: Fail # Expect.isTrue(false) fails.
dom/IsolatesTest: Skip # Timeout because leg does not support web workers.
dom/IndexedDB1Test: Skip # Timeout because callbacks don't appear to be called.
dom/IndexedDB2Test: Skip # Timeout because callbacks don't appear to be called.
dom/IndexedDB3Test: Skip # Timeout because callbacks don't appear to be called.
dom/IndexedDB2Test: Fail # Uncaught error
dom/IndexedDB3Test: Fail # Uncaught TypeError: Object #<IDBCursorWithValue> has no method 'continueFunction'
dom/IndexedDB4Test: Fail # Uncaught TypeError: Object #<IDBCursorWithValue> has no method 'continueFunction'
[ $compiler == dart2js && $runtime == none ]
*: Fail, Pass # TODO(ahe): Triage these tests.

View file

@ -28,7 +28,6 @@ html/html_tests: Skip # Issue 2657
# TODO(vsm): Triage DOM tests.
dom/DOMIsolatesTest: Fail
dom/IndexedDB2Test: Fail # Issue 1883 - IndexedDB methods don't handle maps correctly.
dom/IndexedDB4Test: Fail # IDBKeyRange constructors not implemented.
dom/HTMLElementTest: Fail
dom/WindowOpenTest: Fail

View file

@ -5192,7 +5192,17 @@ interface IDBKey {
// WARNING: Do not edit - generated code.
interface IDBKeyRange {
interface IDBKeyRange default _IDBKeyRangeFactoryProvider {
IDBKeyRange.only(/*IDBKey*/ value);
IDBKeyRange.lowerBound(/*IDBKey*/ bound, [bool open]);
IDBKeyRange.upperBound(/*IDBKey*/ bound, [bool open]);
IDBKeyRange.bound(/*IDBKey*/ lower, /*IDBKey*/ upper,
[bool lowerOpen, bool upperOpen]);
final /*IDBKey*/ lower;
@ -5201,14 +5211,6 @@ interface IDBKeyRange {
final /*IDBKey*/ upper;
final bool upperOpen;
IDBKeyRange bound(/*IDBKey*/ lower, /*IDBKey*/ upper, [bool lowerOpen, bool upperOpen]);
IDBKeyRange lowerBound(/*IDBKey*/ bound, [bool open]);
IDBKeyRange only(/*IDBKey*/ value);
IDBKeyRange upperBound(/*IDBKey*/ bound, [bool open]);
}
// 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
@ -12858,6 +12860,15 @@ class _AudioContextFactoryProvider {
factory AudioContext() => _dummy();
}
class _IDBKeyRangeFactoryProvider {
factory IDBKeyRange.only(/*IDBKey*/ value) => _dummy();
factory IDBKeyRange.lowerBound(/*IDBKey*/ bound, [bool open]) => _dummy();
factory IDBKeyRange.upperBound(/*IDBKey*/ bound, [bool open]) => _dummy();
factory IDBKeyRange.bound(/*IDBKey*/ lower, /*IDBKey*/ upper,
[bool lowerOpen, bool upperOpen]) => _dummy();
}
class _TypedArrayFactoryProvider {
factory Float32Array(int length) => _dummy();

View file

@ -4253,14 +4253,6 @@ class _IDBKeyRangeJs extends _DOMTypeJs implements IDBKeyRange native "*IDBKeyRa
final upper;
final bool upperOpen;
_IDBKeyRangeJs bound(lower, upper, [bool lowerOpen = null, bool upperOpen = null]) native;
_IDBKeyRangeJs lowerBound(bound, [bool open = null]) native;
_IDBKeyRangeJs only(value) native;
_IDBKeyRangeJs upperBound(bound, [bool open = null]) native;
}
class _IDBObjectStoreJs extends _DOMTypeJs implements IDBObjectStore native "*IDBObjectStore" {
@ -17152,7 +17144,17 @@ interface IDBKey {
// WARNING: Do not edit - generated code.
interface IDBKeyRange {
interface IDBKeyRange default _IDBKeyRangeFactoryProvider {
IDBKeyRange.only(/*IDBKey*/ value);
IDBKeyRange.lowerBound(/*IDBKey*/ bound, [bool open]);
IDBKeyRange.upperBound(/*IDBKey*/ bound, [bool open]);
IDBKeyRange.bound(/*IDBKey*/ lower, /*IDBKey*/ upper,
[bool lowerOpen, bool upperOpen]);
final /*IDBKey*/ lower;
@ -17161,14 +17163,6 @@ interface IDBKeyRange {
final /*IDBKey*/ upper;
final bool upperOpen;
IDBKeyRange bound(/*IDBKey*/ lower, /*IDBKey*/ upper, [bool lowerOpen, bool upperOpen]);
IDBKeyRange lowerBound(/*IDBKey*/ bound, [bool open]);
IDBKeyRange only(/*IDBKey*/ value);
IDBKeyRange upperBound(/*IDBKey*/ bound, [bool open]);
}
// 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
@ -24794,58 +24788,6 @@ interface ReadyState {
*/
static final String COMPLETE = "complete";
}
// 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.
/**
* The [Collections] class implements static methods useful when
* writing a class that implements [Collection] and the [iterator]
* method.
*/
class _Collections {
static void forEach(Iterable<Object> iterable, void f(Object o)) {
for (final e in iterable) {
f(e);
}
}
static List map(Iterable<Object> source,
List<Object> destination,
f(o)) {
for (final e in source) {
destination.add(f(e));
}
return destination;
}
static bool some(Iterable<Object> iterable, bool f(Object o)) {
for (final e in iterable) {
if (f(e)) return true;
}
return false;
}
static bool every(Iterable<Object> iterable, bool f(Object o)) {
for (final e in iterable) {
if (!f(e)) return false;
}
return true;
}
static List filter(Iterable<Object> source,
List<Object> destination,
bool f(o)) {
for (final e in source) {
if (f(e)) destination.add(e);
}
return destination;
}
static bool isEmpty(Iterable<Object> iterable) {
return !iterable.iterator().hasNext();
}
}
// 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.
@ -24942,6 +24884,53 @@ class _WebSocketFactoryProvider {
// 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 {
factory IDBKeyRange.only(/*IDBKey*/ value) =>
_only(_class(), _translateKey(value));
factory IDBKeyRange.lowerBound(/*IDBKey*/ bound, [bool open = false]) =>
_lowerBound(_class(), _translateKey(bound), open);
factory IDBKeyRange.upperBound(/*IDBKey*/ bound, [bool open = false]) =>
_upperBound(_class(), _translateKey(bound), open);
factory IDBKeyRange.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() native '''
return window.webkitIDBKeyRange || window.mozIDBKeyRange ||
window.msIDBKeyRange || window.IDBKeyRange;
''';
static _translateKey(idbkey) => idbkey; // TODO: fixme.
static _IDBKeyRangeJs _only(cls, value) native
'''return cls.only(value);''';
static _IDBKeyRangeJs _lowerBound(cls, bound, open) native
'''return cls.lowerBound(bound, open);''';
static _IDBKeyRangeJs _upperBound(cls, bound, open) native
'''return cls.upperBound(bound, open);''';
static _IDBKeyRangeJs _bound(cls, lower, upper, lowerOpen, upperOpen) native
'''return cls.bound(lower, upper, lowerOpen, upperOpen);''';
}
// 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 _TypedArrayFactoryProvider {
factory Float32Array(int length) => _F32(length);
@ -25055,6 +25044,58 @@ class _TypedArrayFactoryProvider {
// 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.
/**
* The [Collections] class implements static methods useful when
* writing a class that implements [Collection] and the [iterator]
* method.
*/
class _Collections {
static void forEach(Iterable<Object> iterable, void f(Object o)) {
for (final e in iterable) {
f(e);
}
}
static List map(Iterable<Object> source,
List<Object> destination,
f(o)) {
for (final e in source) {
destination.add(f(e));
}
return destination;
}
static bool some(Iterable<Object> iterable, bool f(Object o)) {
for (final e in iterable) {
if (f(e)) return true;
}
return false;
}
static bool every(Iterable<Object> iterable, bool f(Object o)) {
for (final e in iterable) {
if (!f(e)) return false;
}
return true;
}
static List filter(Iterable<Object> source,
List<Object> destination,
bool f(o)) {
for (final e in source) {
if (f(e)) destination.add(e);
}
return destination;
}
static bool isEmpty(Iterable<Object> iterable) {
return !iterable.iterator().hasNext();
}
}
// 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.
// Iterator for arrays with fixed size.
class _FixedSizeListIterator<T> extends _VariableSizeListIterator<T> {
_FixedSizeListIterator(List<T> array)

View file

@ -219,6 +219,17 @@ module storage {
interface IDBObjectStore {
[DartName=getObject] IDBRequest get(in IDBKey key);
};
interface IDBKeyRange {
[Suppressed] static IDBKeyRange only(in IDBKey value)
raises (IDBDatabaseException);
[Suppressed] static IDBKeyRange lowerBound(in IDBKey bound, in optional boolean open)
raises (IDBDatabaseException);
[Suppressed] static IDBKeyRange upperBound(in IDBKey bound, in optional boolean open)
raises (IDBDatabaseException);
[Suppressed] static IDBKeyRange bound(in IDBKey lower, in IDBKey upper, in optional boolean lowerOpen, optional boolean upperOpen)
raises (IDBDatabaseException);
};
};
module html {

View file

@ -12,6 +12,15 @@ class _AudioContextFactoryProvider {
factory AudioContext() => _dummy();
}
class _IDBKeyRangeFactoryProvider {
factory IDBKeyRange.only(/*IDBKey*/ value) => _dummy();
factory IDBKeyRange.lowerBound(/*IDBKey*/ bound, [bool open]) => _dummy();
factory IDBKeyRange.upperBound(/*IDBKey*/ bound, [bool open]) => _dummy();
factory IDBKeyRange.bound(/*IDBKey*/ lower, /*IDBKey*/ upper,
[bool lowerOpen, bool upperOpen]) => _dummy();
}
class _TypedArrayFactoryProvider {
factory Float32Array(int length) => _dummy();

View file

@ -0,0 +1,47 @@
// 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 {
factory IDBKeyRange.only(/*IDBKey*/ value) =>
_only(_class(), _translateKey(value));
factory IDBKeyRange.lowerBound(/*IDBKey*/ bound, [bool open = false]) =>
_lowerBound(_class(), _translateKey(bound), open);
factory IDBKeyRange.upperBound(/*IDBKey*/ bound, [bool open = false]) =>
_upperBound(_class(), _translateKey(bound), open);
factory IDBKeyRange.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() native '''
return window.webkitIDBKeyRange || window.mozIDBKeyRange ||
window.msIDBKeyRange || window.IDBKeyRange;
''';
static _translateKey(idbkey) => idbkey; // TODO: fixme.
static _IDBKeyRangeJs _only(cls, value) native
'''return cls.only(value);''';
static _IDBKeyRangeJs _lowerBound(cls, bound, open) native
'''return cls.lowerBound(bound, open);''';
static _IDBKeyRangeJs _upperBound(cls, bound, open) native
'''return cls.upperBound(bound, open);''';
static _IDBKeyRangeJs _bound(cls, lower, upper, lowerOpen, upperOpen) native
'''return cls.bound(lower, upper, lowerOpen, upperOpen);''';
}

View file

@ -59,3 +59,20 @@ class _WebKitPointFactoryProvider {
class _WebSocketFactoryProvider {
factory WebSocket(String url) => FactoryProviderImplementation.createWebSocket(url);
}
class _IDBKeyRangeFactoryProvider {
factory IDBKeyRange.only(/*IDBKey*/ value) =>
FactoryProviderImplementation.IDBKeyRange_only(value);
factory IDBKeyRange.lowerBound(/*IDBKey*/ bound, [bool open = false]) =>
FactoryProviderImplementation.IDBKeyRange_lowerBound(bound, open);
factory IDBKeyRange.upperBound(/*IDBKey*/ bound, [bool open = false]) =>
FactoryProviderImplementation.IDBKeyRange_upperBound(bound, open);
factory IDBKeyRange.bound(/*IDBKey*/ lower, /*IDBKey*/ upper,
[bool lowerOpen = false, bool upperOpen = false]) =>
FactoryProviderImplementation.IDBKeyRange_bound(lower, upper,
lowerOpen, upperOpen);
}

View file

@ -20,4 +20,9 @@ class FactoryProviderImplementation {
static WebKitPoint createWebKitPoint(num x, num y) native "WebKitPoint_constructor_Callback";
static WebSocket createWebSocket(String url) native "WebSocket_constructor_Callback";
static IDBKeyRange IDBKeyRange_only(value) native "IDBKeyRange_only_Callback";
static IDBKeyRange IDBKeyRange_lowerBound(bound, open) native "IDBKeyRange_lowerBound_Callback";
static IDBKeyRange IDBKeyRange_upperBound(bound, open) native "IDBKeyRange_upperBound_Callback";
static IDBKeyRange IDBKeyRange_bound(lower, upper, lowerOpen, upperOpen) native "IDBKeyRange_bound_Callback";
}

View file

@ -12,12 +12,13 @@ $!GENERATED_DART_FILES
#source('../src/KeyLocation.dart');
#source('../src/KeyName.dart');
#source('../src/ReadyState.dart');
#source('../src/_Collections.dart');
#source('../src/frog_DOMImplementation.dart');
#source('../src/frog_DOMType.dart');
#source('../src/frog_DOMTypeJs.dart');
#source('../src/frog_FactoryProviders.dart');
#source('../src/frog_IDBKeyRangeFactoryProvider.dart');
#source('../src/frog_TypedArrayFactoryProvider.dart');
#source('../src/_Collections.dart');
#source('../src/_ListIterators.dart');
#source('../src/_Lists.dart');

View file

@ -0,0 +1,18 @@
// 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.
// WARNING: Do not edit - generated code.
interface IDBKeyRange$EXTENDS default _IDBKeyRangeFactoryProvider {
IDBKeyRange.only(/*IDBKey*/ value);
IDBKeyRange.lowerBound(/*IDBKey*/ bound, [bool open]);
IDBKeyRange.upperBound(/*IDBKey*/ bound, [bool open]);
IDBKeyRange.bound(/*IDBKey*/ lower, /*IDBKey*/ upper,
[bool lowerOpen, bool upperOpen]);
$!MEMBERS}

View file

@ -10402,41 +10402,6 @@ class _IDBKeyRangeImpl extends _DOMTypeBase implements IDBKeyRange {
Dynamic get upper() => _wrap(_ptr.upper);
bool get upperOpen() => _wrap(_ptr.upperOpen);
IDBKeyRange bound(/*IDBKey*/ lower, /*IDBKey*/ upper, [bool lowerOpen = null, bool upperOpen = null]) {
if (lowerOpen === null) {
if (upperOpen === null) {
return _wrap(_ptr.bound(_unwrap(lower), _unwrap(upper)));
}
} else {
if (upperOpen === null) {
return _wrap(_ptr.bound(_unwrap(lower), _unwrap(upper), _unwrap(lowerOpen)));
} else {
return _wrap(_ptr.bound(_unwrap(lower), _unwrap(upper), _unwrap(lowerOpen), _unwrap(upperOpen)));
}
}
throw "Incorrect number or type of arguments";
}
IDBKeyRange lowerBound(/*IDBKey*/ bound, [bool open = null]) {
if (open === null) {
return _wrap(_ptr.lowerBound(_unwrap(bound)));
} else {
return _wrap(_ptr.lowerBound(_unwrap(bound), _unwrap(open)));
}
}
IDBKeyRange only(/*IDBKey*/ value) {
return _wrap(_ptr.only(_unwrap(value)));
}
IDBKeyRange upperBound(/*IDBKey*/ bound, [bool open = null]) {
if (open === null) {
return _wrap(_ptr.upperBound(_unwrap(bound)));
} else {
return _wrap(_ptr.upperBound(_unwrap(bound), _unwrap(open)));
}
}
}
class _IDBObjectStoreImpl extends _DOMTypeBase implements IDBObjectStore {
@ -29814,18 +29779,6 @@ interface IDBKeyRange {
/** @domName IDBKeyRange.upperOpen */
final bool upperOpen;
/** @domName IDBKeyRange.bound */
IDBKeyRange bound(/*IDBKey*/ lower, /*IDBKey*/ upper, [bool lowerOpen, bool upperOpen]);
/** @domName IDBKeyRange.lowerBound */
IDBKeyRange lowerBound(/*IDBKey*/ bound, [bool open]);
/** @domName IDBKeyRange.only */
IDBKeyRange only(/*IDBKey*/ value);
/** @domName IDBKeyRange.upperBound */
IDBKeyRange upperBound(/*IDBKey*/ bound, [bool open]);
}
// 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

View file

@ -7534,14 +7534,6 @@ class _IDBKeyRangeImpl implements IDBKeyRange native "*IDBKeyRange" {
final Dynamic upper;
final bool upperOpen;
_IDBKeyRangeImpl bound(lower, upper, [bool lowerOpen = null, bool upperOpen = null]) native;
_IDBKeyRangeImpl lowerBound(bound, [bool open = null]) native;
_IDBKeyRangeImpl only(value) native;
_IDBKeyRangeImpl upperBound(bound, [bool open = null]) native;
}
class _IDBObjectStoreImpl implements IDBObjectStore native "*IDBObjectStore" {
@ -24333,18 +24325,6 @@ interface IDBKeyRange {
/** @domName IDBKeyRange.upperOpen */
final bool upperOpen;
/** @domName IDBKeyRange.bound */
IDBKeyRange bound(/*IDBKey*/ lower, /*IDBKey*/ upper, [bool lowerOpen, bool upperOpen]);
/** @domName IDBKeyRange.lowerBound */
IDBKeyRange lowerBound(/*IDBKey*/ bound, [bool open]);
/** @domName IDBKeyRange.only */
IDBKeyRange only(/*IDBKey*/ value);
/** @domName IDBKeyRange.upperBound */
IDBKeyRange upperBound(/*IDBKey*/ bound, [bool open]);
}
// 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