@@ -213,10 +213,7 @@ class AppInspector implements AppInspectorInterface {
213
213
// We use the JS pseudo-variable 'arguments' to get the list of all arguments.
214
214
final send = globalToolConfiguration.loadStrategy.dartRuntimeDebugger
215
215
.callInstanceMethodJsExpression (methodName);
216
- print (
217
- '***YJ_TEST: _invokeMethod: receiver: $receiver , methodName: $methodName , positionalArgs: $positionalArgs , send: $send ' );
218
216
final remote = await jsCallFunctionOn (receiver, send, positionalArgs);
219
- print ('***YJ_TEST: _invokeMethod: remote: $remote ' );
220
217
return remote;
221
218
}
222
219
@@ -255,8 +252,6 @@ class AppInspector implements AppInspectorInterface {
255
252
List <Object > arguments, {
256
253
bool returnByValue = false ,
257
254
}) async {
258
- print (
259
- '**YJ_TEST: _jsCallFunction: evalExpression: $evalExpression , arguments: $arguments ' );
260
255
final jsArguments = arguments.map (callArgumentFor).toList ();
261
256
final response = await remoteDebugger.sendCommand (
262
257
'Runtime.callFunctionOn' ,
@@ -285,8 +280,6 @@ class AppInspector implements AppInspectorInterface {
285
280
String selector,
286
281
List <dynamic > arguments,
287
282
) async {
288
- print (
289
- 'YJ_TEST: invoke: targetId: $targetId , selector: $selector , arguments: $arguments ' );
290
283
final remoteArguments =
291
284
arguments.cast <String >().map (remoteObjectFor).toList ();
292
285
// We special case the Dart library, where invokeMethod won't work because
@@ -308,16 +301,14 @@ class AppInspector implements AppInspectorInterface {
308
301
Library library,
309
302
String selector,
310
303
List <RemoteObject > arguments,
311
- ) async {
312
- print (
313
- 'YJ_TEST: _invokeLibraryFunction: library: ${library .uri }, selector: $selector , arguments: $arguments ' ,
314
- );
315
- final result = await _evaluateInLibrary (
316
- library,
317
- 'function () { return this.$selector .apply(this, arguments);}' ,
318
- arguments,
319
- );
320
- return result;
304
+ ) {
305
+ return globalToolConfiguration.loadStrategy is DdcLibraryBundleStrategy
306
+ ? _evaluateWithDdcLibraryBundle (library, selector, arguments)
307
+ : _evaluateInLibrary (
308
+ library,
309
+ 'function () { return this.$selector .apply(this, arguments); }' ,
310
+ arguments,
311
+ );
321
312
}
322
313
323
314
/// Evaluate [expression] by calling Chrome's Runtime.evaluate.
@@ -352,28 +343,29 @@ class AppInspector implements AppInspectorInterface {
352
343
if (libraryUri == null ) {
353
344
throwInvalidParam ('invoke' , 'library uri is null' );
354
345
}
355
- final expression = globalToolConfiguration.loadStrategy.dartRuntimeDebugger
346
+ final findLibraryJsExpression = globalToolConfiguration
347
+ .loadStrategy.dartRuntimeDebugger
356
348
.callLibraryMethodJsExpression (libraryUri, jsFunction);
357
349
358
- print ('YJ_TEST: Evaluating in library: $expression ' );
359
- if (globalToolConfiguration.loadStrategy is DdcLibraryBundleStrategy ) {
360
- print ('YJ_TEST-A-1: DdcLibraryBundleStrategy' );
361
- final result = await _jsCallFunction (jsFunction, arguments);
362
- print (
363
- 'YJ_TEST-A-2: result: $result ' ,
364
- );
365
- return result;
366
- } else {
367
- print ('YJ_TEST-B-1: ${globalToolConfiguration .loadStrategy }' );
368
- final remoteLibrary = await jsEvaluate (expression);
369
- print (
370
- 'YJ_TEST-B-2: remoteLibrary: ${remoteLibrary .objectId }, jsFunction: $jsFunction , arguments: $arguments ' ,
371
- );
372
- final result =
373
- await jsCallFunctionOn (remoteLibrary, jsFunction, arguments);
374
- print ('YJ_TEST-B-3: result: ${result .objectId }' );
375
- return result;
350
+ final remoteLibrary = await jsEvaluate (findLibraryJsExpression);
351
+ return jsCallFunctionOn (remoteLibrary, jsFunction, arguments);
352
+ }
353
+
354
+ /// Evaluates the specified method [methodName] in the context of [library]
355
+ /// using the Dart Development Compiler (DDC) library bundle strategy with
356
+ /// the given [arguments] .
357
+ Future <RemoteObject > _evaluateWithDdcLibraryBundle (
358
+ Library library,
359
+ String methodName,
360
+ List <RemoteObject > arguments,
361
+ ) {
362
+ final libraryUri = library.uri;
363
+ if (libraryUri == null ) {
364
+ throwInvalidParam ('invoke' , 'library uri is null' );
376
365
}
366
+ final expression = globalToolConfiguration.loadStrategy.dartRuntimeDebugger
367
+ .callLibraryMethodJsExpression (libraryUri, methodName);
368
+ return _jsCallFunction (expression, arguments);
377
369
}
378
370
379
371
/// Call [function] with objects referred by [argumentIds] as arguments.
@@ -382,11 +374,7 @@ class AppInspector implements AppInspectorInterface {
382
374
String function,
383
375
Iterable <String > argumentIds,
384
376
) async {
385
- print (
386
- 'YJ_TEST-1: callFunction - function: $function , argumentIDs: $argumentIds ' ,
387
- );
388
377
final arguments = argumentIds.map (remoteObjectFor).toList ();
389
- print ('YJ_TEST-2: callFunction - arguments: $arguments ' );
390
378
final result = await _jsCallFunction (function, arguments);
391
379
return result;
392
380
}
0 commit comments