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 // Consider all regular JS objects that do not represent Dart modules native |
| 331 // JavaScript objects. |
| 332 if (dart.isJsInterop(object) && dart.getModuleName(object) == null) { |
| 333 return true; |
| 334 } |
| 335 |
328 // Treat Node objects as a native JavaScript type as the regular DOM render | 336 // Treat Node objects as a native JavaScript type as the regular DOM render |
329 // in devtools is superior to the dart specific view. | 337 // in devtools is superior to the dart specific view. |
330 return (type != 'object' && type != 'function') || | 338 return object is html.Node; |
331 dart.isJsInterop(object) || | |
332 object is html.Node; | |
333 } | 339 } |
334 | 340 |
335 /// Class implementing the Devtools Formatter API described by: | 341 /// Class implementing the Devtools Formatter API described by: |
336 /// https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335
T3U | 342 /// https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335
T3U |
337 /// Specifically, a formatter implements a header, hasBody, and body method. | 343 /// Specifically, a formatter implements a header, hasBody, and body method. |
338 /// This class renders the simple structured format objects [_simpleFormatter] | 344 /// This class renders the simple structured format objects [_simpleFormatter] |
339 /// provides as JsonML. | 345 /// provides as JsonML. |
340 class JsonMLFormatter { | 346 class JsonMLFormatter { |
341 // TODO(jacobr): define a SimpleFormatter base class that DartFormatter | 347 // TODO(jacobr): define a SimpleFormatter base class that DartFormatter |
342 // implements if we decide to use this class elsewhere. We specify that the | 348 // 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 | 879 // If export worked for private SDK libraries we could just export |
874 // these methods from dart:_runtime. | 880 // these methods from dart:_runtime. |
875 | 881 |
876 getModuleNames() { | 882 getModuleNames() { |
877 return dart.getModuleNames(); | 883 return dart.getModuleNames(); |
878 } | 884 } |
879 | 885 |
880 getModuleLibraries(String name) { | 886 getModuleLibraries(String name) { |
881 return dart.getModuleLibraries(name); | 887 return dart.getModuleLibraries(name); |
882 } | 888 } |
OLD | NEW |