Skip to content
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
2 changes: 1 addition & 1 deletion dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 26.2.4-wip

- Remove `package:built_value` dependency from `ConnectRequest`, `RunRequest`, `HotReloadRequest`, `HotReloadResponse`, `HotRestartRequest`, `HotRestartResponse`, `ServiceExtensionRequest`, and `ServiceExtensionResponse`; switch to standard Dart JSON serialization.
- Remove `package:built_value` dependency from `ConnectRequest`, `RunRequest`, `DebugInfo`, `HotReloadRequest`, `HotReloadResponse`, `HotRestartRequest`, `HotRestartResponse`, `ServiceExtensionRequest`, and `ServiceExtensionResponse`; switch to standard Dart JSON serialization.

## 26.2.3

Expand Down
26 changes: 13 additions & 13 deletions dwds/debug_extension/web/background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,19 @@ bool _isInternalNavigation(NavigationInfo navigationInfo) {

DebugInfo _addTabInfo(DebugInfo debugInfo, {required Tab tab}) {
return DebugInfo(
(b) => b
..appEntrypointPath = debugInfo.appEntrypointPath
..appId = debugInfo.appId
..appInstanceId = debugInfo.appInstanceId
..appOrigin = debugInfo.appOrigin
..appUrl = debugInfo.appUrl
..authUrl = debugInfo.authUrl
..extensionUrl = debugInfo.extensionUrl
..isInternalBuild = debugInfo.isInternalBuild
..isFlutterApp = debugInfo.isFlutterApp
..workspaceName = debugInfo.workspaceName
..tabUrl = tab.url
..tabId = tab.id,
appEntrypointPath: debugInfo.appEntrypointPath,
appId: debugInfo.appId,
appInstanceId: debugInfo.appInstanceId,
appOrigin: debugInfo.appOrigin,
appUrl: debugInfo.appUrl,
authUrl: debugInfo.authUrl,
dwdsVersion: debugInfo.dwdsVersion,
extensionUrl: debugInfo.extensionUrl,
isInternalBuild: debugInfo.isInternalBuild,
isFlutterApp: debugInfo.isFlutterApp,
workspaceName: debugInfo.workspaceName,
tabUrl: tab.url,
tabId: tab.id,
);
}

Expand Down
2 changes: 0 additions & 2 deletions dwds/debug_extension/web/data_serializers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import 'package:built_collection/built_collection.dart';
import 'package:built_value/serializer.dart';
import 'package:dwds/data/debug_info.dart';
import 'package:dwds/data/devtools_request.dart';
import 'package:dwds/data/extension_request.dart';

Expand All @@ -16,7 +15,6 @@ part 'data_serializers.g.dart';
@SerializersFor([
BatchedEvents,
ConnectFailure,
DebugInfo,
DebugStateChange,
DevToolsOpener,
DevToolsUrl,
Expand Down
5 changes: 2 additions & 3 deletions dwds/debug_extension/web/data_serializers.g.dart

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

76 changes: 24 additions & 52 deletions dwds/debug_extension/web/data_types.g.dart

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

22 changes: 9 additions & 13 deletions dwds/debug_extension/web/debug_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'dart:html';
import 'dart:js';

import 'package:dwds/data/debug_info.dart';
import 'package:dwds/data/serializers.dart';
// TODO: https://github.com/dart-lang/webdev/issues/2508
// ignore: deprecated_member_use
import 'package:js/js.dart';
Expand All @@ -28,18 +27,15 @@ String _readDartDebugInfo() {
final windowContext = JsObject.fromBrowserObject(window);

return jsonEncode(
serializers.serialize(
DebugInfo(
(b) => b
..appEntrypointPath = windowContext['\$dartEntrypointPath'] as String?
..appId = windowContext['\$dartAppId'] as String?
..appInstanceId = windowContext['\$dartAppInstanceId'] as String?
..appOrigin = window.location.origin
..appUrl = window.location.href
..extensionUrl = windowContext['\$dartExtensionUri'] as String?
..isInternalBuild = windowContext['\$isInternalBuild'] as bool?
..isFlutterApp = windowContext['\$isFlutterApp'] as bool?,
),
DebugInfo(
appEntrypointPath: windowContext['\$dartEntrypointPath'] as String?,
appId: windowContext['\$dartAppId'] as String?,
appInstanceId: windowContext['\$dartAppInstanceId'] as String?,
appOrigin: window.location.origin,
appUrl: window.location.href,
extensionUrl: windowContext['\$dartExtensionUri'] as String?,
isInternalBuild: windowContext['\$isInternalBuild'] as bool?,
isFlutterApp: windowContext['\$isFlutterApp'] as bool?,
),
);
}
8 changes: 4 additions & 4 deletions dwds/debug_extension/web/detector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import 'package:dwds/data/debug_info.dart';
import 'package:js/js.dart';

import 'chrome_api.dart';
import 'data_serializers.dart';
import 'logger.dart';
import 'messaging.dart';

Expand Down Expand Up @@ -131,9 +130,10 @@ Future<void> _sendMessageToBackgroundScript({
}

void _sendAuthRequest(String debugInfoJson) {
final debugInfo =
serializers.deserialize(jsonDecode(debugInfoJson)) as DebugInfo?;
final appOrigin = debugInfo?.appOrigin;
final debugInfo = DebugInfo.fromJson(
jsonDecode(debugInfoJson) as Map<String, dynamic>,
);
final appOrigin = debugInfo.appOrigin;
if (appOrigin != null) {
window.postMessage('dart-auth-request', appOrigin);
}
Expand Down
8 changes: 8 additions & 0 deletions dwds/debug_extension/web/messaging.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'dart:convert';
// ignore: deprecated_member_use
import 'dart:js_util';

import 'package:dwds/data/debug_info.dart';
// TODO: https://github.com/dart-lang/webdev/issues/2508
// ignore: deprecated_member_use
import 'package:js/js.dart';
Expand Down Expand Up @@ -110,6 +111,13 @@ void interceptMessage<T>({
}
if (T == String) {
messageHandler(decodedMessage.body as T);
} else if (T == DebugInfo) {
messageHandler(
DebugInfo.fromJson(
jsonDecode(decodedMessage.body) as Map<String, dynamic>,
)
as T,
);
} else {
messageHandler(
serializers.deserialize(jsonDecode(decodedMessage.body)) as T,
Expand Down
Loading
Loading