Nicer message when attempting to use Observatory from dart_bootstrap, dart_precompiled_runtime or an unnamed badly configured build.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2793603002 .
This commit is contained in:
Ryan Macnak 2017-03-31 13:29:41 -07:00
parent a5a65d09a4
commit d0529c8638
2 changed files with 8 additions and 2 deletions

View file

@ -296,6 +296,12 @@ class Server {
return;
}
if (assets == null) {
request.response.headers.contentType = ContentType.TEXT;
request.response.write("This VM was built without the Observatory UI.");
request.response.close();
return;
}
Asset asset = assets[path];
if (asset != null) {
// Serving up a static asset (e.g. .css, .html, .png).

View file

@ -7,12 +7,12 @@ class Asset {
/// Call to request assets from the embedder.
@patch
static HashMap<String, Asset> request() {
HashMap<String, Asset> assets = new HashMap<String, Asset>();
Uint8List tarBytes = _requestAssets();
if (tarBytes == null) {
return assets;
return null;
}
List assetList = _decodeAssets(tarBytes);
HashMap<String, Asset> assets = new HashMap<String, Asset>();
for (int i = 0; i < assetList.length; i += 2) {
var a = new Asset(assetList[i], assetList[i + 1]);
assets[a.name] = a;