From bd0e8acac5268a9bbaf81c5e227937c68bf76c05 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Thu, 23 Dec 2021 15:43:28 -0800 Subject: [PATCH 1/3] Add option to launch DevTools in the same Chrome window --- dwds/lib/dwds.dart | 5 +++++ dwds/lib/src/handlers/dev_handler.dart | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dwds/lib/dwds.dart b/dwds/lib/dwds.dart index 5454308c1..785db4a8a 100644 --- a/dwds/lib/dwds.dart +++ b/dwds/lib/dwds.dart @@ -110,8 +110,11 @@ class Dwds { bool useSseForInjectedClient, UrlEncoder urlEncoder, bool spawnDds, + // TODO(elliette): DevTools is inconsistently capitalized throughout this + // file. Change all occurances of devtools/Devtools to devTools/DevTools. bool enableDevtoolsLaunch, DevtoolsLauncher devtoolsLauncher, + bool launchDevToolsInNewWindow, Uri sdkDir, Uri librariesPath, bool emitDebugEvents, @@ -123,6 +126,7 @@ class Dwds { useSseForDebugBackend ??= true; useSseForInjectedClient ??= true; enableDevtoolsLaunch ??= true; + launchDevToolsInNewWindow ??= true; spawnDds ??= true; globalLoadStrategy = loadStrategy; emitDebugEvents ??= true; @@ -183,6 +187,7 @@ class Dwds { expressionCompiler, injected, spawnDds, + launchDevToolsInNewWindow, ); return Dwds._( diff --git a/dwds/lib/src/handlers/dev_handler.dart b/dwds/lib/src/handlers/dev_handler.dart index f4fad9957..8c4b0ccbf 100644 --- a/dwds/lib/src/handlers/dev_handler.dart +++ b/dwds/lib/src/handlers/dev_handler.dart @@ -63,6 +63,7 @@ class DevHandler { final bool _useSseForInjectedClient; final bool _serveDevTools; final bool _spawnDds; + final bool _launchDevToolsInNewWindow; final ExpressionCompiler _expressionCompiler; final DwdsInjector _injected; @@ -87,7 +88,8 @@ class DevHandler { this._serveDevTools, this._expressionCompiler, this._injected, - this._spawnDds) { + this._spawnDds, + this._launchDevToolsInNewWindow) { _subs.add(buildResults.listen(_emitBuildResults)); _listen(); if (_extensionBackend != null) { @@ -525,7 +527,7 @@ class DevHandler { if (!_serveDevTools) return; emitEvent(DwdsEvent.devtoolsLaunch()); await remoteDebugger.sendCommand('Target.createTarget', params: { - 'newWindow': true, + 'newWindow': _launchDevToolsInNewWindow, 'url': Uri( scheme: 'http', host: _devTools.hostname, From b75387a40a6a99224eaf310caf4f4068d1f41156 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Mon, 10 Jan 2022 10:39:07 -0800 Subject: [PATCH 2/3] Updated CHANGELOG --- dwds/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index 8941f9ea2..c64e9074d 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -7,6 +7,7 @@ - Show an alert in the Dart Debug Extension for a multi-app scenario. - Fix a bug where `dartEmitDebugEvents` was set as a `String` instead of `bool` in the injected client. + - Add option to launch Dart DevTools in the same window as the connected Dart app. **Breaking changes:** From aff15a435ee79749c7d93554603022082fd110d4 Mon Sep 17 00:00:00 2001 From: Elliott Brooks <21270878+elliette@users.noreply.github.com> Date: Tue, 11 Jan 2022 09:53:06 -0800 Subject: [PATCH 3/3] Move comment to breaking changes --- dwds/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index 42ec4112a..b4a35b692 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -11,7 +11,6 @@ - Remove dead code for reading `'dart.developer.registerExtension'` and `'dart.developer.postEvent'` events from the chrome console. These messages haven't been written to the console since dwds v11.1.0 and Dart SDK v2.14.0. - - Add an option to launch Dart DevTools in the same window as the connected Dart app. **Breaking changes:** @@ -20,6 +19,8 @@ - Add `emitDebugEvents` argument to `Dwds.start` to suppress emitting debug events from the injected client. - Replace `sdkRoot` parameter by `sdkDir` in `ExpressionCompilerService`. +- Adds an additional parameter to launch Dart DevTools in the same window as + the connected Dart app. ## 11.5.1