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

Unified Diff: remoting/webapp/crd/js/session_connector_impl.js

Issue 1003433002: Updated remoting.xhr API to use promises. Removed access to the native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@spy-promise
Patch Set: Created 5 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: remoting/webapp/crd/js/session_connector_impl.js
diff --git a/remoting/webapp/crd/js/session_connector_impl.js b/remoting/webapp/crd/js/session_connector_impl.js
index b415a47f8ba0ac9a662d2a59623d1e30f29bbc40..fad6ae97ad94dfb4a1c6b06b3cac1ee8eb9228ce 100644
--- a/remoting/webapp/crd/js/session_connector_impl.js
+++ b/remoting/webapp/crd/js/session_connector_impl.js
@@ -95,6 +95,9 @@ remoting.SessionConnectorImpl = function(clientContainer, onConnected, onError,
remoting.SessionConnectorImpl.prototype.resetConnection_ = function() {
this.removePlugin_();
+ // It's OK to initialize these member variables here because the
+ // constructor calls this method.
+
/** @private {remoting.Host} */
this.host_ = null;
@@ -110,9 +113,6 @@ remoting.SessionConnectorImpl.prototype.resetConnection_ = function() {
/** @private {remoting.DesktopConnectedView} */
this.connectedView_ = null;
- /** @private {XMLHttpRequest} */
- this.pendingXhr_ = null;
-
/** @private {remoting.CredentialsProvider} */
this.credentialsProvider_ = null;
@@ -344,13 +344,14 @@ remoting.SessionConnectorImpl.prototype.onPluginInitialized_ = function(
initialized) {
if (!initialized) {
console.error('ERROR: remoting plugin not loaded');
- this.pluginError_(remoting.Error.MISSING_PLUGIN);
+ this.pluginError_(new remoting.Error(remoting.Error.Tag.MISSING_PLUGIN));
return;
}
if (!this.plugin_.isSupportedVersion()) {
console.error('ERROR: bad plugin version');
- this.pluginError_(remoting.Error.BAD_PLUGIN_VERSION);
+ this.pluginError_(new remoting.Error(
+ remoting.Error.Tag.BAD_PLUGIN_VERSION));
return;
}
@@ -506,14 +507,15 @@ remoting.SessionConnectorImpl.prototype.onStateChange_ = function(event) {
// accepting it. Since there's no way of knowing exactly what went wrong,
// we rely on server-side logs in this case and report a generic error
// message.
- this.onError_(remoting.Error.UNEXPECTED);
+ this.onError_(remoting.Error.unexpected());
break;
case remoting.ClientSession.State.FAILED:
var error = this.clientSession_.getError();
- console.error('Client plugin reported connection failed: ' + error);
+ console.error('Client plugin reported connection failed: ' +
+ error.toString());
if (error == null) {
- error = remoting.Error.UNEXPECTED;
+ error = remoting.Error.unexpected();
}
this.onConnectionFailed_(error);
break;
@@ -522,7 +524,7 @@ remoting.SessionConnectorImpl.prototype.onStateChange_ = function(event) {
console.error('Unexpected client plugin state: ' + event.current);
// This should only happen if the web-app and client plugin get out of
// sync, and even then the version check should ensure compatibility.
- this.onError_(remoting.Error.MISSING_PLUGIN);
+ this.onError_(new remoting.Error(remoting.Error.Tag.MISSING_PLUGIN));
}
};

Powered by Google App Engine
This is Rietveld 408576698