OLD | NEW |
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 observatory_element; | 5 library observatory_element; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'package:observatory/app.dart'; | 9 import 'package:observatory/app.dart'; |
10 import 'package:observatory/service.dart'; | 10 import 'package:observatory/service.dart'; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void goto(MouseEvent event, var detail, Element target) { | 90 void goto(MouseEvent event, var detail, Element target) { |
91 app.locationManager.onGoto(event, detail, target); | 91 app.locationManager.onGoto(event, detail, target); |
92 event.stopPropagation(); | 92 event.stopPropagation(); |
93 } | 93 } |
94 | 94 |
95 String makeLink(String url, [ServiceObject obj]) { | 95 String makeLink(String url, [ServiceObject obj]) { |
96 if (obj != null) { | 96 if (obj != null) { |
97 if (obj is Isolate) { | 97 if (obj is Isolate) { |
98 url = '${url}?isolateId=${Uri.encodeComponent(obj.id)}'; | 98 url = '${url}?isolateId=${Uri.encodeComponent(obj.id)}'; |
99 } else { | 99 } else { |
| 100 if (obj.id == null) { |
| 101 // No id |
| 102 return url; |
| 103 } |
100 url = ('${url}?isolateId=${Uri.encodeComponent(obj.isolate.id)}' | 104 url = ('${url}?isolateId=${Uri.encodeComponent(obj.isolate.id)}' |
101 '&objectId=${Uri.encodeComponent(obj.id)}'); | 105 '&objectId=${Uri.encodeComponent(obj.id)}'); |
102 } | 106 } |
103 } | 107 } |
104 return url; | 108 return url; |
105 } | 109 } |
106 | 110 |
107 /// Create a link that can be consumed by [goto]. | 111 /// Create a link that can be consumed by [goto]. |
108 String gotoLink(String url, [ServiceObject obj]) { | 112 String gotoLink(String url, [ServiceObject obj]) { |
109 return app.locationManager.makeLink(makeLink(url, obj)); | 113 return app.locationManager.makeLink(makeLink(url, obj)); |
110 } | 114 } |
111 | 115 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } else result.add(codeUnit); | 149 } else result.add(codeUnit); |
146 } | 150 } |
147 if (wasTruncated) { | 151 if (wasTruncated) { |
148 result.addAll("...".codeUnits); | 152 result.addAll("...".codeUnits); |
149 } else { | 153 } else { |
150 result.add("'".codeUnitAt(0)); | 154 result.add("'".codeUnitAt(0)); |
151 } | 155 } |
152 return new String.fromCharCodes(result); | 156 return new String.fromCharCodes(result); |
153 } | 157 } |
154 } | 158 } |
OLD | NEW |