browsed 0.3.0 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +27 -27
  3. data/browsed.gemspec +2 -3
  4. data/lib/browsed.rb +1 -1
  5. data/lib/browsed/chrome.rb +2 -2
  6. data/lib/browsed/client.rb +2 -2
  7. data/lib/browsed/firefox.rb +2 -2
  8. data/lib/browsed/version.rb +1 -1
  9. metadata +11 -164
  10. data/lib/browsed/proxies/proxy-chain-server/node_modules/.bin/portastic +0 -1
  11. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/LICENSE +0 -21
  12. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/README.md +0 -57
  13. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/changelog.md +0 -1
  14. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.js +0 -3824
  15. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.min.js +0 -31
  16. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.js +0 -5666
  17. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
  18. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/any.js +0 -21
  19. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/assert.js +0 -55
  20. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/async.js +0 -165
  21. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bind.js +0 -67
  22. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bluebird.js +0 -11
  23. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/call_get.js +0 -123
  24. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/cancel.js +0 -129
  25. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/catch_filter.js +0 -42
  26. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/context.js +0 -69
  27. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/debuggability.js +0 -934
  28. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/direct_resolve.js +0 -46
  29. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/each.js +0 -30
  30. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/errors.js +0 -116
  31. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/es5.js +0 -80
  32. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/filter.js +0 -12
  33. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/finally.js +0 -146
  34. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/generators.js +0 -223
  35. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/join.js +0 -168
  36. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/map.js +0 -168
  37. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/method.js +0 -55
  38. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeback.js +0 -51
  39. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeify.js +0 -58
  40. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise.js +0 -789
  41. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise_array.js +0 -185
  42. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promisify.js +0 -314
  43. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/props.js +0 -118
  44. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/queue.js +0 -73
  45. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/race.js +0 -49
  46. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/reduce.js +0 -172
  47. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/schedule.js +0 -62
  48. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/settle.js +0 -43
  49. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/some.js +0 -148
  50. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/synchronous_inspection.js +0 -103
  51. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/thenables.js +0 -86
  52. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/timers.js +0 -93
  53. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/using.js +0 -226
  54. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/util.js +0 -389
  55. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/package.json +0 -102
  56. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/CHANGELOG.md +0 -408
  57. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/LICENSE +0 -22
  58. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/Readme.md +0 -428
  59. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/index.js +0 -1224
  60. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/package.json +0 -70
  61. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/typings/index.d.ts +0 -310
  62. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.coveralls.yml +0 -1
  63. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.eslintrc +0 -11
  64. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.npmignore +0 -9
  65. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.travis.yml +0 -14
  66. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/CHANGELOG.md +0 -362
  67. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/LICENSE +0 -19
  68. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/Makefile +0 -50
  69. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/README.md +0 -312
  70. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/component.json +0 -19
  71. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/karma.conf.js +0 -70
  72. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/node.js +0 -1
  73. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/package.json +0 -88
  74. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/browser.js +0 -185
  75. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/debug.js +0 -202
  76. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/index.js +0 -10
  77. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/inspector-log.js +0 -15
  78. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/node.js +0 -248
  79. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/index.js +0 -152
  80. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/license.md +0 -21
  81. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/package.json +0 -69
  82. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/readme.md +0 -51
  83. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/LICENSE +0 -13
  84. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/README.md +0 -148
  85. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic +0 -65
  86. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/history.md +0 -7
  87. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/index.js +0 -4
  88. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/monitor.js +0 -59
  89. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/portastic.js +0 -167
  90. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/LICENSE +0 -21
  91. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/README.md +0 -677
  92. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/changelog.md +0 -1730
  93. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.js +0 -4892
  94. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
  95. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/any.js +0 -21
  96. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/assert.js +0 -55
  97. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/async.js +0 -150
  98. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bind.js +0 -72
  99. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bluebird.js +0 -11
  100. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/call_get.js +0 -123
  101. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/cancel.js +0 -48
  102. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/captured_trace.js +0 -493
  103. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/catch_filter.js +0 -66
  104. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js +0 -38
  105. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/debuggability.js +0 -162
  106. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/direct_resolve.js +0 -63
  107. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/each.js +0 -12
  108. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/errors.js +0 -111
  109. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/es5.js +0 -80
  110. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/filter.js +0 -12
  111. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/finally.js +0 -98
  112. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/generators.js +0 -136
  113. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/join.js +0 -107
  114. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/map.js +0 -133
  115. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/method.js +0 -44
  116. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/nodeify.js +0 -59
  117. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/progress.js +0 -76
  118. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise.js +0 -759
  119. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_array.js +0 -142
  120. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_resolver.js +0 -123
  121. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promisify.js +0 -307
  122. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/props.js +0 -79
  123. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/queue.js +0 -90
  124. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/race.js +0 -47
  125. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/reduce.js +0 -148
  126. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/schedule.js +0 -35
  127. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/settle.js +0 -40
  128. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/some.js +0 -125
  129. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/synchronous_inspection.js +0 -94
  130. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/thenables.js +0 -84
  131. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/timers.js +0 -64
  132. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/using.js +0 -213
  133. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/util.js +0 -321
  134. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/package.json +0 -103
  135. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/package.json +0 -69
  136. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/CHANGELOG.md +0 -109
  137. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/LICENSE +0 -201
  138. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/README.md +0 -278
  139. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/anonymize_proxy.js +0 -100
  140. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_base.js +0 -319
  141. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_custom_response.js +0 -96
  142. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_forward.js +0 -173
  143. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_chain.js +0 -132
  144. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_direct.js +0 -89
  145. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_tcp_chain.js +0 -271
  146. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/index.js +0 -26
  147. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/run_locally.js +0 -66
  148. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/server.js +0 -595
  149. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tcp_tunnel.js +0 -138
  150. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/testing_tcp_service.js +0 -37
  151. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tools.js +0 -220
  152. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/package.json +0 -104
  153. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/LICENSE +0 -23
  154. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/README.md +0 -28
  155. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/package.json +0 -81
  156. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js +0 -5
  157. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js.map +0 -1
  158. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore.js +0 -1692
  159. data/lib/browsed/proxies/proxy-chain-server/package-lock.json +0 -63
  160. data/lib/browsed/proxies/proxy-chain-server/package.json +0 -15
  161. data/lib/browsed/proxies/proxy-chain-server/server.js +0 -25
  162. data/lib/browsed/proxies/proxy_chain.rb +0 -46
@@ -1,79 +0,0 @@
1
- "use strict";
2
- module.exports = function(
3
- Promise, PromiseArray, tryConvertToPromise, apiRejection) {
4
- var util = require("./util.js");
5
- var isObject = util.isObject;
6
- var es5 = require("./es5.js");
7
-
8
- function PropertiesPromiseArray(obj) {
9
- var keys = es5.keys(obj);
10
- var len = keys.length;
11
- var values = new Array(len * 2);
12
- for (var i = 0; i < len; ++i) {
13
- var key = keys[i];
14
- values[i] = obj[key];
15
- values[i + len] = key;
16
- }
17
- this.constructor$(values);
18
- }
19
- util.inherits(PropertiesPromiseArray, PromiseArray);
20
-
21
- PropertiesPromiseArray.prototype._init = function () {
22
- this._init$(undefined, -3) ;
23
- };
24
-
25
- PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
26
- this._values[index] = value;
27
- var totalResolved = ++this._totalResolved;
28
- if (totalResolved >= this._length) {
29
- var val = {};
30
- var keyOffset = this.length();
31
- for (var i = 0, len = this.length(); i < len; ++i) {
32
- val[this._values[i + keyOffset]] = this._values[i];
33
- }
34
- this._resolve(val);
35
- }
36
- };
37
-
38
- PropertiesPromiseArray.prototype._promiseProgressed = function (value, index) {
39
- this._promise._progress({
40
- key: this._values[index + this.length()],
41
- value: value
42
- });
43
- };
44
-
45
- PropertiesPromiseArray.prototype.shouldCopyValues = function () {
46
- return false;
47
- };
48
-
49
- PropertiesPromiseArray.prototype.getActualLength = function (len) {
50
- return len >> 1;
51
- };
52
-
53
- function props(promises) {
54
- var ret;
55
- var castValue = tryConvertToPromise(promises);
56
-
57
- if (!isObject(castValue)) {
58
- return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/OsFKC8\u000a");
59
- } else if (castValue instanceof Promise) {
60
- ret = castValue._then(
61
- Promise.props, undefined, undefined, undefined, undefined);
62
- } else {
63
- ret = new PropertiesPromiseArray(castValue).promise();
64
- }
65
-
66
- if (castValue instanceof Promise) {
67
- ret._propagateFrom(castValue, 4);
68
- }
69
- return ret;
70
- }
71
-
72
- Promise.prototype.props = function () {
73
- return props(this);
74
- };
75
-
76
- Promise.props = function (promises) {
77
- return props(promises);
78
- };
79
- };
@@ -1,90 +0,0 @@
1
- "use strict";
2
- function arrayMove(src, srcIndex, dst, dstIndex, len) {
3
- for (var j = 0; j < len; ++j) {
4
- dst[j + dstIndex] = src[j + srcIndex];
5
- src[j + srcIndex] = void 0;
6
- }
7
- }
8
-
9
- function Queue(capacity) {
10
- this._capacity = capacity;
11
- this._length = 0;
12
- this._front = 0;
13
- }
14
-
15
- Queue.prototype._willBeOverCapacity = function (size) {
16
- return this._capacity < size;
17
- };
18
-
19
- Queue.prototype._pushOne = function (arg) {
20
- var length = this.length();
21
- this._checkCapacity(length + 1);
22
- var i = (this._front + length) & (this._capacity - 1);
23
- this[i] = arg;
24
- this._length = length + 1;
25
- };
26
-
27
- Queue.prototype._unshiftOne = function(value) {
28
- var capacity = this._capacity;
29
- this._checkCapacity(this.length() + 1);
30
- var front = this._front;
31
- var i = (((( front - 1 ) &
32
- ( capacity - 1) ) ^ capacity ) - capacity );
33
- this[i] = value;
34
- this._front = i;
35
- this._length = this.length() + 1;
36
- };
37
-
38
- Queue.prototype.unshift = function(fn, receiver, arg) {
39
- this._unshiftOne(arg);
40
- this._unshiftOne(receiver);
41
- this._unshiftOne(fn);
42
- };
43
-
44
- Queue.prototype.push = function (fn, receiver, arg) {
45
- var length = this.length() + 3;
46
- if (this._willBeOverCapacity(length)) {
47
- this._pushOne(fn);
48
- this._pushOne(receiver);
49
- this._pushOne(arg);
50
- return;
51
- }
52
- var j = this._front + length - 3;
53
- this._checkCapacity(length);
54
- var wrapMask = this._capacity - 1;
55
- this[(j + 0) & wrapMask] = fn;
56
- this[(j + 1) & wrapMask] = receiver;
57
- this[(j + 2) & wrapMask] = arg;
58
- this._length = length;
59
- };
60
-
61
- Queue.prototype.shift = function () {
62
- var front = this._front,
63
- ret = this[front];
64
-
65
- this[front] = undefined;
66
- this._front = (front + 1) & (this._capacity - 1);
67
- this._length--;
68
- return ret;
69
- };
70
-
71
- Queue.prototype.length = function () {
72
- return this._length;
73
- };
74
-
75
- Queue.prototype._checkCapacity = function (size) {
76
- if (this._capacity < size) {
77
- this._resizeTo(this._capacity << 1);
78
- }
79
- };
80
-
81
- Queue.prototype._resizeTo = function (capacity) {
82
- var oldCapacity = this._capacity;
83
- this._capacity = capacity;
84
- var front = this._front;
85
- var length = this._length;
86
- var moveItemsCount = (front + length) & (oldCapacity - 1);
87
- arrayMove(this, 0, this, oldCapacity, moveItemsCount);
88
- };
89
-
90
- module.exports = Queue;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- module.exports = function(
3
- Promise, INTERNAL, tryConvertToPromise, apiRejection) {
4
- var isArray = require("./util.js").isArray;
5
-
6
- var raceLater = function (promise) {
7
- return promise.then(function(array) {
8
- return race(array, promise);
9
- });
10
- };
11
-
12
- function race(promises, parent) {
13
- var maybePromise = tryConvertToPromise(promises);
14
-
15
- if (maybePromise instanceof Promise) {
16
- return raceLater(maybePromise);
17
- } else if (!isArray(promises)) {
18
- return apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a");
19
- }
20
-
21
- var ret = new Promise(INTERNAL);
22
- if (parent !== undefined) {
23
- ret._propagateFrom(parent, 4 | 1);
24
- }
25
- var fulfill = ret._fulfill;
26
- var reject = ret._reject;
27
- for (var i = 0, len = promises.length; i < len; ++i) {
28
- var val = promises[i];
29
-
30
- if (val === undefined && !(i in promises)) {
31
- continue;
32
- }
33
-
34
- Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
35
- }
36
- return ret;
37
- }
38
-
39
- Promise.race = function (promises) {
40
- return race(promises, undefined);
41
- };
42
-
43
- Promise.prototype.race = function () {
44
- return race(this, undefined);
45
- };
46
-
47
- };
@@ -1,148 +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
- function ReductionPromiseArray(promises, fn, accum, _each) {
13
- this.constructor$(promises);
14
- this._promise._captureStackTrace();
15
- this._preservedValues = _each === INTERNAL ? [] : null;
16
- this._zerothIsAccum = (accum === undefined);
17
- this._gotAccum = false;
18
- this._reducingIndex = (this._zerothIsAccum ? 1 : 0);
19
- this._valuesPhase = undefined;
20
- var maybePromise = tryConvertToPromise(accum, this._promise);
21
- var rejected = false;
22
- var isPromise = maybePromise instanceof Promise;
23
- if (isPromise) {
24
- maybePromise = maybePromise._target();
25
- if (maybePromise._isPending()) {
26
- maybePromise._proxyPromiseArray(this, -1);
27
- } else if (maybePromise._isFulfilled()) {
28
- accum = maybePromise._value();
29
- this._gotAccum = true;
30
- } else {
31
- this._reject(maybePromise._reason());
32
- rejected = true;
33
- }
34
- }
35
- if (!(isPromise || this._zerothIsAccum)) this._gotAccum = true;
36
- var domain = getDomain();
37
- this._callback = domain === null ? fn : domain.bind(fn);
38
- this._accum = accum;
39
- if (!rejected) async.invoke(init, this, undefined);
40
- }
41
- function init() {
42
- this._init$(undefined, -5);
43
- }
44
- util.inherits(ReductionPromiseArray, PromiseArray);
45
-
46
- ReductionPromiseArray.prototype._init = function () {};
47
-
48
- ReductionPromiseArray.prototype._resolveEmptyArray = function () {
49
- if (this._gotAccum || this._zerothIsAccum) {
50
- this._resolve(this._preservedValues !== null
51
- ? [] : this._accum);
52
- }
53
- };
54
-
55
- ReductionPromiseArray.prototype._promiseFulfilled = function (value, index) {
56
- var values = this._values;
57
- values[index] = value;
58
- var length = this.length();
59
- var preservedValues = this._preservedValues;
60
- var isEach = preservedValues !== null;
61
- var gotAccum = this._gotAccum;
62
- var valuesPhase = this._valuesPhase;
63
- var valuesPhaseIndex;
64
- if (!valuesPhase) {
65
- valuesPhase = this._valuesPhase = new Array(length);
66
- for (valuesPhaseIndex=0; valuesPhaseIndex<length; ++valuesPhaseIndex) {
67
- valuesPhase[valuesPhaseIndex] = 0;
68
- }
69
- }
70
- valuesPhaseIndex = valuesPhase[index];
71
-
72
- if (index === 0 && this._zerothIsAccum) {
73
- this._accum = value;
74
- this._gotAccum = gotAccum = true;
75
- valuesPhase[index] = ((valuesPhaseIndex === 0)
76
- ? 1 : 2);
77
- } else if (index === -1) {
78
- this._accum = value;
79
- this._gotAccum = gotAccum = true;
80
- } else {
81
- if (valuesPhaseIndex === 0) {
82
- valuesPhase[index] = 1;
83
- } else {
84
- valuesPhase[index] = 2;
85
- this._accum = value;
86
- }
87
- }
88
- if (!gotAccum) return;
89
-
90
- var callback = this._callback;
91
- var receiver = this._promise._boundValue();
92
- var ret;
93
-
94
- for (var i = this._reducingIndex; i < length; ++i) {
95
- valuesPhaseIndex = valuesPhase[i];
96
- if (valuesPhaseIndex === 2) {
97
- this._reducingIndex = i + 1;
98
- continue;
99
- }
100
- if (valuesPhaseIndex !== 1) return;
101
- value = values[i];
102
- this._promise._pushContext();
103
- if (isEach) {
104
- preservedValues.push(value);
105
- ret = tryCatch(callback).call(receiver, value, i, length);
106
- }
107
- else {
108
- ret = tryCatch(callback)
109
- .call(receiver, this._accum, value, i, length);
110
- }
111
- this._promise._popContext();
112
-
113
- if (ret === errorObj) return this._reject(ret.e);
114
-
115
- var maybePromise = tryConvertToPromise(ret, this._promise);
116
- if (maybePromise instanceof Promise) {
117
- maybePromise = maybePromise._target();
118
- if (maybePromise._isPending()) {
119
- valuesPhase[i] = 4;
120
- return maybePromise._proxyPromiseArray(this, i);
121
- } else if (maybePromise._isFulfilled()) {
122
- ret = maybePromise._value();
123
- } else {
124
- return this._reject(maybePromise._reason());
125
- }
126
- }
127
-
128
- this._reducingIndex = i + 1;
129
- this._accum = ret;
130
- }
131
-
132
- this._resolve(isEach ? preservedValues : this._accum);
133
- };
134
-
135
- function reduce(promises, fn, initialValue, _each) {
136
- if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a");
137
- var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
138
- return array.promise();
139
- }
140
-
141
- Promise.prototype.reduce = function (fn, initialValue) {
142
- return reduce(this, fn, initialValue, null);
143
- };
144
-
145
- Promise.reduce = function (promises, fn, initialValue, _each) {
146
- return reduce(promises, fn, initialValue, _each);
147
- };
148
- };
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var schedule;
3
- var util = require("./util");
4
- var noAsyncScheduler = function() {
5
- throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/m3OTXk\u000a");
6
- };
7
- if (util.isNode && typeof MutationObserver === "undefined") {
8
- var GlobalSetImmediate = global.setImmediate;
9
- var ProcessNextTick = process.nextTick;
10
- schedule = util.isRecentNode
11
- ? function(fn) { GlobalSetImmediate.call(global, fn); }
12
- : function(fn) { ProcessNextTick.call(process, fn); };
13
- } else if ((typeof MutationObserver !== "undefined") &&
14
- !(typeof window !== "undefined" &&
15
- window.navigator &&
16
- window.navigator.standalone)) {
17
- schedule = function(fn) {
18
- var div = document.createElement("div");
19
- var observer = new MutationObserver(fn);
20
- observer.observe(div, {attributes: true});
21
- return function() { div.classList.toggle("foo"); };
22
- };
23
- schedule.isStatic = true;
24
- } else if (typeof setImmediate !== "undefined") {
25
- schedule = function (fn) {
26
- setImmediate(fn);
27
- };
28
- } else if (typeof setTimeout !== "undefined") {
29
- schedule = function (fn) {
30
- setTimeout(fn, 0);
31
- };
32
- } else {
33
- schedule = noAsyncScheduler;
34
- }
35
- module.exports = schedule;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- module.exports =
3
- function(Promise, PromiseArray) {
4
- var PromiseInspection = Promise.PromiseInspection;
5
- var util = require("./util.js");
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
- }
18
- };
19
-
20
- SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
21
- var ret = new PromiseInspection();
22
- ret._bitField = 268435456;
23
- ret._settledValue = value;
24
- this._promiseResolved(index, ret);
25
- };
26
- SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
27
- var ret = new PromiseInspection();
28
- ret._bitField = 134217728;
29
- ret._settledValue = reason;
30
- this._promiseResolved(index, ret);
31
- };
32
-
33
- Promise.settle = function (promises) {
34
- return new SettledPromiseArray(promises).promise();
35
- };
36
-
37
- Promise.prototype.settle = function () {
38
- return new SettledPromiseArray(this).promise();
39
- };
40
- };
@@ -1,125 +0,0 @@
1
- "use strict";
2
- module.exports =
3
- function(Promise, PromiseArray, apiRejection) {
4
- var util = require("./util.js");
5
- var RangeError = require("./errors.js").RangeError;
6
- var AggregateError = require("./errors.js").AggregateError;
7
- var isArray = util.isArray;
8
-
9
-
10
- function SomePromiseArray(values) {
11
- this.constructor$(values);
12
- this._howMany = 0;
13
- this._unwrap = false;
14
- this._initialized = false;
15
- }
16
- util.inherits(SomePromiseArray, PromiseArray);
17
-
18
- SomePromiseArray.prototype._init = function () {
19
- if (!this._initialized) {
20
- return;
21
- }
22
- if (this._howMany === 0) {
23
- this._resolve([]);
24
- return;
25
- }
26
- this._init$(undefined, -5);
27
- var isArrayResolved = isArray(this._values);
28
- if (!this._isResolved() &&
29
- isArrayResolved &&
30
- this._howMany > this._canPossiblyFulfill()) {
31
- this._reject(this._getRangeError(this.length()));
32
- }
33
- };
34
-
35
- SomePromiseArray.prototype.init = function () {
36
- this._initialized = true;
37
- this._init();
38
- };
39
-
40
- SomePromiseArray.prototype.setUnwrap = function () {
41
- this._unwrap = true;
42
- };
43
-
44
- SomePromiseArray.prototype.howMany = function () {
45
- return this._howMany;
46
- };
47
-
48
- SomePromiseArray.prototype.setHowMany = function (count) {
49
- this._howMany = count;
50
- };
51
-
52
- SomePromiseArray.prototype._promiseFulfilled = function (value) {
53
- this._addFulfilled(value);
54
- if (this._fulfilled() === this.howMany()) {
55
- this._values.length = this.howMany();
56
- if (this.howMany() === 1 && this._unwrap) {
57
- this._resolve(this._values[0]);
58
- } else {
59
- this._resolve(this._values);
60
- }
61
- }
62
-
63
- };
64
- SomePromiseArray.prototype._promiseRejected = function (reason) {
65
- this._addRejected(reason);
66
- if (this.howMany() > this._canPossiblyFulfill()) {
67
- var e = new AggregateError();
68
- for (var i = this.length(); i < this._values.length; ++i) {
69
- e.push(this._values[i]);
70
- }
71
- this._reject(e);
72
- }
73
- };
74
-
75
- SomePromiseArray.prototype._fulfilled = function () {
76
- return this._totalResolved;
77
- };
78
-
79
- SomePromiseArray.prototype._rejected = function () {
80
- return this._values.length - this.length();
81
- };
82
-
83
- SomePromiseArray.prototype._addRejected = function (reason) {
84
- this._values.push(reason);
85
- };
86
-
87
- SomePromiseArray.prototype._addFulfilled = function (value) {
88
- this._values[this._totalResolved++] = value;
89
- };
90
-
91
- SomePromiseArray.prototype._canPossiblyFulfill = function () {
92
- return this.length() - this._rejected();
93
- };
94
-
95
- SomePromiseArray.prototype._getRangeError = function (count) {
96
- var message = "Input array must contain at least " +
97
- this._howMany + " items but contains only " + count + " items";
98
- return new RangeError(message);
99
- };
100
-
101
- SomePromiseArray.prototype._resolveEmptyArray = function () {
102
- this._reject(this._getRangeError(0));
103
- };
104
-
105
- function some(promises, howMany) {
106
- if ((howMany | 0) !== howMany || howMany < 0) {
107
- return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/1wAmHx\u000a");
108
- }
109
- var ret = new SomePromiseArray(promises);
110
- var promise = ret.promise();
111
- ret.setHowMany(howMany);
112
- ret.init();
113
- return promise;
114
- }
115
-
116
- Promise.some = function (promises, howMany) {
117
- return some(promises, howMany);
118
- };
119
-
120
- Promise.prototype.some = function (howMany) {
121
- return some(this, howMany);
122
- };
123
-
124
- Promise._SomePromiseArray = SomePromiseArray;
125
- };