mirror of https://github.com/nextcloud/contacts
Adding ownCloud request token to xhr
This commit is contained in:
parent
f55d2b5f7b
commit
4840e5d9ee
573
js/dav/dav.js
573
js/dav/dav.js
|
@ -938,7 +938,7 @@ exports.createAccount = _co2['default'].wrap(regeneratorRuntime.mark(function ca
|
|||
}));
|
||||
|
||||
// http redirect.
|
||||
},{"./calendars":2,"./contacts":5,"./debug":6,"./fuzzy_url_equals":7,"./model":9,"./namespace":10,"./request":12,"co":26,"url":31}],2:[function(require,module,exports){
|
||||
},{"./calendars":2,"./contacts":5,"./debug":6,"./fuzzy_url_equals":7,"./model":9,"./namespace":10,"./request":12,"co":31,"url":30}],2:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
|
@ -1329,7 +1329,7 @@ var webdavSync = _co2['default'].wrap(regeneratorRuntime.mark(function callee$0$
|
|||
}
|
||||
}, callee$0$0, this);
|
||||
}));
|
||||
},{"./debug":6,"./fuzzy_url_equals":7,"./model":9,"./namespace":10,"./request":12,"./webdav":24,"co":26,"url":31}],3:[function(require,module,exports){
|
||||
},{"./debug":6,"./fuzzy_url_equals":7,"./model":9,"./namespace":10,"./request":12,"./webdav":24,"co":31,"url":30}],3:[function(require,module,exports){
|
||||
/**
|
||||
* @fileoverview Camelcase something.
|
||||
*/
|
||||
|
@ -1545,7 +1545,7 @@ var Client = (function () {
|
|||
})();
|
||||
|
||||
exports.Client = Client;
|
||||
},{"./accounts":1,"./calendars":2,"./contacts":5,"url":31}],5:[function(require,module,exports){
|
||||
},{"./accounts":1,"./calendars":2,"./contacts":5,"url":30}],5:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
|
@ -1955,7 +1955,7 @@ var webdavSync = _co2['default'].wrap(regeneratorRuntime.mark(function callee$0$
|
|||
}
|
||||
}, callee$0$0, this);
|
||||
}));
|
||||
},{"./debug":6,"./fuzzy_url_equals":7,"./model":9,"./namespace":10,"./request":12,"./webdav":24,"co":26,"url":31}],6:[function(require,module,exports){
|
||||
},{"./debug":6,"./fuzzy_url_equals":7,"./model":9,"./namespace":10,"./request":12,"./webdav":24,"co":31,"url":30}],6:[function(require,module,exports){
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
|
@ -3105,30 +3105,31 @@ var Basic = (function (_Transport) {
|
|||
|
||||
result = undefined;
|
||||
context$3$0.prev = 9;
|
||||
context$3$0.next = 12;
|
||||
|
||||
xhr.setRequestHeader('requesttoken', oc_requesttoken);
|
||||
context$3$0.next = 13;
|
||||
return xhr.send(request.requestData);
|
||||
|
||||
case 12:
|
||||
case 13:
|
||||
result = transformResponse ? transformResponse(xhr) : xhr;
|
||||
context$3$0.next = 19;
|
||||
context$3$0.next = 20;
|
||||
break;
|
||||
|
||||
case 15:
|
||||
context$3$0.prev = 15;
|
||||
case 16:
|
||||
context$3$0.prev = 16;
|
||||
context$3$0.t0 = context$3$0['catch'](9);
|
||||
|
||||
if (onerror) onerror(context$3$0.t0);
|
||||
throw context$3$0.t0;
|
||||
|
||||
case 19:
|
||||
case 20:
|
||||
return context$3$0.abrupt('return', result);
|
||||
|
||||
case 20:
|
||||
case 21:
|
||||
case 'end':
|
||||
return context$3$0.stop();
|
||||
}
|
||||
}, callee$2$0, this, [[9, 15]]);
|
||||
}, callee$2$0, this, [[9, 16]]);
|
||||
}).bind(this));
|
||||
}
|
||||
}]);
|
||||
|
@ -3181,20 +3182,21 @@ var OAuth2 = (function (_Transport2) {
|
|||
xhr.open(request.method, url, true /* async */);
|
||||
xhr.setRequestHeader('Authorization', 'Bearer ' + token);
|
||||
if (transformRequest) transformRequest(xhr);
|
||||
context$3$0.next = 17;
|
||||
xhr.setRequestHeader('requesttoken', oc_requesttoken);
|
||||
context$3$0.next = 18;
|
||||
return xhr.send(request.requestData);
|
||||
|
||||
case 17:
|
||||
case 18:
|
||||
result = transformResponse ? transformResponse(xhr) : xhr;
|
||||
context$3$0.next = 28;
|
||||
context$3$0.next = 29;
|
||||
break;
|
||||
|
||||
case 20:
|
||||
context$3$0.prev = 20;
|
||||
case 21:
|
||||
context$3$0.prev = 21;
|
||||
context$3$0.t0 = context$3$0['catch'](6);
|
||||
|
||||
if (!(options.retry && xhr.status === 401)) {
|
||||
context$3$0.next = 26;
|
||||
context$3$0.next = 27;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3204,19 +3206,19 @@ var OAuth2 = (function (_Transport2) {
|
|||
options.retry = false;
|
||||
return context$3$0.abrupt('return', this.send(request, url, options));
|
||||
|
||||
case 26:
|
||||
case 27:
|
||||
|
||||
if (onerror) onerror(context$3$0.t0);
|
||||
throw context$3$0.t0;
|
||||
|
||||
case 28:
|
||||
case 29:
|
||||
return context$3$0.abrupt('return', result);
|
||||
|
||||
case 29:
|
||||
case 30:
|
||||
case 'end':
|
||||
return context$3$0.stop();
|
||||
}
|
||||
}, callee$2$0, this, [[6, 20]]);
|
||||
}, callee$2$0, this, [[6, 21]]);
|
||||
}).bind(this));
|
||||
}
|
||||
}]);
|
||||
|
@ -3316,7 +3318,7 @@ var refreshAccessToken = _co2['default'].wrap(regeneratorRuntime.mark(function c
|
|||
}
|
||||
}, callee$0$0, this);
|
||||
}));
|
||||
},{"./xmlhttprequest":25,"co":26,"querystring":30}],24:[function(require,module,exports){
|
||||
},{"./xmlhttprequest":25,"co":31,"querystring":29}],24:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
|
@ -3498,7 +3500,7 @@ var isCollectionDirty = _co2['default'].wrap(regeneratorRuntime.mark(function ca
|
|||
}, callee$0$0, this);
|
||||
}));
|
||||
exports.isCollectionDirty = isCollectionDirty;
|
||||
},{"./debug":6,"./fuzzy_url_equals":7,"./namespace":10,"./request":12,"co":26}],25:[function(require,module,exports){
|
||||
},{"./debug":6,"./fuzzy_url_equals":7,"./namespace":10,"./request":12,"co":31}],25:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
|
@ -3623,245 +3625,6 @@ var XMLHttpRequest = (function () {
|
|||
exports['default'] = XMLHttpRequest;
|
||||
module.exports = exports['default'];
|
||||
},{"./debug":6}],26:[function(require,module,exports){
|
||||
|
||||
/**
|
||||
* slice() reference.
|
||||
*/
|
||||
|
||||
var slice = Array.prototype.slice;
|
||||
|
||||
/**
|
||||
* Expose `co`.
|
||||
*/
|
||||
|
||||
module.exports = co['default'] = co.co = co;
|
||||
|
||||
/**
|
||||
* Wrap the given generator `fn` into a
|
||||
* function that returns a promise.
|
||||
* This is a separate function so that
|
||||
* every `co()` call doesn't create a new,
|
||||
* unnecessary closure.
|
||||
*
|
||||
* @param {GeneratorFunction} fn
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
co.wrap = function (fn) {
|
||||
createPromise.__generatorFunction__ = fn;
|
||||
return createPromise;
|
||||
function createPromise() {
|
||||
return co.call(this, fn.apply(this, arguments));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute the generator function or a generator
|
||||
* and return a promise.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Promise}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function co(gen) {
|
||||
var ctx = this;
|
||||
var args = slice.call(arguments, 1)
|
||||
|
||||
// we wrap everything in a promise to avoid promise chaining,
|
||||
// which leads to memory leak errors.
|
||||
// see https://github.com/tj/co/issues/180
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (typeof gen === 'function') gen = gen.apply(ctx, args);
|
||||
if (!gen || typeof gen.next !== 'function') return resolve(gen);
|
||||
|
||||
onFulfilled();
|
||||
|
||||
/**
|
||||
* @param {Mixed} res
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function onFulfilled(res) {
|
||||
var ret;
|
||||
try {
|
||||
ret = gen.next(res);
|
||||
} catch (e) {
|
||||
return reject(e);
|
||||
}
|
||||
next(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Error} err
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function onRejected(err) {
|
||||
var ret;
|
||||
try {
|
||||
ret = gen.throw(err);
|
||||
} catch (e) {
|
||||
return reject(e);
|
||||
}
|
||||
next(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next value in the generator,
|
||||
* return a promise.
|
||||
*
|
||||
* @param {Object} ret
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function next(ret) {
|
||||
if (ret.done) return resolve(ret.value);
|
||||
var value = toPromise.call(ctx, ret.value);
|
||||
if (value && isPromise(value)) return value.then(onFulfilled, onRejected);
|
||||
return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, '
|
||||
+ 'but the following object was passed: "' + String(ret.value) + '"'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a `yield`ed value into a promise.
|
||||
*
|
||||
* @param {Mixed} obj
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function toPromise(obj) {
|
||||
if (!obj) return obj;
|
||||
if (isPromise(obj)) return obj;
|
||||
if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj);
|
||||
if ('function' == typeof obj) return thunkToPromise.call(this, obj);
|
||||
if (Array.isArray(obj)) return arrayToPromise.call(this, obj);
|
||||
if (isObject(obj)) return objectToPromise.call(this, obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a thunk to a promise.
|
||||
*
|
||||
* @param {Function}
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function thunkToPromise(fn) {
|
||||
var ctx = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
fn.call(ctx, function (err, res) {
|
||||
if (err) return reject(err);
|
||||
if (arguments.length > 2) res = slice.call(arguments, 1);
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an array of "yieldables" to a promise.
|
||||
* Uses `Promise.all()` internally.
|
||||
*
|
||||
* @param {Array} obj
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function arrayToPromise(obj) {
|
||||
return Promise.all(obj.map(toPromise, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an object of "yieldables" to a promise.
|
||||
* Uses `Promise.all()` internally.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function objectToPromise(obj){
|
||||
var results = new obj.constructor();
|
||||
var keys = Object.keys(obj);
|
||||
var promises = [];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var promise = toPromise.call(this, obj[key]);
|
||||
if (promise && isPromise(promise)) defer(promise, key);
|
||||
else results[key] = obj[key];
|
||||
}
|
||||
return Promise.all(promises).then(function () {
|
||||
return results;
|
||||
});
|
||||
|
||||
function defer(promise, key) {
|
||||
// predefine the key in the result
|
||||
results[key] = undefined;
|
||||
promises.push(promise.then(function (res) {
|
||||
results[key] = res;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `obj` is a promise.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function isPromise(obj) {
|
||||
return 'function' == typeof obj.then;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `obj` is a generator.
|
||||
*
|
||||
* @param {Mixed} obj
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function isGenerator(obj) {
|
||||
return 'function' == typeof obj.next && 'function' == typeof obj.throw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `obj` is a generator function.
|
||||
*
|
||||
* @param {Mixed} obj
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
function isGeneratorFunction(obj) {
|
||||
var constructor = obj.constructor;
|
||||
if (!constructor) return false;
|
||||
if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true;
|
||||
return isGenerator(constructor.prototype);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for plain object.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function isObject(val) {
|
||||
return Object == val.constructor;
|
||||
}
|
||||
|
||||
},{}],27:[function(require,module,exports){
|
||||
(function (global){
|
||||
/*! https://mths.be/punycode v1.4.0 by @mathias */
|
||||
;(function(root) {
|
||||
|
@ -4398,7 +4161,7 @@ function isObject(val) {
|
|||
}(this));
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{}],28:[function(require,module,exports){
|
||||
},{}],27:[function(require,module,exports){
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -4484,7 +4247,7 @@ var isArray = Array.isArray || function (xs) {
|
|||
return Object.prototype.toString.call(xs) === '[object Array]';
|
||||
};
|
||||
|
||||
},{}],29:[function(require,module,exports){
|
||||
},{}],28:[function(require,module,exports){
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -4571,13 +4334,13 @@ var objectKeys = Object.keys || function (obj) {
|
|||
return res;
|
||||
};
|
||||
|
||||
},{}],30:[function(require,module,exports){
|
||||
},{}],29:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
exports.decode = exports.parse = require('./decode');
|
||||
exports.encode = exports.stringify = require('./encode');
|
||||
|
||||
},{"./decode":28,"./encode":29}],31:[function(require,module,exports){
|
||||
},{"./decode":27,"./encode":28}],30:[function(require,module,exports){
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
|
@ -5286,7 +5049,246 @@ function isNullOrUndefined(arg) {
|
|||
return arg == null;
|
||||
}
|
||||
|
||||
},{"punycode":27,"querystring":30}],32:[function(require,module,exports){
|
||||
},{"punycode":26,"querystring":29}],31:[function(require,module,exports){
|
||||
|
||||
/**
|
||||
* slice() reference.
|
||||
*/
|
||||
|
||||
var slice = Array.prototype.slice;
|
||||
|
||||
/**
|
||||
* Expose `co`.
|
||||
*/
|
||||
|
||||
module.exports = co['default'] = co.co = co;
|
||||
|
||||
/**
|
||||
* Wrap the given generator `fn` into a
|
||||
* function that returns a promise.
|
||||
* This is a separate function so that
|
||||
* every `co()` call doesn't create a new,
|
||||
* unnecessary closure.
|
||||
*
|
||||
* @param {GeneratorFunction} fn
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
co.wrap = function (fn) {
|
||||
createPromise.__generatorFunction__ = fn;
|
||||
return createPromise;
|
||||
function createPromise() {
|
||||
return co.call(this, fn.apply(this, arguments));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute the generator function or a generator
|
||||
* and return a promise.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Promise}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function co(gen) {
|
||||
var ctx = this;
|
||||
var args = slice.call(arguments, 1)
|
||||
|
||||
// we wrap everything in a promise to avoid promise chaining,
|
||||
// which leads to memory leak errors.
|
||||
// see https://github.com/tj/co/issues/180
|
||||
return new Promise(function(resolve, reject) {
|
||||
if (typeof gen === 'function') gen = gen.apply(ctx, args);
|
||||
if (!gen || typeof gen.next !== 'function') return resolve(gen);
|
||||
|
||||
onFulfilled();
|
||||
|
||||
/**
|
||||
* @param {Mixed} res
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function onFulfilled(res) {
|
||||
var ret;
|
||||
try {
|
||||
ret = gen.next(res);
|
||||
} catch (e) {
|
||||
return reject(e);
|
||||
}
|
||||
next(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Error} err
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function onRejected(err) {
|
||||
var ret;
|
||||
try {
|
||||
ret = gen.throw(err);
|
||||
} catch (e) {
|
||||
return reject(e);
|
||||
}
|
||||
next(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next value in the generator,
|
||||
* return a promise.
|
||||
*
|
||||
* @param {Object} ret
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function next(ret) {
|
||||
if (ret.done) return resolve(ret.value);
|
||||
var value = toPromise.call(ctx, ret.value);
|
||||
if (value && isPromise(value)) return value.then(onFulfilled, onRejected);
|
||||
return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, '
|
||||
+ 'but the following object was passed: "' + String(ret.value) + '"'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a `yield`ed value into a promise.
|
||||
*
|
||||
* @param {Mixed} obj
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function toPromise(obj) {
|
||||
if (!obj) return obj;
|
||||
if (isPromise(obj)) return obj;
|
||||
if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj);
|
||||
if ('function' == typeof obj) return thunkToPromise.call(this, obj);
|
||||
if (Array.isArray(obj)) return arrayToPromise.call(this, obj);
|
||||
if (isObject(obj)) return objectToPromise.call(this, obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a thunk to a promise.
|
||||
*
|
||||
* @param {Function}
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function thunkToPromise(fn) {
|
||||
var ctx = this;
|
||||
return new Promise(function (resolve, reject) {
|
||||
fn.call(ctx, function (err, res) {
|
||||
if (err) return reject(err);
|
||||
if (arguments.length > 2) res = slice.call(arguments, 1);
|
||||
resolve(res);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an array of "yieldables" to a promise.
|
||||
* Uses `Promise.all()` internally.
|
||||
*
|
||||
* @param {Array} obj
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function arrayToPromise(obj) {
|
||||
return Promise.all(obj.map(toPromise, this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an object of "yieldables" to a promise.
|
||||
* Uses `Promise.all()` internally.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Promise}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function objectToPromise(obj){
|
||||
var results = new obj.constructor();
|
||||
var keys = Object.keys(obj);
|
||||
var promises = [];
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
var promise = toPromise.call(this, obj[key]);
|
||||
if (promise && isPromise(promise)) defer(promise, key);
|
||||
else results[key] = obj[key];
|
||||
}
|
||||
return Promise.all(promises).then(function () {
|
||||
return results;
|
||||
});
|
||||
|
||||
function defer(promise, key) {
|
||||
// predefine the key in the result
|
||||
results[key] = undefined;
|
||||
promises.push(promise.then(function (res) {
|
||||
results[key] = res;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `obj` is a promise.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function isPromise(obj) {
|
||||
return 'function' == typeof obj.then;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `obj` is a generator.
|
||||
*
|
||||
* @param {Mixed} obj
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function isGenerator(obj) {
|
||||
return 'function' == typeof obj.next && 'function' == typeof obj.throw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if `obj` is a generator function.
|
||||
*
|
||||
* @param {Mixed} obj
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
function isGeneratorFunction(obj) {
|
||||
var constructor = obj.constructor;
|
||||
if (!constructor) return false;
|
||||
if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true;
|
||||
return isGenerator(constructor.prototype);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for plain object.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function isObject(val) {
|
||||
return Object == val.constructor;
|
||||
}
|
||||
|
||||
},{}],32:[function(require,module,exports){
|
||||
function DOMParser(options){
|
||||
this.options = options ||{locator:{}};
|
||||
|
||||
|
@ -5330,27 +5332,20 @@ function buildErrorHandler(errorImpl,domBuilder,locator){
|
|||
locator = locator||{}
|
||||
function build(key){
|
||||
var fn = errorImpl[key];
|
||||
if(!fn){
|
||||
if(isCallback){
|
||||
fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl;
|
||||
}else{
|
||||
var i=arguments.length;
|
||||
while(--i){
|
||||
if(fn = errorImpl[arguments[i]]){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!fn && isCallback){
|
||||
fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl;
|
||||
}
|
||||
errorHandler[key] = fn && function(msg){
|
||||
fn(msg+_locator(locator));
|
||||
fn('[xmldom '+key+']\t'+msg+_locator(locator));
|
||||
}||function(){};
|
||||
}
|
||||
build('warning','warn');
|
||||
build('error','warn','warning');
|
||||
build('fatalError','warn','warning','error');
|
||||
build('warning');
|
||||
build('error');
|
||||
build('fatalError');
|
||||
return errorHandler;
|
||||
}
|
||||
|
||||
//console.log('#\n\n\n\n\n\n\n####')
|
||||
/**
|
||||
* +ContentHandler+ErrorHandler
|
||||
* +LexicalHandler+EntityResolver2
|
||||
|
@ -5467,13 +5462,13 @@ DOMHandler.prototype = {
|
|||
* @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html
|
||||
*/
|
||||
warning:function(error) {
|
||||
console.warn(error,_locator(this.locator));
|
||||
console.warn('[xmldom warning]\t'+error,_locator(this.locator));
|
||||
},
|
||||
error:function(error) {
|
||||
console.error(error,_locator(this.locator));
|
||||
console.error('[xmldom error]\t'+error,_locator(this.locator));
|
||||
},
|
||||
fatalError:function(error) {
|
||||
console.error(error,_locator(this.locator));
|
||||
console.error('[xmldom fatalError]\t'+error,_locator(this.locator));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
@ -5656,6 +5651,12 @@ NodeList.prototype = {
|
|||
*/
|
||||
item: function(index) {
|
||||
return this[index] || null;
|
||||
},
|
||||
toString:function(){
|
||||
for(var buf = [], i = 0;i<this.length;i++){
|
||||
serializeToString(this[i],buf);
|
||||
}
|
||||
return buf.join('');
|
||||
}
|
||||
};
|
||||
function LiveNodeList(node,refresh){
|
||||
|
|
|
@ -53,6 +53,7 @@ export class Basic extends Transport {
|
|||
|
||||
let result;
|
||||
try {
|
||||
xhr.setRequestHeader('requesttoken', oc_requesttoken);
|
||||
yield xhr.send(request.requestData);
|
||||
result = transformResponse ? transformResponse(xhr) : xhr;
|
||||
} catch (error) {
|
||||
|
@ -90,6 +91,7 @@ export class OAuth2 extends Transport {
|
|||
xhr.open(request.method, url, true /* async */);
|
||||
xhr.setRequestHeader('Authorization', `Bearer ${token}`);
|
||||
if (transformRequest) transformRequest(xhr);
|
||||
xhr.setRequestHeader('requesttoken', oc_requesttoken);
|
||||
yield xhr.send(request.requestData);
|
||||
result = transformResponse ? transformResponse(xhr) : xhr;
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in New Issue