Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1627)

Unified Diff: sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart

Issue 221173007: Properly handle web socket requests to half-initialized servers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart
diff --git a/sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart b/sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart
index 461e364393053339c863fa57ef8ace6148b935e2..b0eaf12ad141aff4ae57fb55b7988e500319688a 100644
--- a/sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart
+++ b/sdk/lib/_internal/pub/lib/src/barback/old_web_socket_api.dart
@@ -269,25 +269,26 @@ class OldWebSocketApi {
/// If the asset is not in a directory being served by pub, returns an error:
///
/// example/index.html -> NOT_SERVED error
- Map _pathToUrls(Map command) {
+ Future<Map> _pathToUrls(Map command) {
var assetPath = _validateString(command, "path");
var line = _validateOptionalInt(command, "line");
- var urls = _environment.getUrlsForAssetPath(assetPath);
- if (urls.isEmpty) {
- throw new _WebSocketException(_ErrorCode.NOT_SERVED,
- 'Asset path "$assetPath" is not currently being served.');
- }
+ return _environment.getUrlsForAssetPath(assetPath).then((urls) {
+ if (urls.isEmpty) {
+ throw new _WebSocketException(_ErrorCode.NOT_SERVED,
+ 'Asset path "$assetPath" is not currently being served.');
+ }
- var result = {"urls": urls.map((url) => url.toString()).toList()};
+ var result = {"urls": urls.map((url) => url.toString()).toList()};
- // Map the line.
- // TODO(rnystrom): Right now, source maps are not supported and it just
- // passes through the original line. This lets the editor start using
- // this API before we've fully implemented it. See #12339 and #16061.
- if (line != null) result["line"] = line;
+ // Map the line.
+ // TODO(rnystrom): Right now, source maps are not supported and it just
+ // passes through the original line. This lets the editor start using
+ // this API before we've fully implemented it. See #12339 and #16061.
+ if (line != null) result["line"] = line;
- return result;
+ return result;
+ });
}
/// Given a relative directory path within the entrypoint package, binds a

Powered by Google App Engine
This is Rietveld 408576698