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

Side by Side Diff: lib/html/src/dart2js_Conversions.dart

Issue 11074005: Wrap Window in case it's a window from a different page / frame. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup Created 8 years, 2 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
« no previous file with comments | « lib/html/scripts/systemhtml.py ('k') | lib/html/src/dart2js_DOMImplementation.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 // JavaScript objects [ECMA-262], DOMString [WEBIDL], Date [ECMA-262] or float 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 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 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 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 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 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 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." 18 // [[PrimitiveValue]] internal property, as defined by [ECMA-262], is not NaN."
19 19
20 // What is required is to ensure that an Lists in the key are actually 20 // What is required is to ensure that an Lists in the key are actually
21 // JavaScript arrays, and any Dates are JavaScript Dates. 21 // JavaScript arrays, and any Dates are JavaScript Dates.
22 22
23 // Conversions for Window.
24
sra1 2012/10/05 22:54:43 Say why Window is intercepted like this (that will
25 Window _convertNativeToDart_Window(win) {
26 return _DOMWindowCrossFrameImpl._createSafe(win);
27 }
28
29 EventTarget _convertNativeToDart_EventTarget(e) {
30 // Assume it's a Window if it contains the setInterval property. It may be
31 // from a different frame - without a patched prototype - so we cannot
32 // rely on Dart type checking.
33 if (JS('bool', r'"setInterval" in #', e))
34 return _DOMWindowCrossFrameImpl._createSafe(event);
35 else
36 return e;
37 }
38
39 EventTarget _convertDartToNative_EventTarget(e) {
40 if (e is _DOMWindowCrossFrameImpl) {
41 return e._window;
42 } else {
43 return e;
44 }
45 }
46
23 // Conversions for ImageData 47 // Conversions for ImageData
24 // 48 //
25 // On Firefox, the returned ImageData is a plain object. 49 // On Firefox, the returned ImageData is a plain object.
26 50
27 class _TypedImageData implements ImageData { 51 class _TypedImageData implements ImageData {
28 final Uint8ClampedArray data; 52 final Uint8ClampedArray data;
29 final int height; 53 final int height;
30 final int width; 54 final int width;
31 55
32 _TypedImageData(this.data, this.height, this.width); 56 _TypedImageData(this.data, this.height, this.width);
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 } 427 }
404 428
405 429
406 bool _isJavaScriptDate(value) => JS('bool', '# instanceof Date', value); 430 bool _isJavaScriptDate(value) => JS('bool', '# instanceof Date', value);
407 bool _isJavaScriptRegExp(value) => JS('bool', '# instanceof RegExp', value); 431 bool _isJavaScriptRegExp(value) => JS('bool', '# instanceof RegExp', value);
408 bool _isJavaScriptArray(value) => JS('bool', '# instanceof Array', value); 432 bool _isJavaScriptArray(value) => JS('bool', '# instanceof Array', value);
409 bool _isJavaScriptSimpleObject(value) => 433 bool _isJavaScriptSimpleObject(value) =>
410 JS('bool', 'Object.getPrototypeOf(#) === Object.prototype', value); 434 JS('bool', 'Object.getPrototypeOf(#) === Object.prototype', value);
411 bool _isImmutableJavaScriptArray(value) => 435 bool _isImmutableJavaScriptArray(value) =>
412 JS('bool', r'!!(#.immutable$list)', value); 436 JS('bool', r'!!(#.immutable$list)', value);
OLDNEW
« no previous file with comments | « lib/html/scripts/systemhtml.py ('k') | lib/html/src/dart2js_DOMImplementation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698