browsed 0.2.9 → 0.3.5

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 +28 -28
  3. data/browsed.gemspec +3 -4
  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 +13 -166
  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 -39
@@ -1,46 +0,0 @@
1
- "use strict";
2
- module.exports = function(Promise) {
3
- function returner() {
4
- return this.value;
5
- }
6
- function thrower() {
7
- throw this.reason;
8
- }
9
-
10
- Promise.prototype["return"] =
11
- Promise.prototype.thenReturn = function (value) {
12
- if (value instanceof Promise) value.suppressUnhandledRejections();
13
- return this._then(
14
- returner, undefined, undefined, {value: value}, undefined);
15
- };
16
-
17
- Promise.prototype["throw"] =
18
- Promise.prototype.thenThrow = function (reason) {
19
- return this._then(
20
- thrower, undefined, undefined, {reason: reason}, undefined);
21
- };
22
-
23
- Promise.prototype.catchThrow = function (reason) {
24
- if (arguments.length <= 1) {
25
- return this._then(
26
- undefined, thrower, undefined, {reason: reason}, undefined);
27
- } else {
28
- var _reason = arguments[1];
29
- var handler = function() {throw _reason;};
30
- return this.caught(reason, handler);
31
- }
32
- };
33
-
34
- Promise.prototype.catchReturn = function (value) {
35
- if (arguments.length <= 1) {
36
- if (value instanceof Promise) value.suppressUnhandledRejections();
37
- return this._then(
38
- undefined, returner, undefined, {value: value}, undefined);
39
- } else {
40
- var _value = arguments[1];
41
- if (_value instanceof Promise) _value.suppressUnhandledRejections();
42
- var handler = function() {return _value;};
43
- return this.caught(value, handler);
44
- }
45
- };
46
- };
@@ -1,30 +0,0 @@
1
- "use strict";
2
- module.exports = function(Promise, INTERNAL) {
3
- var PromiseReduce = Promise.reduce;
4
- var PromiseAll = Promise.all;
5
-
6
- function promiseAllThis() {
7
- return PromiseAll(this);
8
- }
9
-
10
- function PromiseMapSeries(promises, fn) {
11
- return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
12
- }
13
-
14
- Promise.prototype.each = function (fn) {
15
- return PromiseReduce(this, fn, INTERNAL, 0)
16
- ._then(promiseAllThis, undefined, undefined, this, undefined);
17
- };
18
-
19
- Promise.prototype.mapSeries = function (fn) {
20
- return PromiseReduce(this, fn, INTERNAL, INTERNAL);
21
- };
22
-
23
- Promise.each = function (promises, fn) {
24
- return PromiseReduce(promises, fn, INTERNAL, 0)
25
- ._then(promiseAllThis, undefined, undefined, promises, undefined);
26
- };
27
-
28
- Promise.mapSeries = PromiseMapSeries;
29
- };
30
-
@@ -1,116 +0,0 @@
1
- "use strict";
2
- var es5 = require("./es5");
3
- var Objectfreeze = es5.freeze;
4
- var util = require("./util");
5
- var inherits = util.inherits;
6
- var notEnumerableProp = util.notEnumerableProp;
7
-
8
- function subError(nameProperty, defaultMessage) {
9
- function SubError(message) {
10
- if (!(this instanceof SubError)) return new SubError(message);
11
- notEnumerableProp(this, "message",
12
- typeof message === "string" ? message : defaultMessage);
13
- notEnumerableProp(this, "name", nameProperty);
14
- if (Error.captureStackTrace) {
15
- Error.captureStackTrace(this, this.constructor);
16
- } else {
17
- Error.call(this);
18
- }
19
- }
20
- inherits(SubError, Error);
21
- return SubError;
22
- }
23
-
24
- var _TypeError, _RangeError;
25
- var Warning = subError("Warning", "warning");
26
- var CancellationError = subError("CancellationError", "cancellation error");
27
- var TimeoutError = subError("TimeoutError", "timeout error");
28
- var AggregateError = subError("AggregateError", "aggregate error");
29
- try {
30
- _TypeError = TypeError;
31
- _RangeError = RangeError;
32
- } catch(e) {
33
- _TypeError = subError("TypeError", "type error");
34
- _RangeError = subError("RangeError", "range error");
35
- }
36
-
37
- var methods = ("join pop push shift unshift slice filter forEach some " +
38
- "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
39
-
40
- for (var i = 0; i < methods.length; ++i) {
41
- if (typeof Array.prototype[methods[i]] === "function") {
42
- AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
43
- }
44
- }
45
-
46
- es5.defineProperty(AggregateError.prototype, "length", {
47
- value: 0,
48
- configurable: false,
49
- writable: true,
50
- enumerable: true
51
- });
52
- AggregateError.prototype["isOperational"] = true;
53
- var level = 0;
54
- AggregateError.prototype.toString = function() {
55
- var indent = Array(level * 4 + 1).join(" ");
56
- var ret = "\n" + indent + "AggregateError of:" + "\n";
57
- level++;
58
- indent = Array(level * 4 + 1).join(" ");
59
- for (var i = 0; i < this.length; ++i) {
60
- var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
61
- var lines = str.split("\n");
62
- for (var j = 0; j < lines.length; ++j) {
63
- lines[j] = indent + lines[j];
64
- }
65
- str = lines.join("\n");
66
- ret += str + "\n";
67
- }
68
- level--;
69
- return ret;
70
- };
71
-
72
- function OperationalError(message) {
73
- if (!(this instanceof OperationalError))
74
- return new OperationalError(message);
75
- notEnumerableProp(this, "name", "OperationalError");
76
- notEnumerableProp(this, "message", message);
77
- this.cause = message;
78
- this["isOperational"] = true;
79
-
80
- if (message instanceof Error) {
81
- notEnumerableProp(this, "message", message.message);
82
- notEnumerableProp(this, "stack", message.stack);
83
- } else if (Error.captureStackTrace) {
84
- Error.captureStackTrace(this, this.constructor);
85
- }
86
-
87
- }
88
- inherits(OperationalError, Error);
89
-
90
- var errorTypes = Error["__BluebirdErrorTypes__"];
91
- if (!errorTypes) {
92
- errorTypes = Objectfreeze({
93
- CancellationError: CancellationError,
94
- TimeoutError: TimeoutError,
95
- OperationalError: OperationalError,
96
- RejectionError: OperationalError,
97
- AggregateError: AggregateError
98
- });
99
- es5.defineProperty(Error, "__BluebirdErrorTypes__", {
100
- value: errorTypes,
101
- writable: false,
102
- enumerable: false,
103
- configurable: false
104
- });
105
- }
106
-
107
- module.exports = {
108
- Error: Error,
109
- TypeError: _TypeError,
110
- RangeError: _RangeError,
111
- CancellationError: errorTypes.CancellationError,
112
- OperationalError: errorTypes.OperationalError,
113
- TimeoutError: errorTypes.TimeoutError,
114
- AggregateError: errorTypes.AggregateError,
115
- Warning: Warning
116
- };
@@ -1,80 +0,0 @@
1
- var isES5 = (function(){
2
- "use strict";
3
- return this === undefined;
4
- })();
5
-
6
- if (isES5) {
7
- module.exports = {
8
- freeze: Object.freeze,
9
- defineProperty: Object.defineProperty,
10
- getDescriptor: Object.getOwnPropertyDescriptor,
11
- keys: Object.keys,
12
- names: Object.getOwnPropertyNames,
13
- getPrototypeOf: Object.getPrototypeOf,
14
- isArray: Array.isArray,
15
- isES5: isES5,
16
- propertyIsWritable: function(obj, prop) {
17
- var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
18
- return !!(!descriptor || descriptor.writable || descriptor.set);
19
- }
20
- };
21
- } else {
22
- var has = {}.hasOwnProperty;
23
- var str = {}.toString;
24
- var proto = {}.constructor.prototype;
25
-
26
- var ObjectKeys = function (o) {
27
- var ret = [];
28
- for (var key in o) {
29
- if (has.call(o, key)) {
30
- ret.push(key);
31
- }
32
- }
33
- return ret;
34
- };
35
-
36
- var ObjectGetDescriptor = function(o, key) {
37
- return {value: o[key]};
38
- };
39
-
40
- var ObjectDefineProperty = function (o, key, desc) {
41
- o[key] = desc.value;
42
- return o;
43
- };
44
-
45
- var ObjectFreeze = function (obj) {
46
- return obj;
47
- };
48
-
49
- var ObjectGetPrototypeOf = function (obj) {
50
- try {
51
- return Object(obj).constructor.prototype;
52
- }
53
- catch (e) {
54
- return proto;
55
- }
56
- };
57
-
58
- var ArrayIsArray = function (obj) {
59
- try {
60
- return str.call(obj) === "[object Array]";
61
- }
62
- catch(e) {
63
- return false;
64
- }
65
- };
66
-
67
- module.exports = {
68
- isArray: ArrayIsArray,
69
- keys: ObjectKeys,
70
- names: ObjectKeys,
71
- defineProperty: ObjectDefineProperty,
72
- getDescriptor: ObjectGetDescriptor,
73
- freeze: ObjectFreeze,
74
- getPrototypeOf: ObjectGetPrototypeOf,
75
- isES5: isES5,
76
- propertyIsWritable: function() {
77
- return true;
78
- }
79
- };
80
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- module.exports = function(Promise, INTERNAL) {
3
- var PromiseMap = Promise.map;
4
-
5
- Promise.prototype.filter = function (fn, options) {
6
- return PromiseMap(this, fn, options, INTERNAL);
7
- };
8
-
9
- Promise.filter = function (promises, fn, options) {
10
- return PromiseMap(promises, fn, options, INTERNAL);
11
- };
12
- };
@@ -1,146 +0,0 @@
1
- "use strict";
2
- module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) {
3
- var util = require("./util");
4
- var CancellationError = Promise.CancellationError;
5
- var errorObj = util.errorObj;
6
- var catchFilter = require("./catch_filter")(NEXT_FILTER);
7
-
8
- function PassThroughHandlerContext(promise, type, handler) {
9
- this.promise = promise;
10
- this.type = type;
11
- this.handler = handler;
12
- this.called = false;
13
- this.cancelPromise = null;
14
- }
15
-
16
- PassThroughHandlerContext.prototype.isFinallyHandler = function() {
17
- return this.type === 0;
18
- };
19
-
20
- function FinallyHandlerCancelReaction(finallyHandler) {
21
- this.finallyHandler = finallyHandler;
22
- }
23
-
24
- FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
25
- checkCancel(this.finallyHandler);
26
- };
27
-
28
- function checkCancel(ctx, reason) {
29
- if (ctx.cancelPromise != null) {
30
- if (arguments.length > 1) {
31
- ctx.cancelPromise._reject(reason);
32
- } else {
33
- ctx.cancelPromise._cancel();
34
- }
35
- ctx.cancelPromise = null;
36
- return true;
37
- }
38
- return false;
39
- }
40
-
41
- function succeed() {
42
- return finallyHandler.call(this, this.promise._target()._settledValue());
43
- }
44
- function fail(reason) {
45
- if (checkCancel(this, reason)) return;
46
- errorObj.e = reason;
47
- return errorObj;
48
- }
49
- function finallyHandler(reasonOrValue) {
50
- var promise = this.promise;
51
- var handler = this.handler;
52
-
53
- if (!this.called) {
54
- this.called = true;
55
- var ret = this.isFinallyHandler()
56
- ? handler.call(promise._boundValue())
57
- : handler.call(promise._boundValue(), reasonOrValue);
58
- if (ret === NEXT_FILTER) {
59
- return ret;
60
- } else if (ret !== undefined) {
61
- promise._setReturnedNonUndefined();
62
- var maybePromise = tryConvertToPromise(ret, promise);
63
- if (maybePromise instanceof Promise) {
64
- if (this.cancelPromise != null) {
65
- if (maybePromise._isCancelled()) {
66
- var reason =
67
- new CancellationError("late cancellation observer");
68
- promise._attachExtraTrace(reason);
69
- errorObj.e = reason;
70
- return errorObj;
71
- } else if (maybePromise.isPending()) {
72
- maybePromise._attachCancellationCallback(
73
- new FinallyHandlerCancelReaction(this));
74
- }
75
- }
76
- return maybePromise._then(
77
- succeed, fail, undefined, this, undefined);
78
- }
79
- }
80
- }
81
-
82
- if (promise.isRejected()) {
83
- checkCancel(this);
84
- errorObj.e = reasonOrValue;
85
- return errorObj;
86
- } else {
87
- checkCancel(this);
88
- return reasonOrValue;
89
- }
90
- }
91
-
92
- Promise.prototype._passThrough = function(handler, type, success, fail) {
93
- if (typeof handler !== "function") return this.then();
94
- return this._then(success,
95
- fail,
96
- undefined,
97
- new PassThroughHandlerContext(this, type, handler),
98
- undefined);
99
- };
100
-
101
- Promise.prototype.lastly =
102
- Promise.prototype["finally"] = function (handler) {
103
- return this._passThrough(handler,
104
- 0,
105
- finallyHandler,
106
- finallyHandler);
107
- };
108
-
109
-
110
- Promise.prototype.tap = function (handler) {
111
- return this._passThrough(handler, 1, finallyHandler);
112
- };
113
-
114
- Promise.prototype.tapCatch = function (handlerOrPredicate) {
115
- var len = arguments.length;
116
- if(len === 1) {
117
- return this._passThrough(handlerOrPredicate,
118
- 1,
119
- undefined,
120
- finallyHandler);
121
- } else {
122
- var catchInstances = new Array(len - 1),
123
- j = 0, i;
124
- for (i = 0; i < len - 1; ++i) {
125
- var item = arguments[i];
126
- if (util.isObject(item)) {
127
- catchInstances[j++] = item;
128
- } else {
129
- return Promise.reject(new TypeError(
130
- "tapCatch statement predicate: "
131
- + "expecting an object but got " + util.classString(item)
132
- ));
133
- }
134
- }
135
- catchInstances.length = j;
136
- var handler = arguments[i];
137
- return this._passThrough(catchFilter(catchInstances, handler, this),
138
- 1,
139
- undefined,
140
- finallyHandler);
141
- }
142
-
143
- };
144
-
145
- return PassThroughHandlerContext;
146
- };
@@ -1,223 +0,0 @@
1
- "use strict";
2
- module.exports = function(Promise,
3
- apiRejection,
4
- INTERNAL,
5
- tryConvertToPromise,
6
- Proxyable,
7
- debug) {
8
- var errors = require("./errors");
9
- var TypeError = errors.TypeError;
10
- var util = require("./util");
11
- var errorObj = util.errorObj;
12
- var tryCatch = util.tryCatch;
13
- var yieldHandlers = [];
14
-
15
- function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
16
- for (var i = 0; i < yieldHandlers.length; ++i) {
17
- traceParent._pushContext();
18
- var result = tryCatch(yieldHandlers[i])(value);
19
- traceParent._popContext();
20
- if (result === errorObj) {
21
- traceParent._pushContext();
22
- var ret = Promise.reject(errorObj.e);
23
- traceParent._popContext();
24
- return ret;
25
- }
26
- var maybePromise = tryConvertToPromise(result, traceParent);
27
- if (maybePromise instanceof Promise) return maybePromise;
28
- }
29
- return null;
30
- }
31
-
32
- function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
33
- if (debug.cancellation()) {
34
- var internal = new Promise(INTERNAL);
35
- var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);
36
- this._promise = internal.lastly(function() {
37
- return _finallyPromise;
38
- });
39
- internal._captureStackTrace();
40
- internal._setOnCancel(this);
41
- } else {
42
- var promise = this._promise = new Promise(INTERNAL);
43
- promise._captureStackTrace();
44
- }
45
- this._stack = stack;
46
- this._generatorFunction = generatorFunction;
47
- this._receiver = receiver;
48
- this._generator = undefined;
49
- this._yieldHandlers = typeof yieldHandler === "function"
50
- ? [yieldHandler].concat(yieldHandlers)
51
- : yieldHandlers;
52
- this._yieldedPromise = null;
53
- this._cancellationPhase = false;
54
- }
55
- util.inherits(PromiseSpawn, Proxyable);
56
-
57
- PromiseSpawn.prototype._isResolved = function() {
58
- return this._promise === null;
59
- };
60
-
61
- PromiseSpawn.prototype._cleanup = function() {
62
- this._promise = this._generator = null;
63
- if (debug.cancellation() && this._finallyPromise !== null) {
64
- this._finallyPromise._fulfill();
65
- this._finallyPromise = null;
66
- }
67
- };
68
-
69
- PromiseSpawn.prototype._promiseCancelled = function() {
70
- if (this._isResolved()) return;
71
- var implementsReturn = typeof this._generator["return"] !== "undefined";
72
-
73
- var result;
74
- if (!implementsReturn) {
75
- var reason = new Promise.CancellationError(
76
- "generator .return() sentinel");
77
- Promise.coroutine.returnSentinel = reason;
78
- this._promise._attachExtraTrace(reason);
79
- this._promise._pushContext();
80
- result = tryCatch(this._generator["throw"]).call(this._generator,
81
- reason);
82
- this._promise._popContext();
83
- } else {
84
- this._promise._pushContext();
85
- result = tryCatch(this._generator["return"]).call(this._generator,
86
- undefined);
87
- this._promise._popContext();
88
- }
89
- this._cancellationPhase = true;
90
- this._yieldedPromise = null;
91
- this._continue(result);
92
- };
93
-
94
- PromiseSpawn.prototype._promiseFulfilled = function(value) {
95
- this._yieldedPromise = null;
96
- this._promise._pushContext();
97
- var result = tryCatch(this._generator.next).call(this._generator, value);
98
- this._promise._popContext();
99
- this._continue(result);
100
- };
101
-
102
- PromiseSpawn.prototype._promiseRejected = function(reason) {
103
- this._yieldedPromise = null;
104
- this._promise._attachExtraTrace(reason);
105
- this._promise._pushContext();
106
- var result = tryCatch(this._generator["throw"])
107
- .call(this._generator, reason);
108
- this._promise._popContext();
109
- this._continue(result);
110
- };
111
-
112
- PromiseSpawn.prototype._resultCancelled = function() {
113
- if (this._yieldedPromise instanceof Promise) {
114
- var promise = this._yieldedPromise;
115
- this._yieldedPromise = null;
116
- promise.cancel();
117
- }
118
- };
119
-
120
- PromiseSpawn.prototype.promise = function () {
121
- return this._promise;
122
- };
123
-
124
- PromiseSpawn.prototype._run = function () {
125
- this._generator = this._generatorFunction.call(this._receiver);
126
- this._receiver =
127
- this._generatorFunction = undefined;
128
- this._promiseFulfilled(undefined);
129
- };
130
-
131
- PromiseSpawn.prototype._continue = function (result) {
132
- var promise = this._promise;
133
- if (result === errorObj) {
134
- this._cleanup();
135
- if (this._cancellationPhase) {
136
- return promise.cancel();
137
- } else {
138
- return promise._rejectCallback(result.e, false);
139
- }
140
- }
141
-
142
- var value = result.value;
143
- if (result.done === true) {
144
- this._cleanup();
145
- if (this._cancellationPhase) {
146
- return promise.cancel();
147
- } else {
148
- return promise._resolveCallback(value);
149
- }
150
- } else {
151
- var maybePromise = tryConvertToPromise(value, this._promise);
152
- if (!(maybePromise instanceof Promise)) {
153
- maybePromise =
154
- promiseFromYieldHandler(maybePromise,
155
- this._yieldHandlers,
156
- this._promise);
157
- if (maybePromise === null) {
158
- this._promiseRejected(
159
- new TypeError(
160
- "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) +
161
- "From coroutine:\u000a" +
162
- this._stack.split("\n").slice(1, -7).join("\n")
163
- )
164
- );
165
- return;
166
- }
167
- }
168
- maybePromise = maybePromise._target();
169
- var bitField = maybePromise._bitField;
170
- ;
171
- if (((bitField & 50397184) === 0)) {
172
- this._yieldedPromise = maybePromise;
173
- maybePromise._proxy(this, null);
174
- } else if (((bitField & 33554432) !== 0)) {
175
- Promise._async.invoke(
176
- this._promiseFulfilled, this, maybePromise._value()
177
- );
178
- } else if (((bitField & 16777216) !== 0)) {
179
- Promise._async.invoke(
180
- this._promiseRejected, this, maybePromise._reason()
181
- );
182
- } else {
183
- this._promiseCancelled();
184
- }
185
- }
186
- };
187
-
188
- Promise.coroutine = function (generatorFunction, options) {
189
- if (typeof generatorFunction !== "function") {
190
- throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
191
- }
192
- var yieldHandler = Object(options).yieldHandler;
193
- var PromiseSpawn$ = PromiseSpawn;
194
- var stack = new Error().stack;
195
- return function () {
196
- var generator = generatorFunction.apply(this, arguments);
197
- var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
198
- stack);
199
- var ret = spawn.promise();
200
- spawn._generator = generator;
201
- spawn._promiseFulfilled(undefined);
202
- return ret;
203
- };
204
- };
205
-
206
- Promise.coroutine.addYieldHandler = function(fn) {
207
- if (typeof fn !== "function") {
208
- throw new TypeError("expecting a function but got " + util.classString(fn));
209
- }
210
- yieldHandlers.push(fn);
211
- };
212
-
213
- Promise.spawn = function (generatorFunction) {
214
- debug.deprecated("Promise.spawn()", "Promise.coroutine()");
215
- if (typeof generatorFunction !== "function") {
216
- return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
217
- }
218
- var spawn = new PromiseSpawn(generatorFunction, this);
219
- var ret = spawn.promise();
220
- spawn._run(Promise.spawn);
221
- return ret;
222
- };
223
- };