| OLD | NEW |
| 1 /* Copyright 2013 The Chromium Authors. All rights reserved. | 1 /* Copyright 2013 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 /** | 6 /** |
| 7 * @fileoverview | 7 * @fileoverview |
| 8 * The sandbox isn't allowed to make XHRs, so they have to be proxied to the | 8 * The sandbox isn't allowed to make XHRs, so they have to be proxied to the |
| 9 * main process. The XMLHttpRequestProxy class is API-compatible with the | 9 * main process. The XMLHttpRequestProxy class is API-compatible with the |
| 10 * XMLHttpRequest class, but forwards the requests to the main process where | 10 * XMLHttpRequest class, but forwards the requests to the main process where |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 'use strict'; | 21 'use strict'; |
| 22 | 22 |
| 23 /** @suppress {duplicate} */ | 23 /** @suppress {duplicate} */ |
| 24 var remoting = remoting || {}; | 24 var remoting = remoting || {}; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * @constructor | 27 * @constructor |
| 28 * @extends {XMLHttpRequest} | 28 * @extends {XMLHttpRequest} |
| 29 */ | 29 */ |
| 30 remoting.XMLHttpRequestProxy = function() { | 30 remoting.XMLHttpRequestProxy = function() { |
| 31 /** | 31 /** @type {{headers: Object}} */ |
| 32 * @type {{headers: Object}} | |
| 33 */ | |
| 34 this.sandbox_ipc = { | 32 this.sandbox_ipc = { |
| 35 headers: {} | 33 headers: {} |
| 36 }; | 34 }; |
| 37 /** | 35 /** @private {number} */ |
| 38 * @type {number} | |
| 39 * @private | |
| 40 */ | |
| 41 this.xhr_id_ = -1; | 36 this.xhr_id_ = -1; |
| 42 }; | 37 }; |
| 43 | 38 |
| 44 remoting.XMLHttpRequestProxy.prototype.open = function( | 39 remoting.XMLHttpRequestProxy.prototype.open = function( |
| 45 method, url, async, user, password) { | 40 method, url, async, user, password) { |
| 46 if (!async) { | 41 if (!async) { |
| 47 console.warn('Synchronous XHRs are not supported.'); | 42 console.warn('Synchronous XHRs are not supported.'); |
| 48 } | 43 } |
| 49 this.sandbox_ipc.method = method; | 44 this.sandbox_ipc.method = method; |
| 50 this.sandbox_ipc.url = url.toString(); | 45 this.sandbox_ipc.url = url.toString(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 80 | 75 |
| 81 remoting.XMLHttpRequestProxy.prototype.overrideMimeType = function() { | 76 remoting.XMLHttpRequestProxy.prototype.overrideMimeType = function() { |
| 82 console.error('Sandbox: unproxied overrideMimeType called.'); | 77 console.error('Sandbox: unproxied overrideMimeType called.'); |
| 83 }; | 78 }; |
| 84 | 79 |
| 85 remoting.XMLHttpRequestProxy.prototype.UNSENT = 0; | 80 remoting.XMLHttpRequestProxy.prototype.UNSENT = 0; |
| 86 remoting.XMLHttpRequestProxy.prototype.OPENED = 1; | 81 remoting.XMLHttpRequestProxy.prototype.OPENED = 1; |
| 87 remoting.XMLHttpRequestProxy.prototype.HEADERS_RECEIVED = 2; | 82 remoting.XMLHttpRequestProxy.prototype.HEADERS_RECEIVED = 2; |
| 88 remoting.XMLHttpRequestProxy.prototype.LOADING = 3; | 83 remoting.XMLHttpRequestProxy.prototype.LOADING = 3; |
| 89 remoting.XMLHttpRequestProxy.prototype.DONE = 4; | 84 remoting.XMLHttpRequestProxy.prototype.DONE = 4; |
| OLD | NEW |