Skip to content

Commit 57d32a8

Browse files
author
Anna Gringauze
authored
Cherry-picked hotfix for chrome 100 update, updated version (#1570)
* Cherry-picked hotfix for chrome 100 update, updated version Use locas dwds in webdev * Remove notification on failure in CI * Fix failing extension tests
1 parent 5610428 commit 57d32a8

File tree

13 files changed

+4568
-4814
lines changed

13 files changed

+4568
-4814
lines changed

dwds/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 12.1.1
2+
3+
- Hotfix: Fix missing `CallFrame.url` after update to Chrome 100.
4+
15
## 12.1.0
26
- Update _fe_analyzer_shared to version ^34.0.0.
37

dwds/debug_extension/web/background.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,6 @@ void _filterAndForwardToBackend(Debuggee source, String method, Object params) {
456456

457457
if (debugSession == null) return;
458458

459-
if (method == 'Debugger.scriptParsed') return;
460-
461459
var event = _extensionEventFor(method, params);
462460

463461
debugSession.socketClient.sink.add(jsonEncode(serializers.serialize(event)));

dwds/debug_extension/web/background.js

Lines changed: 4146 additions & 4181 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dwds/lib/src/debugging/debugger.dart

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,15 +309,22 @@ class Debugger extends Domain {
309309
}
310310
}
311311

312+
/// Returns Chrome script uri for Chrome script ID.
313+
String _urlForScriptId(String scriptId) =>
314+
_remoteDebugger.scripts[scriptId]?.url;
315+
312316
/// Returns source [Location] for the paused event.
313317
///
314318
/// If we do not have [Location] data for the embedded JS location, null is
315319
/// returned.
316320
Future<Location> _sourceLocation(DebuggerPausedEvent e) {
317321
var frame = e.params['callFrames'][0];
318322
var location = frame['location'];
319-
return _locations.locationForJs(
320-
frame['url'] as String, (location['lineNumber'] as int) + 1);
323+
var scriptId = location['scriptId'] as String;
324+
var lineNumber = location['lineNumber'] as int;
325+
326+
var url = _urlForScriptId(scriptId);
327+
return _locations.locationForJs(url, lineNumber + 1);
321328
}
322329

323330
/// The variables visible in a frame in Dart protocol [BoundVariable] form.
@@ -448,10 +455,17 @@ class Debugger extends Domain {
448455
// Chrome is 0 based. Account for this.
449456
var line = location.lineNumber + 1;
450457
var column = location.columnNumber + 1;
458+
459+
var url = _urlForScriptId(location.scriptId);
460+
if (url == null) {
461+
logger.severe('Failed to create dart frame for ${frame.functionName}: '
462+
'cannot find location for script ${location.scriptId}');
463+
}
464+
451465
// TODO(sdk/issues/37240) - ideally we look for an exact location instead
452466
// of the closest location on a given line.
453467
Location bestLocation;
454-
for (var location in await _locations.locationsForUrl(frame.url)) {
468+
for (var location in await _locations.locationsForUrl(url)) {
455469
if (location.jsLocation.line == line) {
456470
bestLocation ??= location;
457471
if ((location.jsLocation.column - column).abs() <
@@ -551,8 +565,14 @@ class Debugger extends Domain {
551565
// If we don't have source location continue stepping.
552566
if (_isStepping && (await _sourceLocation(e)) == null) {
553567
var frame = e.params['callFrames'][0];
554-
var url = '${frame["url"]}';
555568
var scriptId = '${frame["location"]["scriptId"]}';
569+
570+
var url = _urlForScriptId(scriptId);
571+
if (url == null) {
572+
logger.severe('Stepping failed: '
573+
'cannot find location for script $scriptId');
574+
}
575+
556576
// TODO(grouma) - In the future we should send all previously computed
557577
// skipLists.
558578
await _remoteDebugger.stepInto(params: {

dwds/lib/src/debugging/modules.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ class Modules {
2020
final _sourceToLibrary = <String, Uri>{};
2121
var _moduleMemoizer = AsyncMemoizer<void>();
2222

23-
// The Chrome script ID to corresponding module.
24-
final _scriptIdToModule = <String, String>{};
25-
2623
final Map<String, String> _libraryToModule = {};
2724

2825
String _entrypoint;
@@ -43,9 +40,6 @@ class Modules {
4340
_entrypoint = entrypoint;
4441
}
4542

46-
/// Returns the module for the Chrome script ID.
47-
String moduleForScriptId(String scriptId) => _scriptIdToModule[scriptId];
48-
4943
/// Returns the containing module for the provided Dart server path.
5044
Future<String> moduleForSource(String serverPath) async {
5145
await _moduleMemoizer.runOnce(_initializeMapping);

0 commit comments

Comments
 (0)