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

Unified Diff: runtime/bin/vmservice/client/lib/service_html.dart

Issue 308673012: Redo LocationManager to use HTML5 History API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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: runtime/bin/vmservice/client/lib/service_html.dart
diff --git a/runtime/bin/vmservice/client/lib/service_html.dart b/runtime/bin/vmservice/client/lib/service_html.dart
index 1a892aa4d9b8860123f9d17c62223c7d57952a72..df4d74d4b893107b15d0083ce67eae78b2b62708 100644
--- a/runtime/bin/vmservice/client/lib/service_html.dart
+++ b/runtime/bin/vmservice/client/lib/service_html.dart
@@ -32,19 +32,28 @@ class HttpVM extends VM {
}
Future<String> getString(String id) {
+ // Ensure we don't request host//id.
+ if (host.endsWith('/') && id.startsWith('/')) {
+ id = id.substring(1);
+ }
Logger.root.info('Fetching $id from $host');
- return HttpRequest.getString(host + id).catchError((error) {
+ return HttpRequest.request(host + id,
+ requestHeaders: {
+ 'Observatory-Version': '1.0'
+ }).then((HttpRequest request) {
+ return request.responseText;
+ }).catchError((error) {
// If we get an error here, the network request has failed.
- Logger.root.severe('HttpRequest.getString failed.');
+ Logger.root.severe('HttpRequest.request failed.');
var request = error.target;
return JSON.encode({
'type': 'ServiceException',
'id': '',
- 'response': error.target.responseText,
+ 'response': request.responseText,
'kind': 'NetworkException',
- 'message': 'Could not connect to service. Check that you started the'
- ' VM with the following flags:\n --enable-vm-service'
- ' --pause-isolates-on-exit'
+ 'message': 'Could not connect to service (${request.statusText}). '
+ 'Check that you started the VM with the following flags: '
+ '--observe'
});
});
}
« no previous file with comments | « runtime/bin/vmservice/client/lib/elements.html ('k') | runtime/bin/vmservice/client/lib/src/app/application.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698