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

Side by Side Diff: remoting/webapp/crd/js/xhr.js

Issue 803653004: Update Chromoting to use /third_party/closure_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused types Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * Simple utilities for making XHRs more pleasant. 7 * Simple utilities for making XHRs more pleasant.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 if (opt_withCredentials) { 183 if (opt_withCredentials) {
184 xhr.withCredentials = true; 184 xhr.withCredentials = true;
185 } 185 }
186 186
187 xhr.send(useBody ? parameterString : null); 187 xhr.send(useBody ? parameterString : null);
188 return xhr; 188 return xhr;
189 }; 189 };
190 190
191 /** Generic success/failure response proxy. 191 /**
192 * Generic success/failure response proxy.
192 * 193 *
193 * @param {function():void} onDone 194 * @param {function():void} onDone
194 * @param {function(remoting.Error):void} onError 195 * @param {function(remoting.Error):void} onError
195 * @return {function(XMLHttpRequest):void} 196 * @return {function(XMLHttpRequest):void}
196 */ 197 */
197 remoting.xhr.defaultResponse = function(onDone, onError) { 198 remoting.xhr.defaultResponse = function(onDone, onError) {
198 /** @param {XMLHttpRequest} xhr */ 199 /** @param {XMLHttpRequest} xhr */
199 return function(xhr) { 200 var result = function(xhr) {
200 /** @type {remoting.Error} */ 201 /** @type {remoting.Error} */
201 var error = remoting.Error.fromHttpError(xhr.status) 202 var error = remoting.Error.fromHttpError(/** @type {number} */ (xhr.status))
202 if (error == remoting.Error.NONE) { 203 if (error == remoting.Error.NONE) {
203 onDone(); 204 onDone();
204 } else { 205 } else {
205 onError(error); 206 onError(error);
206 } 207 }
207 }; 208 };
209 return result;
208 }; 210 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698