Skip to content

Commit a7ea61f

Browse files
authored
Added support for getModuleLibraries with the DDC library bundle format (#2581)
* Added support for getClassMetadata with the DDc library bundle format * Added support for some debugging APIs with the DDC library bundle format. * Update pattern test to account for new DDC JS variable naming * reverting change to pattern test * Added support for debugging API with the DDC library bundle format. * updated licenses * updated licenses and remove new line from changelog * Added support for some debugging APIs with the DDC library bundle format - getRecordTypeFieldsJsExpression, callInstanceMethodJsExpression * Added support for some debugging APIs with the DDC library bundle format * updated CHANGELOG * refactored test to use common file * delete main_ddc_library_bundle.dart * fixed broken test - decoded response body to match source and renamed stack property * updated changelog * updated dart_scope to not renamed wildcard and skipped related test case * formatted test/common/chrome_proxy_service_common.dart * WIP * WIP * Added support for callLibraryMethod with the DDC library bundle format. * revert changes to callFunction * updated function name and comments * Added support for some debugging APIs with the DDC library bundle format - getModuleLibraries * reorder parameters * made arguments parameter optional * updated comment * removed comments from test/instances/instance_amd_test.dart * removed duplicate import * removed unecessary methods and branching * formatted lib/src/debugging/inspector.dart
1 parent 5dc7950 commit a7ea61f

File tree

7 files changed

+254
-146
lines changed

7 files changed

+254
-146
lines changed

dwds/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
## 24.3.4-wip
2-
- Added support for some debugging APIs with the DDC library bundle format. - [#2566](https://github.com/dart-lang/webdev/issues/2566)
2+
- Added support for some debugging APIs with the DDC library bundle format. - [#2566](https://github.com/dart-lang/webdev/issues/2566), [#2573](https://github.com/dart-lang/webdev/issues/2573)
33

44
## 24.3.3
55

dwds/lib/src/debugging/inspector.dart

+18-22
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,9 @@ class AppInspector implements AppInspectorInterface {
277277
@override
278278
Future<RemoteObject> invoke(
279279
String targetId,
280-
String selector,
281-
List<dynamic> arguments,
282-
) async {
280+
String selector, [
281+
List<dynamic> arguments = const [],
282+
]) async {
283283
final remoteArguments =
284284
arguments.cast<String>().map(remoteObjectFor).toList();
285285
// We special case the Dart library, where invokeMethod won't work because
@@ -302,14 +302,18 @@ class AppInspector implements AppInspectorInterface {
302302
String selector,
303303
List<RemoteObject> arguments,
304304
) {
305+
final libraryUri = library.uri;
306+
if (libraryUri == null) {
307+
throwInvalidParam('invoke', 'library uri is null');
308+
}
305309
return globalToolConfiguration.loadStrategy is DdcLibraryBundleStrategy
306310
? _evaluateLibraryMethodWithDdcLibraryBundle(
307-
library,
311+
libraryUri,
308312
selector,
309313
arguments,
310314
)
311315
: _evaluateInLibrary(
312-
library,
316+
libraryUri,
313317
'function () { return this.$selector.apply(this, arguments); }',
314318
arguments,
315319
);
@@ -337,16 +341,12 @@ class AppInspector implements AppInspectorInterface {
337341
}
338342

339343
/// Evaluate the JS function with source [jsFunction] in the context of
340-
/// [library] with [arguments].
344+
/// the library identified by [libraryUri] with [arguments].
341345
Future<RemoteObject> _evaluateInLibrary(
342-
Library library,
346+
String libraryUri,
343347
String jsFunction,
344348
List<RemoteObject> arguments,
345349
) async {
346-
final libraryUri = library.uri;
347-
if (libraryUri == null) {
348-
throwInvalidParam('invoke', 'library uri is null');
349-
}
350350
final findLibraryJsExpression = globalToolConfiguration
351351
.loadStrategy.dartRuntimeDebugger
352352
.callLibraryMethodJsExpression(libraryUri, jsFunction);
@@ -355,18 +355,14 @@ class AppInspector implements AppInspectorInterface {
355355
return jsCallFunctionOn(remoteLibrary, jsFunction, arguments);
356356
}
357357

358-
/// Evaluates the specified top-level method [methodName] within [library]
359-
/// using the Dart Development Compiler (DDC) library bundle strategy with
360-
/// the given [arguments].
358+
/// Evaluates the specified top-level method [methodName] within the library
359+
/// identified by [libraryUri] using the Dart Development Compiler (DDC)
360+
/// library bundle strategy with the given optional [arguments].
361361
Future<RemoteObject> _evaluateLibraryMethodWithDdcLibraryBundle(
362-
Library library,
363-
String methodName,
364-
List<RemoteObject> arguments,
365-
) {
366-
final libraryUri = library.uri;
367-
if (libraryUri == null) {
368-
throwInvalidParam('invoke', 'library uri is null');
369-
}
362+
String libraryUri,
363+
String methodName, [
364+
List<RemoteObject> arguments = const [],
365+
]) {
370366
final expression = globalToolConfiguration.loadStrategy.dartRuntimeDebugger
371367
.callLibraryMethodJsExpression(libraryUri, methodName);
372368
return _jsCallFunction(expression, arguments);

0 commit comments

Comments
 (0)