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

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: Eliminate common sub-expression 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 | tests/html/postmessage_structured_test.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
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 return JS('', '{data: #, height: #, width: #}', 385 return JS('', '{data: #, height: #, width: #}',
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 var proto = JS('', 'Object.getPrototypeOf(#)', value);
397 return JS('bool', '# === Object.prototype', proto) ||
398 JS('bool', '# === null', proto);
399 }
397 bool isImmutableJavaScriptArray(value) => 400 bool isImmutableJavaScriptArray(value) =>
398 JS('bool', r'!!(#.immutable$list)', value); 401 JS('bool', r'!!(#.immutable$list)', value);
399 402
400 403
401 404
402 const String _serializedScriptValue = 405 const String _serializedScriptValue =
403 'num|String|bool|' 406 'num|String|bool|'
404 'JSExtendableArray|=Object|' 407 'JSExtendableArray|=Object|'
405 'Blob|File|NativeByteBuffer|NativeTypedData' 408 'Blob|File|NativeByteBuffer|NativeTypedData'
406 // TODO(sra): Add Date, RegExp. 409 // TODO(sra): Add Date, RegExp.
407 ; 410 ;
408 const annotation_Creates_SerializedScriptValue = 411 const annotation_Creates_SerializedScriptValue =
409 const Creates(_serializedScriptValue); 412 const Creates(_serializedScriptValue);
410 const annotation_Returns_SerializedScriptValue = 413 const annotation_Returns_SerializedScriptValue =
411 const Returns(_serializedScriptValue); 414 const Returns(_serializedScriptValue);
OLDNEW
« no previous file with comments | « no previous file | tests/html/postmessage_structured_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698