| 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. | |
| 7 // | |
| 8 // Per http://www.w3.org/TR/IndexedDB/#key-construct | |
| 9 // | |
| 10 // "A value is said to be a valid key if it is one of the following types: Array | |
| 11 // JavaScript objects [ECMA-262], DOMString [WEBIDL], Date [ECMA-262] or float | |
| 12 // [WEBIDL]. However Arrays are only valid keys if every item in the array is | |
| 13 // defined and is a valid key (i.e. sparse arrays can not be valid keys) and if | |
| 14 // the Array doesn't directly or indirectly contain itself. Any non-numeric | |
| 15 // properties are ignored, and thus does not affect whether the Array is a valid | |
| 16 // key. Additionally, if the value is of type float, it is only a valid key if | |
| 17 // it is not NaN, and if the value is of type Date it is only a valid key if its | |
| 18 // [[PrimitiveValue]] internal property, as defined by [ECMA-262], is not NaN." | |
| 19 | |
| 20 // What is required is to ensure that an Lists in the key are actually | |
| 21 // JavaScript arrays, and any Dates are JavaScript Dates. | |
| 22 | |
| 23 // Conversions for Window. These check if the window is the local | 6 // Conversions for Window. These check if the window is the local |
| 24 // window, and if it's not, wraps or unwraps it with a secure wrapper. | 7 // window, and if it's not, wraps or unwraps it with a secure wrapper. |
| 25 // We need to test for EventTarget here as well as it's a base type. | 8 // We need to test for EventTarget here as well as it's a base type. |
| 26 // We omit an unwrapper for Window as no methods take a non-local | 9 // We omit an unwrapper for Window as no methods take a non-local |
| 27 // window as a parameter. | 10 // window as a parameter. |
| 28 | 11 |
| 29 part of html; | 12 part of html; |
| 30 | 13 |
| 31 Window _convertNativeToDart_Window(win) { | 14 Window _convertNativeToDart_Window(win) { |
| 32 return _DOMWindowCrossFrame._createSafe(win); | 15 return _DOMWindowCrossFrame._createSafe(win); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 68 |
| 86 // We can get rid of this conversion if _TypedImageData implements the fields | 69 // We can get rid of this conversion if _TypedImageData implements the fields |
| 87 // with native names. | 70 // with native names. |
| 88 _convertDartToNative_ImageData(ImageData imageData) { | 71 _convertDartToNative_ImageData(ImageData imageData) { |
| 89 if (imageData is _TypedImageData) { | 72 if (imageData is _TypedImageData) { |
| 90 return JS('', '{data: #, height: #, width: #}', | 73 return JS('', '{data: #, height: #, width: #}', |
| 91 imageData.data, imageData.height, imageData.width); | 74 imageData.data, imageData.height, imageData.width); |
| 92 } | 75 } |
| 93 return imageData; | 76 return imageData; |
| 94 } | 77 } |
| OLD | NEW |