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

Unified Diff: runtime/observatory/lib/src/app/location_manager.dart

Issue 1072423003: When attempting to navigate to a page for an isolate that doesn't exist, offer to (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/observatory/lib/src/app/location_manager.dart
diff --git a/runtime/observatory/lib/src/app/location_manager.dart b/runtime/observatory/lib/src/app/location_manager.dart
index 13f9091c228dfaed5eb205f20ffd3761d68f3d8b..05d807a6b73d19626e381ef7f8e6dfdace8c98dc 100644
--- a/runtime/observatory/lib/src/app/location_manager.dart
+++ b/runtime/observatory/lib/src/app/location_manager.dart
@@ -79,12 +79,25 @@ class LocationManager extends Observable {
/// Notify the current page that something has changed.
_visit() {
- _app._visit(_uri, internalArguments);
+ runZoned(() => _app._visit(_uri, internalArguments),
+ onError: (e, st) {
+ if (e is IsolateNotFound) {
+ var newPath = _app.vm == null ? '/vm-connect' : '/isolate-reconnect';
+ var parameters = {};
+ parameters.addAll(_uri.queryParameters);
+ parameters['originalPath'] = _uri.path;
+ parameters['originalIsolateId'] = parameters['isolateId'];
+ var generatedUri = new Uri(path: newPath, queryParameters: parameters);
+ go(makeLink(generatedUri.toString()), true);
+ return;
+ }
+ throw e;
+ });
}
/// Navigate to [url].
void go(String url, [bool addToBrowserHistory = true]) {
- if ((url != makeLink('/vm-connect/')) && _app.vm == null) {
+ if ((url != makeLink('/vm-connect')) && _app.vm == null) {
if (!window.confirm('Connection with VM has been lost. '
'Proceeding will lose current page.')) {
return;
@@ -101,7 +114,11 @@ class LocationManager extends Observable {
/// Starting with the current uri path and queryParameters, update
/// queryParameters present in [updateParameters], then generate a new uri
/// and navigate to that.
- goParameter(Map updatedParameters, [bool addToBrowserHistory = true]) {
+ goReplacingParameters(Map updatedParameters, [bool addToBrowserHistory = true]) {
+ go(makeLinkReplacingParameter(updatedParameters), addToBrowserHistory);
+ }
+
+ makeLinkReplacingParameters(Map updatedParameters) {
var parameters = new Map.from(_uri.queryParameters);
updatedParameters.forEach((k, v) {
parameters[k] = v;
@@ -109,7 +126,17 @@ class LocationManager extends Observable {
// Ensure path starts with a slash.
var path = uri.path.startsWith('/') ? uri.path : '/${uri.path}';
var generatedUri = new Uri(path: path, queryParameters: parameters);
- go(makeLink(generatedUri.toString()), addToBrowserHistory);
+ return makeLink(generatedUri.toString());
+ }
+
+ goForwardingParameters(String newPath, [bool addToBrowserHistory = true]) {
+ go(makeLinkForwardingParameters(newPath), addToBrowserHistory);
+ }
+
+ makeLinkForwardingParameters(String newPath) {
+ var parameters = _uri.queryParameters;
+ var generatedUri = new Uri(path: newPath, queryParameters: parameters);
+ return makeLink(generatedUri.toString());
}
/// Utility event handler when clicking on application url link.

Powered by Google App Engine
This is Rietveld 408576698