Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
LavrovArtem committed Aug 31, 2017
1 parent 060553b commit 0a4d37c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/client/sandbox/xhr.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as JSON from '../json';

const IS_OPENED_XHR = 'hammerhead|xhr|is-opened-xhr';
const REMOVE_SET_COOKIE_HH_HEADER = new RegExp(`${ reEscape(XHR_HEADERS.setCookie) }:[^\n]*\n`, 'gi');
const XHR_READY_STATES = ['UNSENT', 'OPENED', 'HEADERS_RECEIVED', 'LOADING', 'DONE'];

export default class XhrSandbox extends SandboxBase {
constructor (cookieSandbox) {
Expand Down Expand Up @@ -90,9 +91,9 @@ export default class XhrSandbox extends SandboxBase {
return xhr;
};

for (const prop of ['UNSENT', 'OPENED', 'HEADERS_RECEIVED', 'LOADING', 'DONE']) {
nativeMethods.objectDefineProperty.call(window.Object, xmlHttpRequestWrapper, prop, {
value: XMLHttpRequest[prop],
for (const readyState of XHR_READY_STATES) {
nativeMethods.objectDefineProperty.call(window.Object, xmlHttpRequestWrapper, readyState, {
value: XMLHttpRequest[readyState],
enumerable: true
});
}
Expand Down

0 comments on commit 0a4d37c

Please sign in to comment.