Skip to content

Optimize url encoding, use default port for debugger service #1402

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
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
4 changes: 4 additions & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 11.3.1-dev

- Encode extension url asynchronously.
- Use default constant port for debug service.
- If we fail binding to the port, fall back to previous strategy
of finding unbound ports.
- Add metrics measuring DevTools Initial Page Load time.
- Add `ext.dwds.sendEvent` service extension to dwds so other tools
can send events to the debugger.
Expand Down
8 changes: 4 additions & 4 deletions dwds/lib/dwds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class Dwds {
globalLoadStrategy = loadStrategy;

DevTools devTools;
String extensionUri;
Future<String> extensionUri;
ExtensionBackend extensionBackend;
if (enableDebugExtension) {
final handler = useSseForDebugBackend
Expand All @@ -134,13 +134,13 @@ class Dwds {
: WebSocketSocketHandler();

extensionBackend = await ExtensionBackend.start(handler, hostname);
extensionUri = Uri(
extensionUri = Future.value(Uri(
scheme: useSseForDebugBackend ? 'http' : 'ws',
host: extensionBackend.hostname,
port: extensionBackend.port,
path: r'$debug')
.toString();
if (urlEncoder != null) extensionUri = await urlEncoder(extensionUri);
.toString());
if (urlEncoder != null) extensionUri = urlEncoder(await extensionUri);
}

var serveDevTools = devtoolsLauncher != null;
Expand Down
6 changes: 3 additions & 3 deletions dwds/lib/src/handlers/injector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ const _clientScript = 'dwds/src/injected/client';
/// information.
class DwdsInjector {
final LoadStrategy _loadStrategy;
final String _extensionUri;
final Future<String> _extensionUri;
final _devHandlerPaths = StreamController<String>();
final _logger = Logger('DwdsInjector');
final bool _enableDevtoolsLaunch;
final bool _useSseForInjectedClient;

DwdsInjector(
this._loadStrategy, {
String extensionUri,
Future<String> extensionUri,
bool enableDevtoolsLaunch,
bool useSseForInjectedClient,
}) : _extensionUri = extensionUri,
Expand Down Expand Up @@ -104,7 +104,7 @@ class DwdsInjector {
appId,
devHandlerPath,
entrypoint,
_extensionUri,
await _extensionUri,
_loadStrategy,
_enableDevtoolsLaunch,
);
Expand Down
Loading