browsed 0.3.0 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -27
- data/browsed.gemspec +2 -3
- data/lib/browsed.rb +1 -1
- data/lib/browsed/chrome.rb +2 -2
- data/lib/browsed/client.rb +2 -2
- data/lib/browsed/firefox.rb +2 -2
- data/lib/browsed/version.rb +1 -1
- metadata +11 -164
- data/lib/browsed/proxies/proxy-chain-server/node_modules/.bin/portastic +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/LICENSE +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/README.md +0 -57
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/changelog.md +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.js +0 -3824
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.min.js +0 -31
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.js +0 -5666
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/any.js +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/assert.js +0 -55
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/async.js +0 -165
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bind.js +0 -67
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bluebird.js +0 -11
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/call_get.js +0 -123
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/cancel.js +0 -129
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/catch_filter.js +0 -42
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/context.js +0 -69
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/debuggability.js +0 -934
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/direct_resolve.js +0 -46
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/each.js +0 -30
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/errors.js +0 -116
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/es5.js +0 -80
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/filter.js +0 -12
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/finally.js +0 -146
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/generators.js +0 -223
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/join.js +0 -168
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/map.js +0 -168
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/method.js +0 -55
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeback.js +0 -51
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeify.js +0 -58
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise.js +0 -789
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise_array.js +0 -185
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promisify.js +0 -314
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/props.js +0 -118
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/queue.js +0 -73
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/race.js +0 -49
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/reduce.js +0 -172
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/schedule.js +0 -62
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/settle.js +0 -43
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/some.js +0 -148
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/synchronous_inspection.js +0 -103
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/thenables.js +0 -86
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/timers.js +0 -93
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/using.js +0 -226
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/util.js +0 -389
- data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/package.json +0 -102
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/CHANGELOG.md +0 -408
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/LICENSE +0 -22
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/Readme.md +0 -428
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/index.js +0 -1224
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/package.json +0 -70
- data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/typings/index.d.ts +0 -310
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.coveralls.yml +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.eslintrc +0 -11
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.npmignore +0 -9
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.travis.yml +0 -14
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/CHANGELOG.md +0 -362
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/LICENSE +0 -19
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/Makefile +0 -50
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/README.md +0 -312
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/component.json +0 -19
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/karma.conf.js +0 -70
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/node.js +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/package.json +0 -88
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/browser.js +0 -185
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/debug.js +0 -202
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/index.js +0 -10
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/inspector-log.js +0 -15
- data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/node.js +0 -248
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/index.js +0 -152
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/license.md +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/package.json +0 -69
- data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/readme.md +0 -51
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/LICENSE +0 -13
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/README.md +0 -148
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic +0 -65
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/history.md +0 -7
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/index.js +0 -4
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/monitor.js +0 -59
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/portastic.js +0 -167
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/LICENSE +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/README.md +0 -677
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/changelog.md +0 -1730
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.js +0 -4892
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/any.js +0 -21
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/assert.js +0 -55
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/async.js +0 -150
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bind.js +0 -72
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bluebird.js +0 -11
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/call_get.js +0 -123
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/cancel.js +0 -48
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/captured_trace.js +0 -493
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/catch_filter.js +0 -66
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js +0 -38
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/debuggability.js +0 -162
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/direct_resolve.js +0 -63
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/each.js +0 -12
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/errors.js +0 -111
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/es5.js +0 -80
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/filter.js +0 -12
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/finally.js +0 -98
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/generators.js +0 -136
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/join.js +0 -107
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/map.js +0 -133
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/method.js +0 -44
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/nodeify.js +0 -59
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/progress.js +0 -76
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise.js +0 -759
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_array.js +0 -142
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_resolver.js +0 -123
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promisify.js +0 -307
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/props.js +0 -79
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/queue.js +0 -90
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/race.js +0 -47
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/reduce.js +0 -148
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/schedule.js +0 -35
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/settle.js +0 -40
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/some.js +0 -125
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/synchronous_inspection.js +0 -94
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/thenables.js +0 -84
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/timers.js +0 -64
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/using.js +0 -213
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/util.js +0 -321
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/package.json +0 -103
- data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/package.json +0 -69
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/CHANGELOG.md +0 -109
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/LICENSE +0 -201
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/README.md +0 -278
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/anonymize_proxy.js +0 -100
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_base.js +0 -319
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_custom_response.js +0 -96
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_forward.js +0 -173
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_chain.js +0 -132
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_direct.js +0 -89
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_tcp_chain.js +0 -271
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/index.js +0 -26
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/run_locally.js +0 -66
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/server.js +0 -595
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tcp_tunnel.js +0 -138
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/testing_tcp_service.js +0 -37
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tools.js +0 -220
- data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/package.json +0 -104
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/LICENSE +0 -23
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/README.md +0 -28
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/package.json +0 -81
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js +0 -5
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js.map +0 -1
- data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore.js +0 -1692
- data/lib/browsed/proxies/proxy-chain-server/package-lock.json +0 -63
- data/lib/browsed/proxies/proxy-chain-server/package.json +0 -15
- data/lib/browsed/proxies/proxy-chain-server/server.js +0 -25
- data/lib/browsed/proxies/proxy_chain.rb +0 -46
@@ -1,80 +0,0 @@
|
|
1
|
-
var isES5 = (function(){
|
2
|
-
"use strict";
|
3
|
-
return this === undefined;
|
4
|
-
})();
|
5
|
-
|
6
|
-
if (isES5) {
|
7
|
-
module.exports = {
|
8
|
-
freeze: Object.freeze,
|
9
|
-
defineProperty: Object.defineProperty,
|
10
|
-
getDescriptor: Object.getOwnPropertyDescriptor,
|
11
|
-
keys: Object.keys,
|
12
|
-
names: Object.getOwnPropertyNames,
|
13
|
-
getPrototypeOf: Object.getPrototypeOf,
|
14
|
-
isArray: Array.isArray,
|
15
|
-
isES5: isES5,
|
16
|
-
propertyIsWritable: function(obj, prop) {
|
17
|
-
var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
18
|
-
return !!(!descriptor || descriptor.writable || descriptor.set);
|
19
|
-
}
|
20
|
-
};
|
21
|
-
} else {
|
22
|
-
var has = {}.hasOwnProperty;
|
23
|
-
var str = {}.toString;
|
24
|
-
var proto = {}.constructor.prototype;
|
25
|
-
|
26
|
-
var ObjectKeys = function (o) {
|
27
|
-
var ret = [];
|
28
|
-
for (var key in o) {
|
29
|
-
if (has.call(o, key)) {
|
30
|
-
ret.push(key);
|
31
|
-
}
|
32
|
-
}
|
33
|
-
return ret;
|
34
|
-
};
|
35
|
-
|
36
|
-
var ObjectGetDescriptor = function(o, key) {
|
37
|
-
return {value: o[key]};
|
38
|
-
};
|
39
|
-
|
40
|
-
var ObjectDefineProperty = function (o, key, desc) {
|
41
|
-
o[key] = desc.value;
|
42
|
-
return o;
|
43
|
-
};
|
44
|
-
|
45
|
-
var ObjectFreeze = function (obj) {
|
46
|
-
return obj;
|
47
|
-
};
|
48
|
-
|
49
|
-
var ObjectGetPrototypeOf = function (obj) {
|
50
|
-
try {
|
51
|
-
return Object(obj).constructor.prototype;
|
52
|
-
}
|
53
|
-
catch (e) {
|
54
|
-
return proto;
|
55
|
-
}
|
56
|
-
};
|
57
|
-
|
58
|
-
var ArrayIsArray = function (obj) {
|
59
|
-
try {
|
60
|
-
return str.call(obj) === "[object Array]";
|
61
|
-
}
|
62
|
-
catch(e) {
|
63
|
-
return false;
|
64
|
-
}
|
65
|
-
};
|
66
|
-
|
67
|
-
module.exports = {
|
68
|
-
isArray: ArrayIsArray,
|
69
|
-
keys: ObjectKeys,
|
70
|
-
names: ObjectKeys,
|
71
|
-
defineProperty: ObjectDefineProperty,
|
72
|
-
getDescriptor: ObjectGetDescriptor,
|
73
|
-
freeze: ObjectFreeze,
|
74
|
-
getPrototypeOf: ObjectGetPrototypeOf,
|
75
|
-
isES5: isES5,
|
76
|
-
propertyIsWritable: function() {
|
77
|
-
return true;
|
78
|
-
}
|
79
|
-
};
|
80
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
module.exports = function(Promise, INTERNAL) {
|
3
|
-
var PromiseMap = Promise.map;
|
4
|
-
|
5
|
-
Promise.prototype.filter = function (fn, options) {
|
6
|
-
return PromiseMap(this, fn, options, INTERNAL);
|
7
|
-
};
|
8
|
-
|
9
|
-
Promise.filter = function (promises, fn, options) {
|
10
|
-
return PromiseMap(promises, fn, options, INTERNAL);
|
11
|
-
};
|
12
|
-
};
|
@@ -1,98 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
module.exports = function(Promise, NEXT_FILTER, tryConvertToPromise) {
|
3
|
-
var util = require("./util.js");
|
4
|
-
var isPrimitive = util.isPrimitive;
|
5
|
-
var thrower = util.thrower;
|
6
|
-
|
7
|
-
function returnThis() {
|
8
|
-
return this;
|
9
|
-
}
|
10
|
-
function throwThis() {
|
11
|
-
throw this;
|
12
|
-
}
|
13
|
-
function return$(r) {
|
14
|
-
return function() {
|
15
|
-
return r;
|
16
|
-
};
|
17
|
-
}
|
18
|
-
function throw$(r) {
|
19
|
-
return function() {
|
20
|
-
throw r;
|
21
|
-
};
|
22
|
-
}
|
23
|
-
function promisedFinally(ret, reasonOrValue, isFulfilled) {
|
24
|
-
var then;
|
25
|
-
if (isPrimitive(reasonOrValue)) {
|
26
|
-
then = isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue);
|
27
|
-
} else {
|
28
|
-
then = isFulfilled ? returnThis : throwThis;
|
29
|
-
}
|
30
|
-
return ret._then(then, thrower, undefined, reasonOrValue, undefined);
|
31
|
-
}
|
32
|
-
|
33
|
-
function finallyHandler(reasonOrValue) {
|
34
|
-
var promise = this.promise;
|
35
|
-
var handler = this.handler;
|
36
|
-
|
37
|
-
var ret = promise._isBound()
|
38
|
-
? handler.call(promise._boundValue())
|
39
|
-
: handler();
|
40
|
-
|
41
|
-
if (ret !== undefined) {
|
42
|
-
var maybePromise = tryConvertToPromise(ret, promise);
|
43
|
-
if (maybePromise instanceof Promise) {
|
44
|
-
maybePromise = maybePromise._target();
|
45
|
-
return promisedFinally(maybePromise, reasonOrValue,
|
46
|
-
promise.isFulfilled());
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
if (promise.isRejected()) {
|
51
|
-
NEXT_FILTER.e = reasonOrValue;
|
52
|
-
return NEXT_FILTER;
|
53
|
-
} else {
|
54
|
-
return reasonOrValue;
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
function tapHandler(value) {
|
59
|
-
var promise = this.promise;
|
60
|
-
var handler = this.handler;
|
61
|
-
|
62
|
-
var ret = promise._isBound()
|
63
|
-
? handler.call(promise._boundValue(), value)
|
64
|
-
: handler(value);
|
65
|
-
|
66
|
-
if (ret !== undefined) {
|
67
|
-
var maybePromise = tryConvertToPromise(ret, promise);
|
68
|
-
if (maybePromise instanceof Promise) {
|
69
|
-
maybePromise = maybePromise._target();
|
70
|
-
return promisedFinally(maybePromise, value, true);
|
71
|
-
}
|
72
|
-
}
|
73
|
-
return value;
|
74
|
-
}
|
75
|
-
|
76
|
-
Promise.prototype._passThroughHandler = function (handler, isFinally) {
|
77
|
-
if (typeof handler !== "function") return this.then();
|
78
|
-
|
79
|
-
var promiseAndHandler = {
|
80
|
-
promise: this,
|
81
|
-
handler: handler
|
82
|
-
};
|
83
|
-
|
84
|
-
return this._then(
|
85
|
-
isFinally ? finallyHandler : tapHandler,
|
86
|
-
isFinally ? finallyHandler : undefined, undefined,
|
87
|
-
promiseAndHandler, undefined);
|
88
|
-
};
|
89
|
-
|
90
|
-
Promise.prototype.lastly =
|
91
|
-
Promise.prototype["finally"] = function (handler) {
|
92
|
-
return this._passThroughHandler(handler, true);
|
93
|
-
};
|
94
|
-
|
95
|
-
Promise.prototype.tap = function (handler) {
|
96
|
-
return this._passThroughHandler(handler, false);
|
97
|
-
};
|
98
|
-
};
|
@@ -1,136 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
module.exports = function(Promise,
|
3
|
-
apiRejection,
|
4
|
-
INTERNAL,
|
5
|
-
tryConvertToPromise) {
|
6
|
-
var errors = require("./errors.js");
|
7
|
-
var TypeError = errors.TypeError;
|
8
|
-
var util = require("./util.js");
|
9
|
-
var errorObj = util.errorObj;
|
10
|
-
var tryCatch = util.tryCatch;
|
11
|
-
var yieldHandlers = [];
|
12
|
-
|
13
|
-
function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
|
14
|
-
for (var i = 0; i < yieldHandlers.length; ++i) {
|
15
|
-
traceParent._pushContext();
|
16
|
-
var result = tryCatch(yieldHandlers[i])(value);
|
17
|
-
traceParent._popContext();
|
18
|
-
if (result === errorObj) {
|
19
|
-
traceParent._pushContext();
|
20
|
-
var ret = Promise.reject(errorObj.e);
|
21
|
-
traceParent._popContext();
|
22
|
-
return ret;
|
23
|
-
}
|
24
|
-
var maybePromise = tryConvertToPromise(result, traceParent);
|
25
|
-
if (maybePromise instanceof Promise) return maybePromise;
|
26
|
-
}
|
27
|
-
return null;
|
28
|
-
}
|
29
|
-
|
30
|
-
function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
|
31
|
-
var promise = this._promise = new Promise(INTERNAL);
|
32
|
-
promise._captureStackTrace();
|
33
|
-
this._stack = stack;
|
34
|
-
this._generatorFunction = generatorFunction;
|
35
|
-
this._receiver = receiver;
|
36
|
-
this._generator = undefined;
|
37
|
-
this._yieldHandlers = typeof yieldHandler === "function"
|
38
|
-
? [yieldHandler].concat(yieldHandlers)
|
39
|
-
: yieldHandlers;
|
40
|
-
}
|
41
|
-
|
42
|
-
PromiseSpawn.prototype.promise = function () {
|
43
|
-
return this._promise;
|
44
|
-
};
|
45
|
-
|
46
|
-
PromiseSpawn.prototype._run = function () {
|
47
|
-
this._generator = this._generatorFunction.call(this._receiver);
|
48
|
-
this._receiver =
|
49
|
-
this._generatorFunction = undefined;
|
50
|
-
this._next(undefined);
|
51
|
-
};
|
52
|
-
|
53
|
-
PromiseSpawn.prototype._continue = function (result) {
|
54
|
-
if (result === errorObj) {
|
55
|
-
return this._promise._rejectCallback(result.e, false, true);
|
56
|
-
}
|
57
|
-
|
58
|
-
var value = result.value;
|
59
|
-
if (result.done === true) {
|
60
|
-
this._promise._resolveCallback(value);
|
61
|
-
} else {
|
62
|
-
var maybePromise = tryConvertToPromise(value, this._promise);
|
63
|
-
if (!(maybePromise instanceof Promise)) {
|
64
|
-
maybePromise =
|
65
|
-
promiseFromYieldHandler(maybePromise,
|
66
|
-
this._yieldHandlers,
|
67
|
-
this._promise);
|
68
|
-
if (maybePromise === null) {
|
69
|
-
this._throw(
|
70
|
-
new TypeError(
|
71
|
-
"A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/4Y4pDk\u000a\u000a".replace("%s", value) +
|
72
|
-
"From coroutine:\u000a" +
|
73
|
-
this._stack.split("\n").slice(1, -7).join("\n")
|
74
|
-
)
|
75
|
-
);
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
}
|
79
|
-
maybePromise._then(
|
80
|
-
this._next,
|
81
|
-
this._throw,
|
82
|
-
undefined,
|
83
|
-
this,
|
84
|
-
null
|
85
|
-
);
|
86
|
-
}
|
87
|
-
};
|
88
|
-
|
89
|
-
PromiseSpawn.prototype._throw = function (reason) {
|
90
|
-
this._promise._attachExtraTrace(reason);
|
91
|
-
this._promise._pushContext();
|
92
|
-
var result = tryCatch(this._generator["throw"])
|
93
|
-
.call(this._generator, reason);
|
94
|
-
this._promise._popContext();
|
95
|
-
this._continue(result);
|
96
|
-
};
|
97
|
-
|
98
|
-
PromiseSpawn.prototype._next = function (value) {
|
99
|
-
this._promise._pushContext();
|
100
|
-
var result = tryCatch(this._generator.next).call(this._generator, value);
|
101
|
-
this._promise._popContext();
|
102
|
-
this._continue(result);
|
103
|
-
};
|
104
|
-
|
105
|
-
Promise.coroutine = function (generatorFunction, options) {
|
106
|
-
if (typeof generatorFunction !== "function") {
|
107
|
-
throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a");
|
108
|
-
}
|
109
|
-
var yieldHandler = Object(options).yieldHandler;
|
110
|
-
var PromiseSpawn$ = PromiseSpawn;
|
111
|
-
var stack = new Error().stack;
|
112
|
-
return function () {
|
113
|
-
var generator = generatorFunction.apply(this, arguments);
|
114
|
-
var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
|
115
|
-
stack);
|
116
|
-
spawn._generator = generator;
|
117
|
-
spawn._next(undefined);
|
118
|
-
return spawn.promise();
|
119
|
-
};
|
120
|
-
};
|
121
|
-
|
122
|
-
Promise.coroutine.addYieldHandler = function(fn) {
|
123
|
-
if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
|
124
|
-
yieldHandlers.push(fn);
|
125
|
-
};
|
126
|
-
|
127
|
-
Promise.spawn = function (generatorFunction) {
|
128
|
-
if (typeof generatorFunction !== "function") {
|
129
|
-
return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a");
|
130
|
-
}
|
131
|
-
var spawn = new PromiseSpawn(generatorFunction, this);
|
132
|
-
var ret = spawn.promise();
|
133
|
-
spawn._run(Promise.spawn);
|
134
|
-
return ret;
|
135
|
-
};
|
136
|
-
};
|
@@ -1,107 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
module.exports =
|
3
|
-
function(Promise, PromiseArray, tryConvertToPromise, INTERNAL) {
|
4
|
-
var util = require("./util.js");
|
5
|
-
var canEvaluate = util.canEvaluate;
|
6
|
-
var tryCatch = util.tryCatch;
|
7
|
-
var errorObj = util.errorObj;
|
8
|
-
var reject;
|
9
|
-
|
10
|
-
if (!false) {
|
11
|
-
if (canEvaluate) {
|
12
|
-
var thenCallback = function(i) {
|
13
|
-
return new Function("value", "holder", " \n\
|
14
|
-
'use strict'; \n\
|
15
|
-
holder.pIndex = value; \n\
|
16
|
-
holder.checkFulfillment(this); \n\
|
17
|
-
".replace(/Index/g, i));
|
18
|
-
};
|
19
|
-
|
20
|
-
var caller = function(count) {
|
21
|
-
var values = [];
|
22
|
-
for (var i = 1; i <= count; ++i) values.push("holder.p" + i);
|
23
|
-
return new Function("holder", " \n\
|
24
|
-
'use strict'; \n\
|
25
|
-
var callback = holder.fn; \n\
|
26
|
-
return callback(values); \n\
|
27
|
-
".replace(/values/g, values.join(", ")));
|
28
|
-
};
|
29
|
-
var thenCallbacks = [];
|
30
|
-
var callers = [undefined];
|
31
|
-
for (var i = 1; i <= 5; ++i) {
|
32
|
-
thenCallbacks.push(thenCallback(i));
|
33
|
-
callers.push(caller(i));
|
34
|
-
}
|
35
|
-
|
36
|
-
var Holder = function(total, fn) {
|
37
|
-
this.p1 = this.p2 = this.p3 = this.p4 = this.p5 = null;
|
38
|
-
this.fn = fn;
|
39
|
-
this.total = total;
|
40
|
-
this.now = 0;
|
41
|
-
};
|
42
|
-
|
43
|
-
Holder.prototype.callers = callers;
|
44
|
-
Holder.prototype.checkFulfillment = function(promise) {
|
45
|
-
var now = this.now;
|
46
|
-
now++;
|
47
|
-
var total = this.total;
|
48
|
-
if (now >= total) {
|
49
|
-
var handler = this.callers[total];
|
50
|
-
promise._pushContext();
|
51
|
-
var ret = tryCatch(handler)(this);
|
52
|
-
promise._popContext();
|
53
|
-
if (ret === errorObj) {
|
54
|
-
promise._rejectCallback(ret.e, false, true);
|
55
|
-
} else {
|
56
|
-
promise._resolveCallback(ret);
|
57
|
-
}
|
58
|
-
} else {
|
59
|
-
this.now = now;
|
60
|
-
}
|
61
|
-
};
|
62
|
-
|
63
|
-
var reject = function (reason) {
|
64
|
-
this._reject(reason);
|
65
|
-
};
|
66
|
-
}
|
67
|
-
}
|
68
|
-
|
69
|
-
Promise.join = function () {
|
70
|
-
var last = arguments.length - 1;
|
71
|
-
var fn;
|
72
|
-
if (last > 0 && typeof arguments[last] === "function") {
|
73
|
-
fn = arguments[last];
|
74
|
-
if (!false) {
|
75
|
-
if (last < 6 && canEvaluate) {
|
76
|
-
var ret = new Promise(INTERNAL);
|
77
|
-
ret._captureStackTrace();
|
78
|
-
var holder = new Holder(last, fn);
|
79
|
-
var callbacks = thenCallbacks;
|
80
|
-
for (var i = 0; i < last; ++i) {
|
81
|
-
var maybePromise = tryConvertToPromise(arguments[i], ret);
|
82
|
-
if (maybePromise instanceof Promise) {
|
83
|
-
maybePromise = maybePromise._target();
|
84
|
-
if (maybePromise._isPending()) {
|
85
|
-
maybePromise._then(callbacks[i], reject,
|
86
|
-
undefined, ret, holder);
|
87
|
-
} else if (maybePromise._isFulfilled()) {
|
88
|
-
callbacks[i].call(ret,
|
89
|
-
maybePromise._value(), holder);
|
90
|
-
} else {
|
91
|
-
ret._reject(maybePromise._reason());
|
92
|
-
}
|
93
|
-
} else {
|
94
|
-
callbacks[i].call(ret, maybePromise, holder);
|
95
|
-
}
|
96
|
-
}
|
97
|
-
return ret;
|
98
|
-
}
|
99
|
-
}
|
100
|
-
}
|
101
|
-
var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];}
|
102
|
-
if (fn) args.pop();
|
103
|
-
var ret = new PromiseArray(args).promise();
|
104
|
-
return fn !== undefined ? ret.spread(fn) : ret;
|
105
|
-
};
|
106
|
-
|
107
|
-
};
|
@@ -1,133 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
module.exports = function(Promise,
|
3
|
-
PromiseArray,
|
4
|
-
apiRejection,
|
5
|
-
tryConvertToPromise,
|
6
|
-
INTERNAL) {
|
7
|
-
var getDomain = Promise._getDomain;
|
8
|
-
var async = require("./async.js");
|
9
|
-
var util = require("./util.js");
|
10
|
-
var tryCatch = util.tryCatch;
|
11
|
-
var errorObj = util.errorObj;
|
12
|
-
var PENDING = {};
|
13
|
-
var EMPTY_ARRAY = [];
|
14
|
-
|
15
|
-
function MappingPromiseArray(promises, fn, limit, _filter) {
|
16
|
-
this.constructor$(promises);
|
17
|
-
this._promise._captureStackTrace();
|
18
|
-
var domain = getDomain();
|
19
|
-
this._callback = domain === null ? fn : domain.bind(fn);
|
20
|
-
this._preservedValues = _filter === INTERNAL
|
21
|
-
? new Array(this.length())
|
22
|
-
: null;
|
23
|
-
this._limit = limit;
|
24
|
-
this._inFlight = 0;
|
25
|
-
this._queue = limit >= 1 ? [] : EMPTY_ARRAY;
|
26
|
-
async.invoke(init, this, undefined);
|
27
|
-
}
|
28
|
-
util.inherits(MappingPromiseArray, PromiseArray);
|
29
|
-
function init() {this._init$(undefined, -2);}
|
30
|
-
|
31
|
-
MappingPromiseArray.prototype._init = function () {};
|
32
|
-
|
33
|
-
MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
34
|
-
var values = this._values;
|
35
|
-
var length = this.length();
|
36
|
-
var preservedValues = this._preservedValues;
|
37
|
-
var limit = this._limit;
|
38
|
-
if (values[index] === PENDING) {
|
39
|
-
values[index] = value;
|
40
|
-
if (limit >= 1) {
|
41
|
-
this._inFlight--;
|
42
|
-
this._drainQueue();
|
43
|
-
if (this._isResolved()) return;
|
44
|
-
}
|
45
|
-
} else {
|
46
|
-
if (limit >= 1 && this._inFlight >= limit) {
|
47
|
-
values[index] = value;
|
48
|
-
this._queue.push(index);
|
49
|
-
return;
|
50
|
-
}
|
51
|
-
if (preservedValues !== null) preservedValues[index] = value;
|
52
|
-
|
53
|
-
var callback = this._callback;
|
54
|
-
var receiver = this._promise._boundValue();
|
55
|
-
this._promise._pushContext();
|
56
|
-
var ret = tryCatch(callback).call(receiver, value, index, length);
|
57
|
-
this._promise._popContext();
|
58
|
-
if (ret === errorObj) return this._reject(ret.e);
|
59
|
-
|
60
|
-
var maybePromise = tryConvertToPromise(ret, this._promise);
|
61
|
-
if (maybePromise instanceof Promise) {
|
62
|
-
maybePromise = maybePromise._target();
|
63
|
-
if (maybePromise._isPending()) {
|
64
|
-
if (limit >= 1) this._inFlight++;
|
65
|
-
values[index] = PENDING;
|
66
|
-
return maybePromise._proxyPromiseArray(this, index);
|
67
|
-
} else if (maybePromise._isFulfilled()) {
|
68
|
-
ret = maybePromise._value();
|
69
|
-
} else {
|
70
|
-
return this._reject(maybePromise._reason());
|
71
|
-
}
|
72
|
-
}
|
73
|
-
values[index] = ret;
|
74
|
-
}
|
75
|
-
var totalResolved = ++this._totalResolved;
|
76
|
-
if (totalResolved >= length) {
|
77
|
-
if (preservedValues !== null) {
|
78
|
-
this._filter(values, preservedValues);
|
79
|
-
} else {
|
80
|
-
this._resolve(values);
|
81
|
-
}
|
82
|
-
|
83
|
-
}
|
84
|
-
};
|
85
|
-
|
86
|
-
MappingPromiseArray.prototype._drainQueue = function () {
|
87
|
-
var queue = this._queue;
|
88
|
-
var limit = this._limit;
|
89
|
-
var values = this._values;
|
90
|
-
while (queue.length > 0 && this._inFlight < limit) {
|
91
|
-
if (this._isResolved()) return;
|
92
|
-
var index = queue.pop();
|
93
|
-
this._promiseFulfilled(values[index], index);
|
94
|
-
}
|
95
|
-
};
|
96
|
-
|
97
|
-
MappingPromiseArray.prototype._filter = function (booleans, values) {
|
98
|
-
var len = values.length;
|
99
|
-
var ret = new Array(len);
|
100
|
-
var j = 0;
|
101
|
-
for (var i = 0; i < len; ++i) {
|
102
|
-
if (booleans[i]) ret[j++] = values[i];
|
103
|
-
}
|
104
|
-
ret.length = j;
|
105
|
-
this._resolve(ret);
|
106
|
-
};
|
107
|
-
|
108
|
-
MappingPromiseArray.prototype.preservedValues = function () {
|
109
|
-
return this._preservedValues;
|
110
|
-
};
|
111
|
-
|
112
|
-
function map(promises, fn, options, _filter) {
|
113
|
-
var limit = typeof options === "object" && options !== null
|
114
|
-
? options.concurrency
|
115
|
-
: 0;
|
116
|
-
limit = typeof limit === "number" &&
|
117
|
-
isFinite(limit) && limit >= 1 ? limit : 0;
|
118
|
-
return new MappingPromiseArray(promises, fn, limit, _filter);
|
119
|
-
}
|
120
|
-
|
121
|
-
Promise.prototype.map = function (fn, options) {
|
122
|
-
if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
|
123
|
-
|
124
|
-
return map(this, fn, options, null).promise();
|
125
|
-
};
|
126
|
-
|
127
|
-
Promise.map = function (promises, fn, options, _filter) {
|
128
|
-
if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
|
129
|
-
return map(promises, fn, options, _filter).promise();
|
130
|
-
};
|
131
|
-
|
132
|
-
|
133
|
-
};
|