Chromium Code Reviews| Index: remoting/webapp/crd/js/dns_blackhole_checker.js |
| diff --git a/remoting/webapp/crd/js/dns_blackhole_checker.js b/remoting/webapp/crd/js/dns_blackhole_checker.js |
| index 19178c153540290ecaa8b307d909d3c82f83841e..58415ecf3541c3391293cf375e2ef0434aef36fd 100644 |
| --- a/remoting/webapp/crd/js/dns_blackhole_checker.js |
| +++ b/remoting/webapp/crd/js/dns_blackhole_checker.js |
| @@ -38,7 +38,7 @@ remoting.DnsBlackholeChecker = function(signalStrategy) { |
| /** @private */ |
| this.blackholeState_ = BlackholeState.PENDING; |
| - /** @private {?XMLHttpRequest} */ |
| + /** @private {?remoting.Xhr} */ |
| this.xhr_ = null; |
| }; |
| @@ -85,11 +85,11 @@ remoting.DnsBlackholeChecker.prototype.connect = function(server, |
| this.signalStrategy_.connect(server, username, authToken); |
| - this.xhr_ = remoting.xhr.start({ |
| + this.xhr_ = new remoting.Xhr({ |
| method: 'GET', |
| - url: remoting.DnsBlackholeChecker.URL_TO_REQUEST_, |
| - onDone: this.onHttpRequestDone_.bind(this) |
| + url: remoting.DnsBlackholeChecker.URL_TO_REQUEST_ |
| }); |
| + this.xhr_.then(this.onHttpRequestDone_.bind(this)); |
| }; |
| remoting.DnsBlackholeChecker.prototype.getState = function() { |
| @@ -153,12 +153,12 @@ remoting.DnsBlackholeChecker.prototype.onWrappedSignalStrategyStateChanged_ = |
| }; |
| /** |
| - * @param {XMLHttpRequest} xhr |
| + * @param {remoting.Xhr.Response} xhrr |
|
Jamie
2015/03/12 20:15:43
This name looks like a typo. I think it should be
John Williams
2015/03/14 03:35:33
Done.
|
| * @private |
| */ |
| -remoting.DnsBlackholeChecker.prototype.onHttpRequestDone_ = function(xhr) { |
| +remoting.DnsBlackholeChecker.prototype.onHttpRequestDone_ = function(xhrr) { |
| this.xhr_ = null; |
| - if (xhr.status >= 200 && xhr.status <= 299) { |
| + if (xhrr.status >= 200 && xhrr.status <= 299) { |
| console.log("DNS blackhole check succeeded."); |
| this.blackholeState_ = BlackholeState.OPEN; |
| if (this.signalStrategy_.getState() == |
| @@ -166,14 +166,14 @@ remoting.DnsBlackholeChecker.prototype.onHttpRequestDone_ = function(xhr) { |
| this.setState_(remoting.SignalStrategy.State.CONNECTED); |
| } |
| } else { |
| - console.error("DNS blackhole check failed: " + xhr.status + " " + |
| - xhr.statusText + ". Response URL: " + xhr.responseURL + |
| - ". Response Text: " + xhr.responseText); |
| + console.error("DNS blackhole check failed: " + xhrr.status + " " + |
| + xhrr.statusText + ". Response URL: " + xhrr.responseUrl + |
| + ". Response Text: " + xhrr.responseText); |
| this.blackholeState_ = BlackholeState.BLOCKED; |
| base.dispose(this.signalStrategy_); |
| this.setState_(remoting.SignalStrategy.State.FAILED); |
| } |
| -} |
| +}; |
| /** |
| * @param {remoting.SignalStrategy.State} newState |