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
8 changes: 6 additions & 2 deletions webdev/lib/src/daemon/app_domain.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import 'utilites.dart';
class AppDomain extends Domain {
String _appId;
AppDebugServices _appDebugServices;

DebugService get _debugService => _appDebugServices?.debugService;

VmService get _vmService => _appDebugServices?.webdevClient?.client;
StreamSubscription<BuildResult> _resultSub;
StreamSubscription<Event> _stdOutSub;
Expand Down Expand Up @@ -144,8 +146,10 @@ class AppDomain extends Domain {
if (_appId != appId) throw ArgumentError.value(appId, 'appId', 'Not found');
var fullRestart = getBoolArg(args, 'fullRestart') ?? false;
if (!fullRestart) {
throw ArgumentError.value(
fullRestart, 'fullRestart', 'We do not support hot reload yet.');
return {
'code': 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code -32601 is standardized in the JSON RPC spec to mean "Method not found". Should we use that here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method is found just not implemented so I don't think that makes sense here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://www.jsonrpc.org/specification#error_object

The meaning is "The method does not exist / is not available." - IMO "not available" applies here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh. Makes more sense to me then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not spec'd in the daemon protocol what non-zero codes look like. Clients are written to use 0 to mean success, and non-zero failure. The only other daemon protocol impl (in flutter_tools) uses 1 for a restart failed code.

'message': 'hot reload not yet supported by package:flutter_web',
};
}
// TODO(grouma) - Support pauseAfterRestart.
// var pauseAfterRestart = getBoolArg(args, 'pause') ?? false;
Expand Down
17 changes: 16 additions & 1 deletion webdev/test/daemon/app_domain_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.

@Timeout(Duration(minutes: 2))

import 'dart:async';
import 'dart:convert';

Expand Down Expand Up @@ -92,6 +91,22 @@ void main() {
await exitWebdev(webdev);
});

test('.reload', () async {
var webdev =
await runWebDev(['daemon'], workingDirectory: exampleDirectory);
var appId = await _getAppId(webdev);
var extensionCall = '[{"method":"app.restart","id":0,'
'"params" : { "appId" : "$appId", "fullRestart" : false}}]';
webdev.stdin.add(utf8.encode('$extensionCall\n'));
await expectLater(
webdev.stdout,
emitsThrough(startsWith(
'[{"id":0,"result":{"code":1,"message":"hot reload not yet supported',
)),
);
await exitWebdev(webdev);
});

test('.restart', () async {
var webdev =
await runWebDev(['daemon'], workingDirectory: exampleDirectory);
Expand Down