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

Side by Side Diff: sdk/lib/js/dart2js/js_dart2js.dart

Issue 35173004: "Fix" dart:js tests in IE9 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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/js_test.dart » ('j') | tests/html/js_test.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart.js; 5 library dart.js;
6 6
7 import 'dart:html' show Blob, ImageData, Node; 7 import 'dart:html' show Blob, ImageData, Node;
8 import 'dart:collection' show HashMap; 8 import 'dart:collection' show HashMap;
9 import 'dart:indexed_db' show KeyRange; 9 import 'dart:indexed_db' show KeyRange;
10 import 'dart:typed_data' show TypedData; 10 import 'dart:typed_data' show TypedData;
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 } 265 }
266 266
267 // converts a Dart object to a reference to a native JS object 267 // converts a Dart object to a reference to a native JS object
268 // which might be a DartObject JS->Dart proxy 268 // which might be a DartObject JS->Dart proxy
269 Object _convertToDart(o) { 269 Object _convertToDart(o) {
270 if (JS('bool', '# == null', o) || 270 if (JS('bool', '# == null', o) ||
271 JS('bool', 'typeof # == "string"', o) || 271 JS('bool', 'typeof # == "string"', o) ||
272 JS('bool', 'typeof # == "number"', o) || 272 JS('bool', 'typeof # == "number"', o) ||
273 JS('bool', 'typeof # == "boolean"', o)) { 273 JS('bool', 'typeof # == "boolean"', o)) {
274 return o; 274 return o;
275 } else if (o is Blob || o is DateTime || o is KeyRange 275 } else if (o is Blob || o is KeyRange || o is ImageData || o is Node
276 || o is ImageData || o is Node || o is TypedData) { 276 || o is TypedData) {
277 return JS('Blob|DateTime|KeyRange|ImageData|Node|TypedData', '#', o); 277 return JS('Blob|KeyRange|ImageData|Node|TypedData', '#', o);
278 } else if (JS('bool', '# instanceof Date', o)) {
279 var ms = JS('num', '#.getMilliseconds()', o);
280 return new DateTime.fromMillisecondsSinceEpoch(ms);
278 } else if (JS('bool', 'typeof # == "function"', o)) { 281 } else if (JS('bool', 'typeof # == "function"', o)) {
279 return _getDartProxy(o, _DART_CLOSURE_PROPERTY_NAME, 282 return _getDartProxy(o, _DART_CLOSURE_PROPERTY_NAME,
280 (o) => new JsFunction._fromJs(o)); 283 (o) => new JsFunction._fromJs(o));
281 } else if (JS('bool', '#.constructor === DartObject', o)) { 284 } else if (JS('bool', '#.constructor === DartObject', o)) {
282 return JS('', '#.o', o); 285 return JS('', '#.o', o);
283 } else { 286 } else {
284 return _getDartProxy(o, _DART_OBJECT_PROPERTY_NAME, 287 return _getDartProxy(o, _DART_OBJECT_PROPERTY_NAME,
285 (o) => new JsObject._fromJs(o)); 288 (o) => new JsObject._fromJs(o));
286 } 289 }
287 } 290 }
288 291
289 Object _getDartProxy(o, String propertyName, createProxy(o)) { 292 Object _getDartProxy(o, String propertyName, createProxy(o)) {
290 var dartProxy = JS('', '#[#]', o, propertyName); 293 var dartProxy = JS('', '#[#]', o, propertyName);
291 if (dartProxy == null) { 294 if (dartProxy == null) {
292 dartProxy = createProxy(o); 295 dartProxy = createProxy(o);
293 _defineProperty(o, propertyName, dartProxy); 296 _defineProperty(o, propertyName, dartProxy);
294 } 297 }
295 return dartProxy; 298 return dartProxy;
296 } 299 }
OLDNEW
« no previous file with comments | « no previous file | tests/html/js_test.dart » ('j') | tests/html/js_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698