| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 // Conversions for IDBKey. | 6 // Conversions for IDBKey. |
| 7 // | 7 // |
| 8 // Per http://www.w3.org/TR/IndexedDB/#key-construct | 8 // Per http://www.w3.org/TR/IndexedDB/#key-construct |
| 9 // | 9 // |
| 10 // "A value is said to be a valid key if it is one of the following types: Array | 10 // "A value is said to be a valid key if it is one of the following types: Array |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // TODO(sra). | 216 // TODO(sra). |
| 217 throw new UnimplementedError('structured clone of RegExp'); | 217 throw new UnimplementedError('structured clone of RegExp'); |
| 218 } | 218 } |
| 219 | 219 |
| 220 if (isJavaScriptPromise(e)) { | 220 if (isJavaScriptPromise(e)) { |
| 221 return convertNativePromiseToDartFuture(e); | 221 return convertNativePromiseToDartFuture(e); |
| 222 } | 222 } |
| 223 | 223 |
| 224 if (isJavaScriptSimpleObject(e)) { | 224 if (isJavaScriptSimpleObject(e)) { |
| 225 // TODO(sra): If mustCopy is false, swizzle the prototype for one of a Map | 225 // TODO(sra): If mustCopy is false, swizzle the prototype for one of a Map |
| 226 // implementation that uses the properies as storage. | 226 // implementation that uses the properties as storage. |
| 227 var slot = findSlot(e); | 227 var slot = findSlot(e); |
| 228 var copy = readSlot(slot); | 228 var copy = readSlot(slot); |
| 229 if (copy != null) return copy; | 229 if (copy != null) return copy; |
| 230 copy = {}; | 230 copy = {}; |
| 231 | 231 |
| 232 writeSlot(slot, copy); | 232 writeSlot(slot, copy); |
| 233 forEachJsField(e, (key, value) => copy[key] = walk(value)); | 233 forEachJsField(e, (key, value) => copy[key] = walk(value)); |
| 234 return copy; | 234 return copy; |
| 235 } | 235 } |
| 236 | 236 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 // We can get rid of this conversion if _TypedImageData implements the fields | 345 // We can get rid of this conversion if _TypedImageData implements the fields |
| 346 // with native names. | 346 // with native names. |
| 347 convertDartToNative_ImageData(ImageData imageData) { | 347 convertDartToNative_ImageData(ImageData imageData) { |
| 348 if (imageData is _TypedImageData) { | 348 if (imageData is _TypedImageData) { |
| 349 return JS('', '{data: #, height: #, width: #}', | 349 return JS('', '{data: #, height: #, width: #}', |
| 350 imageData.data, imageData.height, imageData.width); | 350 imageData.data, imageData.height, imageData.width); |
| 351 } | 351 } |
| 352 return imageData; | 352 return imageData; |
| 353 } | 353 } |
| OLD | NEW |