Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
7 changes: 7 additions & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## 13.1.1-dev
- Add column information to breakpoints to allow precise breakpoint placement.
- Remove dependency on `package:_fe_analyzer_shared`.
Note: this removes current incomplete support for resolving `dart:` uris.
- Fix issues discovered when using flutter tools with web server device:
- Remove `dart:web_sql` from the list of SDK libraries as it is no longer
used.
- Fix crash when using flutter tools with web server device.
- Remove clearing all scripts on page load for extension debugger.

## 13.1.0
- Update _fe_analyzer_shared to version ^38.0.0.
Expand Down
10 changes: 5 additions & 5 deletions dwds/lib/src/debugging/debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ class Debugger extends Domain {
if (url == null) {
logger.severe('Failed to create dart frame for ${frame.functionName}: '
'cannot find location for script ${location.scriptId}');
return null;
}

// TODO(sdk/issues/37240) - ideally we look for an exact location instead
Expand Down Expand Up @@ -740,7 +741,7 @@ String breakpointIdFor(String scriptId, int line, int column) =>

/// Keeps track of the Dart and JS breakpoint Ids that correspond.
class _Breakpoints extends Domain {
final logger = Logger('Breakpoints');
final _logger = Logger('Breakpoints');
final _dartIdByJsId = <String, String>{};
final _jsIdByDartId = <String, String>{};

Expand Down Expand Up @@ -768,10 +769,9 @@ class _Breakpoints extends Domain {
var location = await locations.locationForDart(dartUri, line, column);
// TODO: Handle cases where a breakpoint can't be set exactly at that line.
if (location == null) {
logger
.fine('Failed to set breakpoint at ${dartScript.uri}:$line:$column: '
'Dart location not found for scriptId: $scriptId, '
'server path: ${dartUri.serverPath}, root:$root');
_logger.fine('Failed to set breakpoint $id '
'(${dartUri.serverPath}:$line:$column): '
'cannot find dart location.');
throw RPCError(
'addBreakpoint',
102,
Expand Down
1 change: 0 additions & 1 deletion dwds/lib/src/debugging/metadata/provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class MetadataProvider {
'dart:svg',
'dart:web_audio',
'dart:web_gl',
'dart:web_sql',
'dart:ui',
];

Expand Down
1 change: 1 addition & 0 deletions dwds/lib/src/handlers/dev_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ class DevHandler {
String debugServiceUri, {
String ideQueryParam = '',
}) {
if (!_serveDevTools) return null;
return Uri(
scheme: 'http',
host: _devTools.hostname,
Expand Down
20 changes: 9 additions & 11 deletions dwds/lib/src/injected/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dwds/lib/src/servers/extension_debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class ExtensionDebugger implements RemoteDebugger {

@override
Stream<GlobalObjectClearedEvent> get onGlobalObjectCleared => eventStream(
'Page.frameStartedLoading',
'Debugger.globalObjectCleared',
(WipEvent event) => GlobalObjectClearedEvent(event.json));

@override
Expand Down
11 changes: 11 additions & 0 deletions dwds/lib/src/services/chrome_proxy_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,17 @@ class ChromeProxyService implements VmServiceInterface {
String isolateId, String scriptUri, int line,
{int column}) async {
await isInitialized;
if (Uri.parse(scriptUri).scheme == 'dart') {
_logger.finest('Cannot set breakpoint at $scriptUri:$line:$column: '
'breakpoints in dart SDK locations are not supported yet.');
// TODO(annagrin): Support setting breakpoints in dart SDK locations.
// Issue: https://github.com/dart-lang/webdev/issues/1584
throw RPCError(
'addBreakpoint',
102,
'The VM is unable to add a breakpoint '
'at the specified line or function');
}
var dartUri = DartUri(scriptUri, uri);
var ref = await _inspector.scriptRefFor(dartUri.serverPath);
return (await _debugger)
Expand Down
38 changes: 6 additions & 32 deletions dwds/lib/src/utilities/dart_uri.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

// @dart = 2.9

import 'dart:io';

// ignore: implementation_imports
import 'package:_fe_analyzer_shared/src/util/libraries_specification.dart';
import 'package:logging/logging.dart';
import 'package:package_config/package_config.dart';
import 'package:path/path.dart' as p;
Expand Down Expand Up @@ -41,6 +37,8 @@ class DartUri {
factory DartUri(String uri, [String serverUri]) {
var serverPath = globalLoadStrategy.serverPathForAppUri(uri);
if (serverPath != null) return DartUri._(serverPath);
// TODO(annagrin): Support creating DartUris from `dart:` uris.
// Issue: https://github.com/dart-lang/webdev/issues/1584
if (uri.startsWith('package:')) {
return DartUri._fromPackageUri(uri, serverUri: serverUri);
}
Expand Down Expand Up @@ -98,9 +96,6 @@ class DartUri {
/// The way we resolve file: URLs into package: URLs
static PackageConfig _packageConfig;

/// The way we resolve dart: URLs into org-dartland-sdk: URLs
static TargetLibrariesSpecification _librariesSpec;

/// SDK installation directory.
///
/// Directory where the SDK client code built with is installed,
Expand Down Expand Up @@ -166,16 +161,12 @@ class DartUri {
if (_sdkConfiguration.sdkDirectory != null) {
_sdkConfiguration.validateSdkDir();
}
if (_sdkConfiguration.librariesUri != null) {
await _loadLibrariesConfig(_sdkConfiguration.librariesUri);
}

await _loadPackageConfig(packagesUri);
}

/// Clear the uri resolution tables.
static void clear() {
_librariesSpec = null;
_packageConfig = null;
_resolvedUriToUri.clear();
_uriToResolvedUri.clear();
Expand All @@ -199,20 +190,6 @@ class DartUri {
});
}

/// Load and parse libraries.json spec file.
/// Used for resolving `dart:` libraries uris.
static Future<void> _loadLibrariesConfig(Uri uri) async {
try {
var spec = await LibrariesSpecification.load(
uri, (uri) => File.fromUri(uri).readAsString());
_librariesSpec = spec.specificationFor('dartdevc');
} on LibrariesSpecificationException catch (e) {
_logger.warning('Cannot parse libraries spec: $uri', e);
} on FileSystemException catch (e) {
_logger.warning('Cannot read libraries spec: $uri', e);
}
}

/// Record the library represented by package: or org-dartlang-app: uris
/// indexed by absolute file: URI.
static void _recordAbsoluteUri(String libraryUri) {
Expand All @@ -225,12 +202,9 @@ class DartUri {
String libraryPath;
switch (uri.scheme) {
case 'dart':
var libSpec = _librariesSpec?.libraryInfoFor(uri.path);
libraryPath = libSpec?.uri?.path;
var sdkDir = _sdkConfiguration.sdkDirectoryUri;
libraryPath =
libraryPath?.replaceAll(sdkDir.path, 'org-dartlang-sdk:///sdk');
break;
// TODO(annagrin): Support resolving `dart:` uris.
// Issue: https://github.com/dart-lang/webdev/issues/1584
return;
case 'org-dartlang-app':
case 'google3':
// Both currentDirectoryUri and the libraryUri path should have '/'
Expand All @@ -249,7 +223,7 @@ class DartUri {
_uriToResolvedUri[libraryUri] = libraryPath;
_resolvedUriToUri[libraryPath] = libraryUri;
} else {
_logger.warning('Unresolved uri: $uri');
_logger.fine('Unresolved uri: $uri');
}
}
}
1 change: 0 additions & 1 deletion dwds/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ environment:
sdk: ">=2.16.0 <3.0.0"

dependencies:
_fe_analyzer_shared: ^38.0.0
async: ^2.3.0
built_collection: ^5.0.0
built_value: '>=6.7.0 <9.0.0'
Expand Down
4 changes: 2 additions & 2 deletions dwds/test/chrome_proxy_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ void main() {
'org-dartlang-sdk:///sdk/lib/html/dart2js/html_dart2js.dart',
'org-dartlang-sdk:///sdk/lib/async/async.dart',
]);
});
}, skip: 'https://github.com/dart-lang/webdev/issues/1584');

test('lookupPackageUris finds package and org-dartlang-app paths',
() async {
Expand Down Expand Up @@ -1404,7 +1404,7 @@ void main() {
'dart:html',
'dart:async',
]);
});
}, skip: 'https://github.com/dart-lang/webdev/issues/1584');

test('registerService', () async {
await expectLater(
Expand Down
20 changes: 6 additions & 14 deletions dwds/test/dart_uri_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ void main() {
test('can resolve uris', () {
var resolved = DartUri.toResolvedUri('dart:io');
expect(resolved, 'org-dartlang-sdk:///sdk/lib/io/io.dart');
});
}, skip: 'https://github.com/dart-lang/webdev/issues/1584');

test('can unresolve uris', () {
var unresolved =
DartUri.toPackageUri('org-dartlang-sdk:///sdk/lib/io/io.dart');
expect(unresolved, 'dart:io');
});
}, skip: 'https://github.com/dart-lang/webdev/issues/1584');
});

group('initialized with other SDK directory', () {
Expand Down Expand Up @@ -124,13 +124,13 @@ void main() {
test('can resolve uris', () {
var resolved = DartUri.toResolvedUri('dart:io');
expect(resolved, 'org-dartlang-sdk:///sdk/lib/io/io.dart');
});
}, skip: 'https://github.com/dart-lang/webdev/issues/1584');

test('can unresolve uris', () {
var unresolved =
DartUri.toPackageUri('org-dartlang-sdk:///sdk/lib/io/io.dart');
expect(unresolved, 'dart:io');
});
}, skip: 'https://github.com/dart-lang/webdev/issues/1584');
});

group('initialized with other SDK directory with no libraries spec', () {
Expand Down Expand Up @@ -161,14 +161,6 @@ void main() {
);
await DartUri.initialize(sdkConfiguration);
await DartUri.recordAbsoluteUris(['dart:io', 'dart:html']);

expect(
logs,
containsAll([
contains('[WARNING] DartUri: Cannot parse libraries spec:'),
contains('[WARNING] DartUri: Unresolved uri: dart:io'),
contains('[WARNING] DartUri: Unresolved uri: dart:html'),
]));
});

tearDownAll(() async {
Expand All @@ -179,13 +171,13 @@ void main() {
test('cannot resolve uris', () {
var resolved = DartUri.toResolvedUri('dart:io');
expect(resolved, null);
});
}, skip: 'https://github.com/dart-lang/webdev/issues/1584');

test('cannot unresolve uris', () {
var unresolved =
DartUri.toPackageUri('org-dartlang-sdk:///sdk/lib/io/io.dart');
expect(unresolved, null);
});
}, skip: 'https://github.com/dart-lang/webdev/issues/1584');
});
});
}
Expand Down