Skip to content

Disable the "Paused" overlay #1509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 17, 2022
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/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- Change wording of paused overlay from "Paused in Dart DevTools" to "Paused"
- Allow sending back the Dart DevTools URL from DWDS instead of launching
Dart DevTools, to support embedding Dart DevTools in Chrome DevTools.
- Temporarily disable the paused in debugger overlay.

## 12.1.0
- Update _fe_analyzer_shared to version ^34.0.0.
Expand Down
53 changes: 31 additions & 22 deletions dwds/lib/src/debugging/debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ class Debugger extends Domain {

PauseState _pauseState = PauseState.none;

bool _pausedOverlayVisible = false;
// TODO(elliette): https://github.com/dart-lang/webdev/issues/1501 Re-enable
// after checking with Chrome team if there is a way to check if the Chrome
// DevTools is showing an overlay. Both cannot be shown at the same time:
// bool _pausedOverlayVisible = false;

String get pauseState => _pauseModePauseStates.entries
.firstWhere((entry) => entry.value == _pauseState)
Expand Down Expand Up @@ -394,28 +397,28 @@ class Debugger extends Domain {
return await inspector.jsCallFunctionOn(receiver, expression, args);
}

// TODO(elliette): https://github.com/dart-lang/webdev/issues/1501 Re-enable
// after checking with Chrome team if there is a way to check if the Chrome
// DevTools is showing an overlay. Both cannot be shown at the same time:

// Renders the paused at breakpoint overlay over the application.
// TODO(elliette): Detect whether or not Chrome DevTools is also open, and
// if so don't show this overlay. Chrome DevTools also adds an overlay above
// this one. Currently we just make sure our overlay message is shorter than
// Chrome DevTools message, so that our overlay is hidden.
void _showPausedOverlay() async {
if (_pausedOverlayVisible) return;
handleErrorIfPresent(await _remoteDebugger?.sendCommand('DOM.enable'));
handleErrorIfPresent(await _remoteDebugger?.sendCommand('Overlay.enable'));
handleErrorIfPresent(await _remoteDebugger
?.sendCommand('Overlay.setPausedInDebuggerMessage', params: {
'message': 'Paused',
}));
_pausedOverlayVisible = true;
}
// void _showPausedOverlay() async {
// if (_pausedOverlayVisible) return;
// handleErrorIfPresent(await _remoteDebugger?.sendCommand('DOM.enable'));
// handleErrorIfPresent(await _remoteDebugger?.sendCommand('Overlay.enable'));
// handleErrorIfPresent(await _remoteDebugger
// ?.sendCommand('Overlay.setPausedInDebuggerMessage', params: {
// 'message': 'Paused',
// }));
// _pausedOverlayVisible = true;
// }

// Removes the paused at breakpoint overlay from the application.
void _hidePausedOverlay() async {
if (!_pausedOverlayVisible) return;
handleErrorIfPresent(await _remoteDebugger?.sendCommand('Overlay.disable'));
_pausedOverlayVisible = false;
}
// void _hidePausedOverlay() async {
// if (!_pausedOverlayVisible) return;
// handleErrorIfPresent(await _remoteDebugger?.sendCommand('Overlay.disable'));
// _pausedOverlayVisible = false;
// }

/// Calls the Chrome Runtime.getProperties API for the object with [objectId].
///
Expand Down Expand Up @@ -588,7 +591,10 @@ class Debugger extends Domain {
logger.warning('Error calculating Dart frames', e, s);
}

_showPausedOverlay();
// TODO(elliette): https://github.com/dart-lang/webdev/issues/1501 Re-enable
// after checking with Chrome team if there is a way to check if the Chrome
// DevTools is showing an overlay. Both cannot be shown at the same time.
// _showPausedOverlay();
isolate.pauseEvent = event;
_streamNotify('Debug', event);
}
Expand All @@ -606,7 +612,10 @@ class Debugger extends Domain {
timestamp: DateTime.now().millisecondsSinceEpoch,
isolate: inspector.isolateRef);

_hidePausedOverlay();
// TODO(elliette): https://github.com/dart-lang/webdev/issues/1501 Re-enable
// after checking with Chrome team if there is a way to check if the Chrome
// DevTools is showing an overlay. Both cannot be shown at the same time.
// _hidePausedOverlay();
isolate.pauseEvent = event;
_streamNotify('Debug', event);
}
Expand Down