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

Side by Side Diff: sdk/lib/html/html_common/conversions.dart

Issue 886673002: Check for null prototype in isJavaScriptSimpleObject (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | 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
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 imageData.data, imageData.height, imageData.width); 386 imageData.data, imageData.height, imageData.width);
387 } 387 }
388 return imageData; 388 return imageData;
389 } 389 }
390 390
391 391
392 bool isJavaScriptDate(value) => JS('bool', '# instanceof Date', value); 392 bool isJavaScriptDate(value) => JS('bool', '# instanceof Date', value);
393 bool isJavaScriptRegExp(value) => JS('bool', '# instanceof RegExp', value); 393 bool isJavaScriptRegExp(value) => JS('bool', '# instanceof RegExp', value);
394 bool isJavaScriptArray(value) => JS('bool', '# instanceof Array', value); 394 bool isJavaScriptArray(value) => JS('bool', '# instanceof Array', value);
395 bool isJavaScriptSimpleObject(value) => 395 bool isJavaScriptSimpleObject(value) =>
396 JS('bool', 'Object.getPrototypeOf(#) === Object.prototype', value); 396 JS('bool', 'Object.getPrototypeOf(#) === Object.prototype', value) ||
397 JS('bool', 'Object.getPrototypeOf(#) === null', value);
sra1 2015/01/29 02:32:57 Please CSE, the compiler can't do it: { var pro
Alan Knight 2015/01/29 22:52:44 Done.
397 bool isImmutableJavaScriptArray(value) => 398 bool isImmutableJavaScriptArray(value) =>
398 JS('bool', r'!!(#.immutable$list)', value); 399 JS('bool', r'!!(#.immutable$list)', value);
399 400
400 401
401 402
402 const String _serializedScriptValue = 403 const String _serializedScriptValue =
403 'num|String|bool|' 404 'num|String|bool|'
404 'JSExtendableArray|=Object|' 405 'JSExtendableArray|=Object|'
405 'Blob|File|NativeByteBuffer|NativeTypedData' 406 'Blob|File|NativeByteBuffer|NativeTypedData'
406 // TODO(sra): Add Date, RegExp. 407 // TODO(sra): Add Date, RegExp.
407 ; 408 ;
408 const annotation_Creates_SerializedScriptValue = 409 const annotation_Creates_SerializedScriptValue =
409 const Creates(_serializedScriptValue); 410 const Creates(_serializedScriptValue);
410 const annotation_Returns_SerializedScriptValue = 411 const annotation_Returns_SerializedScriptValue =
411 const Returns(_serializedScriptValue); 412 const Returns(_serializedScriptValue);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698