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,118 +0,0 @@
1
- "use strict";
2
- module.exports = function(
3
- Promise, PromiseArray, tryConvertToPromise, apiRejection) {
4
- var util = require("./util");
5
- var isObject = util.isObject;
6
- var es5 = require("./es5");
7
- var Es6Map;
8
- if (typeof Map === "function") Es6Map = Map;
9
-
10
- var mapToEntries = (function() {
11
- var index = 0;
12
- var size = 0;
13
-
14
- function extractEntry(value, key) {
15
- this[index] = value;
16
- this[index + size] = key;
17
- index++;
18
- }
19
-
20
- return function mapToEntries(map) {
21
- size = map.size;
22
- index = 0;
23
- var ret = new Array(map.size * 2);
24
- map.forEach(extractEntry, ret);
25
- return ret;
26
- };
27
- })();
28
-
29
- var entriesToMap = function(entries) {
30
- var ret = new Es6Map();
31
- var length = entries.length / 2 | 0;
32
- for (var i = 0; i < length; ++i) {
33
- var key = entries[length + i];
34
- var value = entries[i];
35
- ret.set(key, value);
36
- }
37
- return ret;
38
- };
39
-
40
- function PropertiesPromiseArray(obj) {
41
- var isMap = false;
42
- var entries;
43
- if (Es6Map !== undefined && obj instanceof Es6Map) {
44
- entries = mapToEntries(obj);
45
- isMap = true;
46
- } else {
47
- var keys = es5.keys(obj);
48
- var len = keys.length;
49
- entries = new Array(len * 2);
50
- for (var i = 0; i < len; ++i) {
51
- var key = keys[i];
52
- entries[i] = obj[key];
53
- entries[i + len] = key;
54
- }
55
- }
56
- this.constructor$(entries);
57
- this._isMap = isMap;
58
- this._init$(undefined, isMap ? -6 : -3);
59
- }
60
- util.inherits(PropertiesPromiseArray, PromiseArray);
61
-
62
- PropertiesPromiseArray.prototype._init = function () {};
63
-
64
- PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
65
- this._values[index] = value;
66
- var totalResolved = ++this._totalResolved;
67
- if (totalResolved >= this._length) {
68
- var val;
69
- if (this._isMap) {
70
- val = entriesToMap(this._values);
71
- } else {
72
- val = {};
73
- var keyOffset = this.length();
74
- for (var i = 0, len = this.length(); i < len; ++i) {
75
- val[this._values[i + keyOffset]] = this._values[i];
76
- }
77
- }
78
- this._resolve(val);
79
- return true;
80
- }
81
- return false;
82
- };
83
-
84
- PropertiesPromiseArray.prototype.shouldCopyValues = function () {
85
- return false;
86
- };
87
-
88
- PropertiesPromiseArray.prototype.getActualLength = function (len) {
89
- return len >> 1;
90
- };
91
-
92
- function props(promises) {
93
- var ret;
94
- var castValue = tryConvertToPromise(promises);
95
-
96
- if (!isObject(castValue)) {
97
- return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a");
98
- } else if (castValue instanceof Promise) {
99
- ret = castValue._then(
100
- Promise.props, undefined, undefined, undefined, undefined);
101
- } else {
102
- ret = new PropertiesPromiseArray(castValue).promise();
103
- }
104
-
105
- if (castValue instanceof Promise) {
106
- ret._propagateFrom(castValue, 2);
107
- }
108
- return ret;
109
- }
110
-
111
- Promise.prototype.props = function () {
112
- return props(this);
113
- };
114
-
115
- Promise.props = function (promises) {
116
- return props(promises);
117
- };
118
- };
@@ -1,73 +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.push = function (fn, receiver, arg) {
28
- var length = this.length() + 3;
29
- if (this._willBeOverCapacity(length)) {
30
- this._pushOne(fn);
31
- this._pushOne(receiver);
32
- this._pushOne(arg);
33
- return;
34
- }
35
- var j = this._front + length - 3;
36
- this._checkCapacity(length);
37
- var wrapMask = this._capacity - 1;
38
- this[(j + 0) & wrapMask] = fn;
39
- this[(j + 1) & wrapMask] = receiver;
40
- this[(j + 2) & wrapMask] = arg;
41
- this._length = length;
42
- };
43
-
44
- Queue.prototype.shift = function () {
45
- var front = this._front,
46
- ret = this[front];
47
-
48
- this[front] = undefined;
49
- this._front = (front + 1) & (this._capacity - 1);
50
- this._length--;
51
- return ret;
52
- };
53
-
54
- Queue.prototype.length = function () {
55
- return this._length;
56
- };
57
-
58
- Queue.prototype._checkCapacity = function (size) {
59
- if (this._capacity < size) {
60
- this._resizeTo(this._capacity << 1);
61
- }
62
- };
63
-
64
- Queue.prototype._resizeTo = function (capacity) {
65
- var oldCapacity = this._capacity;
66
- this._capacity = capacity;
67
- var front = this._front;
68
- var length = this._length;
69
- var moveItemsCount = (front + length) & (oldCapacity - 1);
70
- arrayMove(this, 0, this, oldCapacity, moveItemsCount);
71
- };
72
-
73
- module.exports = Queue;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- module.exports = function(
3
- Promise, INTERNAL, tryConvertToPromise, apiRejection) {
4
- var util = require("./util");
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 {
18
- promises = util.asArray(promises);
19
- if (promises === null)
20
- return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
21
- }
22
-
23
- var ret = new Promise(INTERNAL);
24
- if (parent !== undefined) {
25
- ret._propagateFrom(parent, 3);
26
- }
27
- var fulfill = ret._fulfill;
28
- var reject = ret._reject;
29
- for (var i = 0, len = promises.length; i < len; ++i) {
30
- var val = promises[i];
31
-
32
- if (val === undefined && !(i in promises)) {
33
- continue;
34
- }
35
-
36
- Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
37
- }
38
- return ret;
39
- }
40
-
41
- Promise.race = function (promises) {
42
- return race(promises, undefined);
43
- };
44
-
45
- Promise.prototype.race = function () {
46
- return race(this, undefined);
47
- };
48
-
49
- };
@@ -1,172 +0,0 @@
1
- "use strict";
2
- module.exports = function(Promise,
3
- PromiseArray,
4
- apiRejection,
5
- tryConvertToPromise,
6
- INTERNAL,
7
- debug) {
8
- var getDomain = Promise._getDomain;
9
- var util = require("./util");
10
- var tryCatch = util.tryCatch;
11
-
12
- function ReductionPromiseArray(promises, fn, initialValue, _each) {
13
- this.constructor$(promises);
14
- var domain = getDomain();
15
- this._fn = domain === null ? fn : util.domainBind(domain, fn);
16
- if (initialValue !== undefined) {
17
- initialValue = Promise.resolve(initialValue);
18
- initialValue._attachCancellationCallback(this);
19
- }
20
- this._initialValue = initialValue;
21
- this._currentCancellable = null;
22
- if(_each === INTERNAL) {
23
- this._eachValues = Array(this._length);
24
- } else if (_each === 0) {
25
- this._eachValues = null;
26
- } else {
27
- this._eachValues = undefined;
28
- }
29
- this._promise._captureStackTrace();
30
- this._init$(undefined, -5);
31
- }
32
- util.inherits(ReductionPromiseArray, PromiseArray);
33
-
34
- ReductionPromiseArray.prototype._gotAccum = function(accum) {
35
- if (this._eachValues !== undefined &&
36
- this._eachValues !== null &&
37
- accum !== INTERNAL) {
38
- this._eachValues.push(accum);
39
- }
40
- };
41
-
42
- ReductionPromiseArray.prototype._eachComplete = function(value) {
43
- if (this._eachValues !== null) {
44
- this._eachValues.push(value);
45
- }
46
- return this._eachValues;
47
- };
48
-
49
- ReductionPromiseArray.prototype._init = function() {};
50
-
51
- ReductionPromiseArray.prototype._resolveEmptyArray = function() {
52
- this._resolve(this._eachValues !== undefined ? this._eachValues
53
- : this._initialValue);
54
- };
55
-
56
- ReductionPromiseArray.prototype.shouldCopyValues = function () {
57
- return false;
58
- };
59
-
60
- ReductionPromiseArray.prototype._resolve = function(value) {
61
- this._promise._resolveCallback(value);
62
- this._values = null;
63
- };
64
-
65
- ReductionPromiseArray.prototype._resultCancelled = function(sender) {
66
- if (sender === this._initialValue) return this._cancel();
67
- if (this._isResolved()) return;
68
- this._resultCancelled$();
69
- if (this._currentCancellable instanceof Promise) {
70
- this._currentCancellable.cancel();
71
- }
72
- if (this._initialValue instanceof Promise) {
73
- this._initialValue.cancel();
74
- }
75
- };
76
-
77
- ReductionPromiseArray.prototype._iterate = function (values) {
78
- this._values = values;
79
- var value;
80
- var i;
81
- var length = values.length;
82
- if (this._initialValue !== undefined) {
83
- value = this._initialValue;
84
- i = 0;
85
- } else {
86
- value = Promise.resolve(values[0]);
87
- i = 1;
88
- }
89
-
90
- this._currentCancellable = value;
91
-
92
- if (!value.isRejected()) {
93
- for (; i < length; ++i) {
94
- var ctx = {
95
- accum: null,
96
- value: values[i],
97
- index: i,
98
- length: length,
99
- array: this
100
- };
101
- value = value._then(gotAccum, undefined, undefined, ctx, undefined);
102
- }
103
- }
104
-
105
- if (this._eachValues !== undefined) {
106
- value = value
107
- ._then(this._eachComplete, undefined, undefined, this, undefined);
108
- }
109
- value._then(completed, completed, undefined, value, this);
110
- };
111
-
112
- Promise.prototype.reduce = function (fn, initialValue) {
113
- return reduce(this, fn, initialValue, null);
114
- };
115
-
116
- Promise.reduce = function (promises, fn, initialValue, _each) {
117
- return reduce(promises, fn, initialValue, _each);
118
- };
119
-
120
- function completed(valueOrReason, array) {
121
- if (this.isFulfilled()) {
122
- array._resolve(valueOrReason);
123
- } else {
124
- array._reject(valueOrReason);
125
- }
126
- }
127
-
128
- function reduce(promises, fn, initialValue, _each) {
129
- if (typeof fn !== "function") {
130
- return apiRejection("expecting a function but got " + util.classString(fn));
131
- }
132
- var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
133
- return array.promise();
134
- }
135
-
136
- function gotAccum(accum) {
137
- this.accum = accum;
138
- this.array._gotAccum(accum);
139
- var value = tryConvertToPromise(this.value, this.array._promise);
140
- if (value instanceof Promise) {
141
- this.array._currentCancellable = value;
142
- return value._then(gotValue, undefined, undefined, this, undefined);
143
- } else {
144
- return gotValue.call(this, value);
145
- }
146
- }
147
-
148
- function gotValue(value) {
149
- var array = this.array;
150
- var promise = array._promise;
151
- var fn = tryCatch(array._fn);
152
- promise._pushContext();
153
- var ret;
154
- if (array._eachValues !== undefined) {
155
- ret = fn.call(promise._boundValue(), value, this.index, this.length);
156
- } else {
157
- ret = fn.call(promise._boundValue(),
158
- this.accum, value, this.index, this.length);
159
- }
160
- if (ret instanceof Promise) {
161
- array._currentCancellable = ret;
162
- }
163
- var promiseCreated = promise._popContext();
164
- debug.checkForgottenReturns(
165
- ret,
166
- promiseCreated,
167
- array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
168
- promise
169
- );
170
- return ret;
171
- }
172
- };
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var util = require("./util");
3
- var schedule;
4
- var noAsyncScheduler = function() {
5
- throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
6
- };
7
- var NativePromise = util.getNativePromise();
8
- if (util.isNode && typeof MutationObserver === "undefined") {
9
- var GlobalSetImmediate = global.setImmediate;
10
- var ProcessNextTick = process.nextTick;
11
- schedule = util.isRecentNode
12
- ? function(fn) { GlobalSetImmediate.call(global, fn); }
13
- : function(fn) { ProcessNextTick.call(process, fn); };
14
- } else if (typeof NativePromise === "function" &&
15
- typeof NativePromise.resolve === "function") {
16
- var nativePromise = NativePromise.resolve();
17
- schedule = function(fn) {
18
- nativePromise.then(fn);
19
- };
20
- } else if ((typeof MutationObserver !== "undefined") &&
21
- !(typeof window !== "undefined" &&
22
- window.navigator &&
23
- (window.navigator.standalone || window.cordova)) &&
24
- ("classList" in document.documentElement)) {
25
- schedule = (function() {
26
- var div = document.createElement("div");
27
- var opts = {attributes: true};
28
- var toggleScheduled = false;
29
- var div2 = document.createElement("div");
30
- var o2 = new MutationObserver(function() {
31
- div.classList.toggle("foo");
32
- toggleScheduled = false;
33
- });
34
- o2.observe(div2, opts);
35
-
36
- var scheduleToggle = function() {
37
- if (toggleScheduled) return;
38
- toggleScheduled = true;
39
- div2.classList.toggle("foo");
40
- };
41
-
42
- return function schedule(fn) {
43
- var o = new MutationObserver(function() {
44
- o.disconnect();
45
- fn();
46
- });
47
- o.observe(div, opts);
48
- scheduleToggle();
49
- };
50
- })();
51
- } else if (typeof setImmediate !== "undefined") {
52
- schedule = function (fn) {
53
- setImmediate(fn);
54
- };
55
- } else if (typeof setTimeout !== "undefined") {
56
- schedule = function (fn) {
57
- setTimeout(fn, 0);
58
- };
59
- } else {
60
- schedule = noAsyncScheduler;
61
- }
62
- module.exports = schedule;