browsed 0.2.9 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +28 -28
- data/browsed.gemspec +3 -4
- 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 +13 -166
- 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 -39
@@ -1,43 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
module.exports =
|
3
|
-
function(Promise, PromiseArray, debug) {
|
4
|
-
var PromiseInspection = Promise.PromiseInspection;
|
5
|
-
var util = require("./util");
|
6
|
-
|
7
|
-
function SettledPromiseArray(values) {
|
8
|
-
this.constructor$(values);
|
9
|
-
}
|
10
|
-
util.inherits(SettledPromiseArray, PromiseArray);
|
11
|
-
|
12
|
-
SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {
|
13
|
-
this._values[index] = inspection;
|
14
|
-
var totalResolved = ++this._totalResolved;
|
15
|
-
if (totalResolved >= this._length) {
|
16
|
-
this._resolve(this._values);
|
17
|
-
return true;
|
18
|
-
}
|
19
|
-
return false;
|
20
|
-
};
|
21
|
-
|
22
|
-
SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
23
|
-
var ret = new PromiseInspection();
|
24
|
-
ret._bitField = 33554432;
|
25
|
-
ret._settledValueField = value;
|
26
|
-
return this._promiseResolved(index, ret);
|
27
|
-
};
|
28
|
-
SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
|
29
|
-
var ret = new PromiseInspection();
|
30
|
-
ret._bitField = 16777216;
|
31
|
-
ret._settledValueField = reason;
|
32
|
-
return this._promiseResolved(index, ret);
|
33
|
-
};
|
34
|
-
|
35
|
-
Promise.settle = function (promises) {
|
36
|
-
debug.deprecated(".settle()", ".reflect()");
|
37
|
-
return new SettledPromiseArray(promises).promise();
|
38
|
-
};
|
39
|
-
|
40
|
-
Promise.prototype.settle = function () {
|
41
|
-
return Promise.settle(this);
|
42
|
-
};
|
43
|
-
};
|
@@ -1,148 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
module.exports =
|
3
|
-
function(Promise, PromiseArray, apiRejection) {
|
4
|
-
var util = require("./util");
|
5
|
-
var RangeError = require("./errors").RangeError;
|
6
|
-
var AggregateError = require("./errors").AggregateError;
|
7
|
-
var isArray = util.isArray;
|
8
|
-
var CANCELLATION = {};
|
9
|
-
|
10
|
-
|
11
|
-
function SomePromiseArray(values) {
|
12
|
-
this.constructor$(values);
|
13
|
-
this._howMany = 0;
|
14
|
-
this._unwrap = false;
|
15
|
-
this._initialized = false;
|
16
|
-
}
|
17
|
-
util.inherits(SomePromiseArray, PromiseArray);
|
18
|
-
|
19
|
-
SomePromiseArray.prototype._init = function () {
|
20
|
-
if (!this._initialized) {
|
21
|
-
return;
|
22
|
-
}
|
23
|
-
if (this._howMany === 0) {
|
24
|
-
this._resolve([]);
|
25
|
-
return;
|
26
|
-
}
|
27
|
-
this._init$(undefined, -5);
|
28
|
-
var isArrayResolved = isArray(this._values);
|
29
|
-
if (!this._isResolved() &&
|
30
|
-
isArrayResolved &&
|
31
|
-
this._howMany > this._canPossiblyFulfill()) {
|
32
|
-
this._reject(this._getRangeError(this.length()));
|
33
|
-
}
|
34
|
-
};
|
35
|
-
|
36
|
-
SomePromiseArray.prototype.init = function () {
|
37
|
-
this._initialized = true;
|
38
|
-
this._init();
|
39
|
-
};
|
40
|
-
|
41
|
-
SomePromiseArray.prototype.setUnwrap = function () {
|
42
|
-
this._unwrap = true;
|
43
|
-
};
|
44
|
-
|
45
|
-
SomePromiseArray.prototype.howMany = function () {
|
46
|
-
return this._howMany;
|
47
|
-
};
|
48
|
-
|
49
|
-
SomePromiseArray.prototype.setHowMany = function (count) {
|
50
|
-
this._howMany = count;
|
51
|
-
};
|
52
|
-
|
53
|
-
SomePromiseArray.prototype._promiseFulfilled = function (value) {
|
54
|
-
this._addFulfilled(value);
|
55
|
-
if (this._fulfilled() === this.howMany()) {
|
56
|
-
this._values.length = this.howMany();
|
57
|
-
if (this.howMany() === 1 && this._unwrap) {
|
58
|
-
this._resolve(this._values[0]);
|
59
|
-
} else {
|
60
|
-
this._resolve(this._values);
|
61
|
-
}
|
62
|
-
return true;
|
63
|
-
}
|
64
|
-
return false;
|
65
|
-
|
66
|
-
};
|
67
|
-
SomePromiseArray.prototype._promiseRejected = function (reason) {
|
68
|
-
this._addRejected(reason);
|
69
|
-
return this._checkOutcome();
|
70
|
-
};
|
71
|
-
|
72
|
-
SomePromiseArray.prototype._promiseCancelled = function () {
|
73
|
-
if (this._values instanceof Promise || this._values == null) {
|
74
|
-
return this._cancel();
|
75
|
-
}
|
76
|
-
this._addRejected(CANCELLATION);
|
77
|
-
return this._checkOutcome();
|
78
|
-
};
|
79
|
-
|
80
|
-
SomePromiseArray.prototype._checkOutcome = function() {
|
81
|
-
if (this.howMany() > this._canPossiblyFulfill()) {
|
82
|
-
var e = new AggregateError();
|
83
|
-
for (var i = this.length(); i < this._values.length; ++i) {
|
84
|
-
if (this._values[i] !== CANCELLATION) {
|
85
|
-
e.push(this._values[i]);
|
86
|
-
}
|
87
|
-
}
|
88
|
-
if (e.length > 0) {
|
89
|
-
this._reject(e);
|
90
|
-
} else {
|
91
|
-
this._cancel();
|
92
|
-
}
|
93
|
-
return true;
|
94
|
-
}
|
95
|
-
return false;
|
96
|
-
};
|
97
|
-
|
98
|
-
SomePromiseArray.prototype._fulfilled = function () {
|
99
|
-
return this._totalResolved;
|
100
|
-
};
|
101
|
-
|
102
|
-
SomePromiseArray.prototype._rejected = function () {
|
103
|
-
return this._values.length - this.length();
|
104
|
-
};
|
105
|
-
|
106
|
-
SomePromiseArray.prototype._addRejected = function (reason) {
|
107
|
-
this._values.push(reason);
|
108
|
-
};
|
109
|
-
|
110
|
-
SomePromiseArray.prototype._addFulfilled = function (value) {
|
111
|
-
this._values[this._totalResolved++] = value;
|
112
|
-
};
|
113
|
-
|
114
|
-
SomePromiseArray.prototype._canPossiblyFulfill = function () {
|
115
|
-
return this.length() - this._rejected();
|
116
|
-
};
|
117
|
-
|
118
|
-
SomePromiseArray.prototype._getRangeError = function (count) {
|
119
|
-
var message = "Input array must contain at least " +
|
120
|
-
this._howMany + " items but contains only " + count + " items";
|
121
|
-
return new RangeError(message);
|
122
|
-
};
|
123
|
-
|
124
|
-
SomePromiseArray.prototype._resolveEmptyArray = function () {
|
125
|
-
this._reject(this._getRangeError(0));
|
126
|
-
};
|
127
|
-
|
128
|
-
function some(promises, howMany) {
|
129
|
-
if ((howMany | 0) !== howMany || howMany < 0) {
|
130
|
-
return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
131
|
-
}
|
132
|
-
var ret = new SomePromiseArray(promises);
|
133
|
-
var promise = ret.promise();
|
134
|
-
ret.setHowMany(howMany);
|
135
|
-
ret.init();
|
136
|
-
return promise;
|
137
|
-
}
|
138
|
-
|
139
|
-
Promise.some = function (promises, howMany) {
|
140
|
-
return some(promises, howMany);
|
141
|
-
};
|
142
|
-
|
143
|
-
Promise.prototype.some = function (howMany) {
|
144
|
-
return some(this, howMany);
|
145
|
-
};
|
146
|
-
|
147
|
-
Promise._SomePromiseArray = SomePromiseArray;
|
148
|
-
};
|
@@ -1,103 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
module.exports = function(Promise) {
|
3
|
-
function PromiseInspection(promise) {
|
4
|
-
if (promise !== undefined) {
|
5
|
-
promise = promise._target();
|
6
|
-
this._bitField = promise._bitField;
|
7
|
-
this._settledValueField = promise._isFateSealed()
|
8
|
-
? promise._settledValue() : undefined;
|
9
|
-
}
|
10
|
-
else {
|
11
|
-
this._bitField = 0;
|
12
|
-
this._settledValueField = undefined;
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
PromiseInspection.prototype._settledValue = function() {
|
17
|
-
return this._settledValueField;
|
18
|
-
};
|
19
|
-
|
20
|
-
var value = PromiseInspection.prototype.value = function () {
|
21
|
-
if (!this.isFulfilled()) {
|
22
|
-
throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
23
|
-
}
|
24
|
-
return this._settledValue();
|
25
|
-
};
|
26
|
-
|
27
|
-
var reason = PromiseInspection.prototype.error =
|
28
|
-
PromiseInspection.prototype.reason = function () {
|
29
|
-
if (!this.isRejected()) {
|
30
|
-
throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
31
|
-
}
|
32
|
-
return this._settledValue();
|
33
|
-
};
|
34
|
-
|
35
|
-
var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
|
36
|
-
return (this._bitField & 33554432) !== 0;
|
37
|
-
};
|
38
|
-
|
39
|
-
var isRejected = PromiseInspection.prototype.isRejected = function () {
|
40
|
-
return (this._bitField & 16777216) !== 0;
|
41
|
-
};
|
42
|
-
|
43
|
-
var isPending = PromiseInspection.prototype.isPending = function () {
|
44
|
-
return (this._bitField & 50397184) === 0;
|
45
|
-
};
|
46
|
-
|
47
|
-
var isResolved = PromiseInspection.prototype.isResolved = function () {
|
48
|
-
return (this._bitField & 50331648) !== 0;
|
49
|
-
};
|
50
|
-
|
51
|
-
PromiseInspection.prototype.isCancelled = function() {
|
52
|
-
return (this._bitField & 8454144) !== 0;
|
53
|
-
};
|
54
|
-
|
55
|
-
Promise.prototype.__isCancelled = function() {
|
56
|
-
return (this._bitField & 65536) === 65536;
|
57
|
-
};
|
58
|
-
|
59
|
-
Promise.prototype._isCancelled = function() {
|
60
|
-
return this._target().__isCancelled();
|
61
|
-
};
|
62
|
-
|
63
|
-
Promise.prototype.isCancelled = function() {
|
64
|
-
return (this._target()._bitField & 8454144) !== 0;
|
65
|
-
};
|
66
|
-
|
67
|
-
Promise.prototype.isPending = function() {
|
68
|
-
return isPending.call(this._target());
|
69
|
-
};
|
70
|
-
|
71
|
-
Promise.prototype.isRejected = function() {
|
72
|
-
return isRejected.call(this._target());
|
73
|
-
};
|
74
|
-
|
75
|
-
Promise.prototype.isFulfilled = function() {
|
76
|
-
return isFulfilled.call(this._target());
|
77
|
-
};
|
78
|
-
|
79
|
-
Promise.prototype.isResolved = function() {
|
80
|
-
return isResolved.call(this._target());
|
81
|
-
};
|
82
|
-
|
83
|
-
Promise.prototype.value = function() {
|
84
|
-
return value.call(this._target());
|
85
|
-
};
|
86
|
-
|
87
|
-
Promise.prototype.reason = function() {
|
88
|
-
var target = this._target();
|
89
|
-
target._unsetRejectionIsUnhandled();
|
90
|
-
return reason.call(target);
|
91
|
-
};
|
92
|
-
|
93
|
-
Promise.prototype._value = function() {
|
94
|
-
return this._settledValue();
|
95
|
-
};
|
96
|
-
|
97
|
-
Promise.prototype._reason = function() {
|
98
|
-
this._unsetRejectionIsUnhandled();
|
99
|
-
return this._settledValue();
|
100
|
-
};
|
101
|
-
|
102
|
-
Promise.PromiseInspection = PromiseInspection;
|
103
|
-
};
|
@@ -1,86 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
module.exports = function(Promise, INTERNAL) {
|
3
|
-
var util = require("./util");
|
4
|
-
var errorObj = util.errorObj;
|
5
|
-
var isObject = util.isObject;
|
6
|
-
|
7
|
-
function tryConvertToPromise(obj, context) {
|
8
|
-
if (isObject(obj)) {
|
9
|
-
if (obj instanceof Promise) return obj;
|
10
|
-
var then = getThen(obj);
|
11
|
-
if (then === errorObj) {
|
12
|
-
if (context) context._pushContext();
|
13
|
-
var ret = Promise.reject(then.e);
|
14
|
-
if (context) context._popContext();
|
15
|
-
return ret;
|
16
|
-
} else if (typeof then === "function") {
|
17
|
-
if (isAnyBluebirdPromise(obj)) {
|
18
|
-
var ret = new Promise(INTERNAL);
|
19
|
-
obj._then(
|
20
|
-
ret._fulfill,
|
21
|
-
ret._reject,
|
22
|
-
undefined,
|
23
|
-
ret,
|
24
|
-
null
|
25
|
-
);
|
26
|
-
return ret;
|
27
|
-
}
|
28
|
-
return doThenable(obj, then, context);
|
29
|
-
}
|
30
|
-
}
|
31
|
-
return obj;
|
32
|
-
}
|
33
|
-
|
34
|
-
function doGetThen(obj) {
|
35
|
-
return obj.then;
|
36
|
-
}
|
37
|
-
|
38
|
-
function getThen(obj) {
|
39
|
-
try {
|
40
|
-
return doGetThen(obj);
|
41
|
-
} catch (e) {
|
42
|
-
errorObj.e = e;
|
43
|
-
return errorObj;
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
var hasProp = {}.hasOwnProperty;
|
48
|
-
function isAnyBluebirdPromise(obj) {
|
49
|
-
try {
|
50
|
-
return hasProp.call(obj, "_promise0");
|
51
|
-
} catch (e) {
|
52
|
-
return false;
|
53
|
-
}
|
54
|
-
}
|
55
|
-
|
56
|
-
function doThenable(x, then, context) {
|
57
|
-
var promise = new Promise(INTERNAL);
|
58
|
-
var ret = promise;
|
59
|
-
if (context) context._pushContext();
|
60
|
-
promise._captureStackTrace();
|
61
|
-
if (context) context._popContext();
|
62
|
-
var synchronous = true;
|
63
|
-
var result = util.tryCatch(then).call(x, resolve, reject);
|
64
|
-
synchronous = false;
|
65
|
-
|
66
|
-
if (promise && result === errorObj) {
|
67
|
-
promise._rejectCallback(result.e, true, true);
|
68
|
-
promise = null;
|
69
|
-
}
|
70
|
-
|
71
|
-
function resolve(value) {
|
72
|
-
if (!promise) return;
|
73
|
-
promise._resolveCallback(value);
|
74
|
-
promise = null;
|
75
|
-
}
|
76
|
-
|
77
|
-
function reject(reason) {
|
78
|
-
if (!promise) return;
|
79
|
-
promise._rejectCallback(reason, synchronous, true);
|
80
|
-
promise = null;
|
81
|
-
}
|
82
|
-
return ret;
|
83
|
-
}
|
84
|
-
|
85
|
-
return tryConvertToPromise;
|
86
|
-
};
|
@@ -1,93 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
module.exports = function(Promise, INTERNAL, debug) {
|
3
|
-
var util = require("./util");
|
4
|
-
var TimeoutError = Promise.TimeoutError;
|
5
|
-
|
6
|
-
function HandleWrapper(handle) {
|
7
|
-
this.handle = handle;
|
8
|
-
}
|
9
|
-
|
10
|
-
HandleWrapper.prototype._resultCancelled = function() {
|
11
|
-
clearTimeout(this.handle);
|
12
|
-
};
|
13
|
-
|
14
|
-
var afterValue = function(value) { return delay(+this).thenReturn(value); };
|
15
|
-
var delay = Promise.delay = function (ms, value) {
|
16
|
-
var ret;
|
17
|
-
var handle;
|
18
|
-
if (value !== undefined) {
|
19
|
-
ret = Promise.resolve(value)
|
20
|
-
._then(afterValue, null, null, ms, undefined);
|
21
|
-
if (debug.cancellation() && value instanceof Promise) {
|
22
|
-
ret._setOnCancel(value);
|
23
|
-
}
|
24
|
-
} else {
|
25
|
-
ret = new Promise(INTERNAL);
|
26
|
-
handle = setTimeout(function() { ret._fulfill(); }, +ms);
|
27
|
-
if (debug.cancellation()) {
|
28
|
-
ret._setOnCancel(new HandleWrapper(handle));
|
29
|
-
}
|
30
|
-
ret._captureStackTrace();
|
31
|
-
}
|
32
|
-
ret._setAsyncGuaranteed();
|
33
|
-
return ret;
|
34
|
-
};
|
35
|
-
|
36
|
-
Promise.prototype.delay = function (ms) {
|
37
|
-
return delay(ms, this);
|
38
|
-
};
|
39
|
-
|
40
|
-
var afterTimeout = function (promise, message, parent) {
|
41
|
-
var err;
|
42
|
-
if (typeof message !== "string") {
|
43
|
-
if (message instanceof Error) {
|
44
|
-
err = message;
|
45
|
-
} else {
|
46
|
-
err = new TimeoutError("operation timed out");
|
47
|
-
}
|
48
|
-
} else {
|
49
|
-
err = new TimeoutError(message);
|
50
|
-
}
|
51
|
-
util.markAsOriginatingFromRejection(err);
|
52
|
-
promise._attachExtraTrace(err);
|
53
|
-
promise._reject(err);
|
54
|
-
|
55
|
-
if (parent != null) {
|
56
|
-
parent.cancel();
|
57
|
-
}
|
58
|
-
};
|
59
|
-
|
60
|
-
function successClear(value) {
|
61
|
-
clearTimeout(this.handle);
|
62
|
-
return value;
|
63
|
-
}
|
64
|
-
|
65
|
-
function failureClear(reason) {
|
66
|
-
clearTimeout(this.handle);
|
67
|
-
throw reason;
|
68
|
-
}
|
69
|
-
|
70
|
-
Promise.prototype.timeout = function (ms, message) {
|
71
|
-
ms = +ms;
|
72
|
-
var ret, parent;
|
73
|
-
|
74
|
-
var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
|
75
|
-
if (ret.isPending()) {
|
76
|
-
afterTimeout(ret, message, parent);
|
77
|
-
}
|
78
|
-
}, ms));
|
79
|
-
|
80
|
-
if (debug.cancellation()) {
|
81
|
-
parent = this.then();
|
82
|
-
ret = parent._then(successClear, failureClear,
|
83
|
-
undefined, handleWrapper, undefined);
|
84
|
-
ret._setOnCancel(handleWrapper);
|
85
|
-
} else {
|
86
|
-
ret = this._then(successClear, failureClear,
|
87
|
-
undefined, handleWrapper, undefined);
|
88
|
-
}
|
89
|
-
|
90
|
-
return ret;
|
91
|
-
};
|
92
|
-
|
93
|
-
};
|