Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dwds/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ linter:
- directives_ordering
- prefer_final_locals
- unawaited_futures
- avoid_void_async
2 changes: 1 addition & 1 deletion dwds/debug_extension/tool/copy_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class _CopyBuilder extends Builder {
};

@override
void build(BuildStep buildStep) async {
Future<void> build(BuildStep buildStep) async {
final inputAsset = buildStep.inputId;
final allowedOutputs = buildStep.allowedOutputs;

Expand Down
12 changes: 6 additions & 6 deletions dwds/debug_extension/web/background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void _startDebugging(DebuggerTrigger debuggerTrigger) {
}));
}

void _attachDebuggerToTab(Tab currentTab) async {
Future<void> _attachDebuggerToTab(Tab currentTab) async {
if (!_debuggableTabs.contains(currentTab.id)) return;

if (_tabIdToWarning.containsKey(currentTab.id)) {
Expand Down Expand Up @@ -287,7 +287,7 @@ void _handleMessageFromPanelScript(Request request, MessageSender sender) {
}
}

void _maybeMarkTabAsDebuggable(
Future<void> _maybeMarkTabAsDebuggable(
Request request, MessageSender sender, Function sendResponse) async {
// Register any warnings for the tab:
if (request.warning != '') {
Expand All @@ -300,7 +300,7 @@ void _maybeMarkTabAsDebuggable(
sendResponse(true);
}

void _maybeAttachDebugSession(
Future<void> _maybeAttachDebugSession(
Debuggee source,
String method,
Object? params,
Expand Down Expand Up @@ -361,15 +361,15 @@ int _removeDebugSessionForTab(int tabId) {
}
}

void _maybeSaveDevToolsTabId(Tab tab) async {
Future<void> _maybeSaveDevToolsTabId(Tab tab) async {
// Remembers the ID of the DevTools tab.
//
// This assumes that the next launched tab after a session is created is the
// DevTools tab.
if (_debugSessions.isNotEmpty) _debugSessions.last.devtoolsTabId ??= tab.id;
}

void _handleMessageFromExternalExtensions(
Future<void> _handleMessageFromExternalExtensions(
dynamic jsRequest, MessageSender sender, Function sendResponse) async {
if (jsRequest == null) return;
final request = jsRequest as Request;
Expand Down Expand Up @@ -408,7 +408,7 @@ void _handleMessageFromExternalExtensions(
}
}

void _forwardMessageToExternalExtensions(
Future<void> _forwardMessageToExternalExtensions(
Debuggee source, String method, Object? params) async {
if (_allowedEvents.contains(method)) {
sendMessageToExtensions(ExternalExtensionRequest(
Expand Down
2 changes: 1 addition & 1 deletion dwds/debug_extension_mv3/tool/copy_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class _CopyBuilder extends Builder {
};

@override
void build(BuildStep buildStep) async {
Future<void> build(BuildStep buildStep) async {
final inputAsset = buildStep.inputId;
final allowedOutputs = buildStep.allowedOutputs;

Expand Down
5 changes: 3 additions & 2 deletions dwds/debug_extension_mv3/web/background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void _registerListeners() {
));
}

void _handleRuntimeMessages(
Future<void> _handleRuntimeMessages(
dynamic jsRequest, MessageSender sender, Function sendResponse) async {
if (jsRequest is! String) return;

Expand Down Expand Up @@ -137,7 +137,8 @@ void _handleRuntimeMessages(
});
}

void _detectNavigationAwayFromDartApp(NavigationInfo navigationInfo) async {
Future<void> _detectNavigationAwayFromDartApp(
NavigationInfo navigationInfo) async {
final tabId = navigationInfo.tabId;
final debugInfo = await _fetchDebugInfo(navigationInfo.tabId);
if (debugInfo == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ final _eventsForAngularDartDevTools = {
'dwds.encodedUri',
};

void handleMessagesFromAngularDartDevTools(
Future<void> handleMessagesFromAngularDartDevTools(
dynamic jsRequest, MessageSender sender, Function sendResponse) async {
if (jsRequest == null) return;
final message = jsRequest as ExternalExtensionMessage;
if (message.name == 'chrome.debugger.sendCommand') {
_forwardCommandToChromeDebugger(message, sendResponse);
} else if (message.name == 'dwds.encodedUri') {
_respondWithEncodedUri(message.tabId, sendResponse);
await _respondWithEncodedUri(message.tabId, sendResponse);
} else if (message.name == 'dwds.startDebugging') {
attachDebugger(message.tabId, trigger: Trigger.angularDartDevTools);
await attachDebugger(message.tabId, trigger: Trigger.angularDartDevTools);
sendResponse(true);
} else {
sendResponse(
Expand Down Expand Up @@ -83,7 +83,7 @@ void _respondWithChromeResult(Object? chromeResult, Function sendResponse) {
}
}

void _respondWithEncodedUri(int tabId, Function sendResponse) async {
Future<void> _respondWithEncodedUri(int tabId, Function sendResponse) async {
final encodedUri = await fetchStorageObject<String>(
type: StorageObject.encodedUri, tabId: tabId);
sendResponse(encodedUri ?? '');
Expand Down
6 changes: 4 additions & 2 deletions dwds/debug_extension_mv3/web/debug_session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ bool get existsActiveDebugSession => _debugSessions.isNotEmpty;
int? get latestAppBeingDebugged =>
existsActiveDebugSession ? _debugSessions.last.appTabId : null;

void attachDebugger(int dartAppTabId, {required Trigger trigger}) async {
Future<void> attachDebugger(int dartAppTabId,
{required Trigger trigger}) async {
// Check if a debugger is already attached:
final existingDebuggerLocation = _debuggerLocation(dartAppTabId);
if (existingDebuggerLocation != null) {
Expand Down Expand Up @@ -372,7 +373,8 @@ void _forwardChromeDebuggerEventToDwds(
}
}

void _openDevTools(String devToolsUri, {required int dartAppTabId}) async {
Future<void> _openDevTools(String devToolsUri,
{required int dartAppTabId}) async {
if (devToolsUri.isEmpty) {
debugError('DevTools URI is empty.');
return;
Expand Down
4 changes: 2 additions & 2 deletions dwds/debug_extension_mv3/web/devtools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bool panelsExist = false;

void main() async {
_registerListeners();
_maybeCreatePanels();
await _maybeCreatePanels();
}

void _registerListeners() {
Expand All @@ -31,7 +31,7 @@ void _registerListeners() {
}));
}

void _maybeCreatePanels() async {
Future<void> _maybeCreatePanels() async {
if (panelsExist) return;
final tabId = chrome.devtools.inspectedWindow.tabId;
final debugInfo = await fetchStorageObject<DebugInfo>(
Expand Down
4 changes: 2 additions & 2 deletions dwds/debug_extension_mv3/web/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ void _registerListeners() {
saveButton.addEventListener('click', _saveSettingsToStorage);
}

void _updateSettingsFromStorage(Event _) async {
Future<void> _updateSettingsFromStorage(Event _) async {
final devToolsOpener = await fetchStorageObject<DevToolsOpener>(
type: StorageObject.devToolsOpener);
final openInNewWindow = devToolsOpener?.newWindow ?? false;
_getRadioButton('windowOpt').checked = openInNewWindow;
_getRadioButton('tabOpt').checked = !openInNewWindow;
}

void _saveSettingsToStorage(Event event) async {
Future<void> _saveSettingsToStorage(Event event) async {
event.preventDefault();
_maybeHideSavedMsg();
final form = document.querySelector("form") as FormElement;
Expand Down
2 changes: 1 addition & 1 deletion dwds/lib/src/debugging/debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class Debugger extends Domain {
Future<void> resumeFromStart() => _resumeHandler(null);

/// Notify the debugger the [Isolate] is paused at the application start.
void notifyPausedAtStart() async {
void notifyPausedAtStart() {
stackComputer = FrameComputer(this, []);
}

Expand Down
8 changes: 4 additions & 4 deletions dwds/lib/src/handlers/dev_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ class DevHandler {
.createIsolate(appConnection);
}

void _listen() async {
Future<void> _listen() async {
_subs.add(_injected.devHandlerPaths.listen((devHandlerPath) async {
final uri = Uri.parse(devHandlerPath);
if (!_sseHandlers.containsKey(uri.path)) {
Expand Down Expand Up @@ -473,14 +473,14 @@ class DevHandler {
return appDebugService;
}

void _listenForDebugExtension() async {
Future<void> _listenForDebugExtension() async {
while (await _extensionBackend!.connections.hasNext) {
_startExtensionDebugService();
await _startExtensionDebugService();
}
}

/// Starts a [DebugService] for Dart Debug Extension.
void _startExtensionDebugService() async {
Future<void> _startExtensionDebugService() async {
final extensionDebugger = await _extensionBackend!.extensionDebugger;
// Waits for a `DevToolsRequest` to be sent from the extension background
// when the extension is clicked.
Expand Down
2 changes: 1 addition & 1 deletion dwds/lib/src/services/batched_expression_evaluator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class BatchedExpressionEvaluator extends ExpressionEvaluator {
return request.completer.future;
}

void _processRequest(List<EvaluateRequest> requests) async {
Future<void> _processRequest(List<EvaluateRequest> requests) async {
String? libraryUri;
String? isolateId;
Map<String, String>? scope;
Expand Down
5 changes: 3 additions & 2 deletions dwds/lib/src/services/chrome_proxy_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
..timestamp = event.timestamp.toInt());
break;
case 'dart.developer.log':
_handleDeveloperLog(isolateRef, event);
await _handleDeveloperLog(isolateRef, event);
break;
default:
break;
Expand All @@ -1005,7 +1005,8 @@ ${globalLoadStrategy.loadModuleSnippet}("dart_sdk").developer.invokeExtension(
controller.add(event);
}

void _handleDeveloperLog(IsolateRef isolateRef, ConsoleAPIEvent event) async {
Future<void> _handleDeveloperLog(
IsolateRef isolateRef, ConsoleAPIEvent event) async {
final logObject = event.params?['args'][1] as Map?;
final logParams = <String, RemoteObject>{};
for (dynamic obj in logObject?['preview']?['properties'] ?? {}) {
Expand Down
2 changes: 1 addition & 1 deletion dwds/test/fixtures/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ class TestContext {
void makeEditToDartEntryFile({
required String toReplace,
required String replaceWith,
}) async {
}) {
final file = File(_dartEntryFilePath);
final fileContents = file.readAsStringSync();
file.writeAsStringSync(fileContents.replaceAll(toReplace, replaceWith));
Expand Down
20 changes: 10 additions & 10 deletions dwds/test/puppeteer/extension_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ void main() async {
(target) => target.url.startsWith('devtools://devtools'));
chromeDevToolsTarget.type = 'page';
final chromeDevToolsPage = await chromeDevToolsTarget.page;
_tabLeft(chromeDevToolsPage);
await _tabLeft(chromeDevToolsPage);
await _takeScreenshot(chromeDevToolsPage,
screenshotName: 'chromeDevTools_externalBuild');
final inspectorPanelTarget = browser.targets.firstWhereOrNull(
Expand Down Expand Up @@ -564,7 +564,7 @@ void main() async {
// therefore we rely on a slight delay:
await Future.delayed(Duration(seconds: 1));
if (isFlutterApp) {
_tabLeft(chromeDevToolsPage);
await _tabLeft(chromeDevToolsPage);
final inspectorPanelElement = await _getPanelElement(
browser,
panel: Panel.inspector,
Expand All @@ -576,7 +576,7 @@ void main() async {
screenshotName: 'inspectorPanelLandingPage_flutterApp',
);
}
_tabLeft(chromeDevToolsPage);
await _tabLeft(chromeDevToolsPage);
final debuggerPanelElement = await _getPanelElement(
browser,
panel: Panel.debugger,
Expand All @@ -597,9 +597,9 @@ void main() async {
// therefore we rely on a slight delay:
await Future.delayed(Duration(seconds: 1));
// Navigate to the Dart Debugger panel:
_tabLeft(chromeDevToolsPage);
await _tabLeft(chromeDevToolsPage);
if (isFlutterApp) {
_tabLeft(chromeDevToolsPage);
await _tabLeft(chromeDevToolsPage);
}
await _clickLaunchButton(
browser,
Expand Down Expand Up @@ -661,9 +661,9 @@ void main() async {
// therefore we rely on a slight delay:
await Future.delayed(Duration(seconds: 1));
// Navigate to the Dart Debugger panel:
_tabLeft(chromeDevToolsPage);
await _tabLeft(chromeDevToolsPage);
if (isFlutterApp) {
_tabLeft(chromeDevToolsPage);
await _tabLeft(chromeDevToolsPage);
}
await _clickLaunchButton(
browser,
Expand Down Expand Up @@ -702,9 +702,9 @@ void main() async {
// therefore we rely on a slight delay:
await Future.delayed(Duration(seconds: 1));
// Navigate to the Dart Debugger panel:
_tabLeft(chromeDevToolsPage);
await _tabLeft(chromeDevToolsPage);
if (isFlutterApp) {
_tabLeft(chromeDevToolsPage);
await _tabLeft(chromeDevToolsPage);
}
// Expect there to be no warning banner:
var warningMsg = await _evaluateInPanel<String>(browser,
Expand Down Expand Up @@ -884,7 +884,7 @@ Future<ElementHandle?> _getPanelElement(
return panelElement;
}

void _tabLeft(Page chromeDevToolsPage) async {
Future<void> _tabLeft(Page chromeDevToolsPage) async {
// TODO(elliette): Detect which enviroment we are OS we are running
// in and update modifier key accordingly. Meta key for MacOs and
// Ctrl key for Linux/Windows.
Expand Down