OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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._debugger; | 5 library dart._debugger; |
6 | 6 |
7 import 'dart:_foreign_helper' show JS; | 7 import 'dart:_foreign_helper' show JS; |
8 import 'dart:_runtime' as dart; | 8 import 'dart:_runtime' as dart; |
9 import 'dart:core'; | 9 import 'dart:core'; |
10 import 'dart:collection'; | 10 import 'dart:collection'; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 } | 318 } |
319 | 319 |
320 toJsonML() => _jsonML; | 320 toJsonML() => _jsonML; |
321 } | 321 } |
322 | 322 |
323 /// Whether an object is a native JavaScript type where we should display the | 323 /// Whether an object is a native JavaScript type where we should display the |
324 /// JavaScript view of the object instead of the custom Dart specific render | 324 /// JavaScript view of the object instead of the custom Dart specific render |
325 /// of properties. | 325 /// of properties. |
326 bool isNativeJavaScriptObject(object) { | 326 bool isNativeJavaScriptObject(object) { |
327 var type = _typeof(object); | 327 var type = _typeof(object); |
| 328 if (type != 'object' && type != 'function') return true; |
| 329 |
| 330 if (dart.isJsInterop(object) && dart.getModuleName(object) == null) { |
| 331 return true; |
| 332 } |
| 333 |
328 // Treat Node objects as a native JavaScript type as the regular DOM render | 334 // Treat Node objects as a native JavaScript type as the regular DOM render |
329 // in devtools is superior to the dart specific view. | 335 // in devtools is superior to the dart specific view. |
330 return (type != 'object' && type != 'function') || | 336 return object is html.Node; |
331 dart.isJsInterop(object) || | |
332 object is html.Node; | |
333 } | 337 } |
334 | 338 |
335 /// Class implementing the Devtools Formatter API described by: | 339 /// Class implementing the Devtools Formatter API described by: |
336 /// https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335
T3U | 340 /// https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335
T3U |
337 /// Specifically, a formatter implements a header, hasBody, and body method. | 341 /// Specifically, a formatter implements a header, hasBody, and body method. |
338 /// This class renders the simple structured format objects [_simpleFormatter] | 342 /// This class renders the simple structured format objects [_simpleFormatter] |
339 /// provides as JsonML. | 343 /// provides as JsonML. |
340 class JsonMLFormatter { | 344 class JsonMLFormatter { |
341 // TODO(jacobr): define a SimpleFormatter base class that DartFormatter | 345 // TODO(jacobr): define a SimpleFormatter base class that DartFormatter |
342 // implements if we decide to use this class elsewhere. We specify that the | 346 // implements if we decide to use this class elsewhere. We specify that the |
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 // If export worked for private SDK libraries we could just export | 877 // If export worked for private SDK libraries we could just export |
874 // these methods from dart:_runtime. | 878 // these methods from dart:_runtime. |
875 | 879 |
876 getModuleNames() { | 880 getModuleNames() { |
877 return dart.getModuleNames(); | 881 return dart.getModuleNames(); |
878 } | 882 } |
879 | 883 |
880 getModuleLibraries(String name) { | 884 getModuleLibraries(String name) { |
881 return dart.getModuleLibraries(name); | 885 return dart.getModuleLibraries(name); |
882 } | 886 } |
OLD | NEW |