This isTestMode() method can get a whole lot simpler if you use a utility method from dart:html. `HttpRequest.getString(url)` returns a Future with the given url's contents; the Future completes with an error if the resource is not found. See the bottom of compiler.dart for an example. Something like:

return html.HttpRequest.getString(chrome_gen.runtime.getURL('app.json')).then((String contents) {
  // some processing

  return isTestMode;
}, catchError: (e) {
  return true;
});