browsed 0.2.8 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) 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/browser.rb +2 -2
  6. data/lib/browsed/chrome.rb +2 -2
  7. data/lib/browsed/client.rb +4 -3
  8. data/lib/browsed/firefox.rb +2 -2
  9. data/lib/browsed/version.rb +1 -1
  10. metadata +13 -166
  11. data/lib/browsed/proxies/proxy-chain-server/node_modules/.bin/portastic +0 -1
  12. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/LICENSE +0 -21
  13. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/README.md +0 -57
  14. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/changelog.md +0 -1
  15. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.js +0 -3824
  16. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.min.js +0 -31
  17. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.js +0 -5666
  18. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
  19. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/any.js +0 -21
  20. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/assert.js +0 -55
  21. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/async.js +0 -165
  22. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bind.js +0 -67
  23. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bluebird.js +0 -11
  24. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/call_get.js +0 -123
  25. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/cancel.js +0 -129
  26. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/catch_filter.js +0 -42
  27. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/context.js +0 -69
  28. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/debuggability.js +0 -934
  29. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/direct_resolve.js +0 -46
  30. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/each.js +0 -30
  31. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/errors.js +0 -116
  32. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/es5.js +0 -80
  33. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/filter.js +0 -12
  34. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/finally.js +0 -146
  35. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/generators.js +0 -223
  36. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/join.js +0 -168
  37. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/map.js +0 -168
  38. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/method.js +0 -55
  39. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeback.js +0 -51
  40. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeify.js +0 -58
  41. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise.js +0 -789
  42. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise_array.js +0 -185
  43. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promisify.js +0 -314
  44. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/props.js +0 -118
  45. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/queue.js +0 -73
  46. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/race.js +0 -49
  47. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/reduce.js +0 -172
  48. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/schedule.js +0 -62
  49. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/settle.js +0 -43
  50. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/some.js +0 -148
  51. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/synchronous_inspection.js +0 -103
  52. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/thenables.js +0 -86
  53. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/timers.js +0 -93
  54. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/using.js +0 -226
  55. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/util.js +0 -389
  56. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/package.json +0 -102
  57. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/CHANGELOG.md +0 -408
  58. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/LICENSE +0 -22
  59. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/Readme.md +0 -428
  60. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/index.js +0 -1224
  61. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/package.json +0 -70
  62. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/typings/index.d.ts +0 -310
  63. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.coveralls.yml +0 -1
  64. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.eslintrc +0 -11
  65. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.npmignore +0 -9
  66. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.travis.yml +0 -14
  67. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/CHANGELOG.md +0 -362
  68. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/LICENSE +0 -19
  69. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/Makefile +0 -50
  70. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/README.md +0 -312
  71. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/component.json +0 -19
  72. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/karma.conf.js +0 -70
  73. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/node.js +0 -1
  74. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/package.json +0 -88
  75. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/browser.js +0 -185
  76. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/debug.js +0 -202
  77. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/index.js +0 -10
  78. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/inspector-log.js +0 -15
  79. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/node.js +0 -248
  80. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/index.js +0 -152
  81. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/license.md +0 -21
  82. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/package.json +0 -69
  83. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/readme.md +0 -51
  84. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/LICENSE +0 -13
  85. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/README.md +0 -148
  86. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic +0 -65
  87. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/history.md +0 -7
  88. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/index.js +0 -4
  89. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/monitor.js +0 -59
  90. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/portastic.js +0 -167
  91. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/LICENSE +0 -21
  92. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/README.md +0 -677
  93. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/changelog.md +0 -1730
  94. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.js +0 -4892
  95. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
  96. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/any.js +0 -21
  97. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/assert.js +0 -55
  98. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/async.js +0 -150
  99. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bind.js +0 -72
  100. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bluebird.js +0 -11
  101. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/call_get.js +0 -123
  102. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/cancel.js +0 -48
  103. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/captured_trace.js +0 -493
  104. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/catch_filter.js +0 -66
  105. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js +0 -38
  106. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/debuggability.js +0 -162
  107. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/direct_resolve.js +0 -63
  108. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/each.js +0 -12
  109. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/errors.js +0 -111
  110. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/es5.js +0 -80
  111. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/filter.js +0 -12
  112. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/finally.js +0 -98
  113. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/generators.js +0 -136
  114. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/join.js +0 -107
  115. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/map.js +0 -133
  116. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/method.js +0 -44
  117. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/nodeify.js +0 -59
  118. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/progress.js +0 -76
  119. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise.js +0 -759
  120. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_array.js +0 -142
  121. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_resolver.js +0 -123
  122. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promisify.js +0 -307
  123. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/props.js +0 -79
  124. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/queue.js +0 -90
  125. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/race.js +0 -47
  126. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/reduce.js +0 -148
  127. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/schedule.js +0 -35
  128. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/settle.js +0 -40
  129. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/some.js +0 -125
  130. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/synchronous_inspection.js +0 -94
  131. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/thenables.js +0 -84
  132. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/timers.js +0 -64
  133. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/using.js +0 -213
  134. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/util.js +0 -321
  135. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/package.json +0 -103
  136. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/package.json +0 -69
  137. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/CHANGELOG.md +0 -109
  138. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/LICENSE +0 -201
  139. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/README.md +0 -278
  140. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/anonymize_proxy.js +0 -100
  141. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_base.js +0 -319
  142. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_custom_response.js +0 -96
  143. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_forward.js +0 -173
  144. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_chain.js +0 -132
  145. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_direct.js +0 -89
  146. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_tcp_chain.js +0 -271
  147. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/index.js +0 -26
  148. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/run_locally.js +0 -66
  149. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/server.js +0 -595
  150. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tcp_tunnel.js +0 -138
  151. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/testing_tcp_service.js +0 -37
  152. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tools.js +0 -220
  153. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/package.json +0 -104
  154. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/LICENSE +0 -23
  155. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/README.md +0 -28
  156. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/package.json +0 -81
  157. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js +0 -5
  158. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js.map +0 -1
  159. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore.js +0 -1692
  160. data/lib/browsed/proxies/proxy-chain-server/package-lock.json +0 -63
  161. data/lib/browsed/proxies/proxy-chain-server/package.json +0 -15
  162. data/lib/browsed/proxies/proxy-chain-server/server.js +0 -25
  163. data/lib/browsed/proxies/proxy_chain.rb +0 -39
@@ -1,66 +0,0 @@
1
- "use strict";
2
- module.exports = function(NEXT_FILTER) {
3
- var util = require("./util.js");
4
- var errors = require("./errors.js");
5
- var tryCatch = util.tryCatch;
6
- var errorObj = util.errorObj;
7
- var keys = require("./es5.js").keys;
8
- var TypeError = errors.TypeError;
9
-
10
- function CatchFilter(instances, callback, promise) {
11
- this._instances = instances;
12
- this._callback = callback;
13
- this._promise = promise;
14
- }
15
-
16
- function safePredicate(predicate, e) {
17
- var safeObject = {};
18
- var retfilter = tryCatch(predicate).call(safeObject, e);
19
-
20
- if (retfilter === errorObj) return retfilter;
21
-
22
- var safeKeys = keys(safeObject);
23
- if (safeKeys.length) {
24
- errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a");
25
- return errorObj;
26
- }
27
- return retfilter;
28
- }
29
-
30
- CatchFilter.prototype.doFilter = function (e) {
31
- var cb = this._callback;
32
- var promise = this._promise;
33
- var boundTo = promise._boundValue();
34
- for (var i = 0, len = this._instances.length; i < len; ++i) {
35
- var item = this._instances[i];
36
- var itemIsErrorType = item === Error ||
37
- (item != null && item.prototype instanceof Error);
38
-
39
- if (itemIsErrorType && e instanceof item) {
40
- var ret = tryCatch(cb).call(boundTo, e);
41
- if (ret === errorObj) {
42
- NEXT_FILTER.e = ret.e;
43
- return NEXT_FILTER;
44
- }
45
- return ret;
46
- } else if (typeof item === "function" && !itemIsErrorType) {
47
- var shouldHandle = safePredicate(item, e);
48
- if (shouldHandle === errorObj) {
49
- e = errorObj.e;
50
- break;
51
- } else if (shouldHandle) {
52
- var ret = tryCatch(cb).call(boundTo, e);
53
- if (ret === errorObj) {
54
- NEXT_FILTER.e = ret.e;
55
- return NEXT_FILTER;
56
- }
57
- return ret;
58
- }
59
- }
60
- }
61
- NEXT_FILTER.e = e;
62
- return NEXT_FILTER;
63
- };
64
-
65
- return CatchFilter;
66
- };
@@ -1,38 +0,0 @@
1
- "use strict";
2
- module.exports = function(Promise, CapturedTrace, isDebugging) {
3
- var contextStack = [];
4
- function Context() {
5
- this._trace = new CapturedTrace(peekContext());
6
- }
7
- Context.prototype._pushContext = function () {
8
- if (!isDebugging()) return;
9
- if (this._trace !== undefined) {
10
- contextStack.push(this._trace);
11
- }
12
- };
13
-
14
- Context.prototype._popContext = function () {
15
- if (!isDebugging()) return;
16
- if (this._trace !== undefined) {
17
- contextStack.pop();
18
- }
19
- };
20
-
21
- function createContext() {
22
- if (isDebugging()) return new Context();
23
- }
24
-
25
- function peekContext() {
26
- var lastIndex = contextStack.length - 1;
27
- if (lastIndex >= 0) {
28
- return contextStack[lastIndex];
29
- }
30
- return undefined;
31
- }
32
-
33
- Promise.prototype._peekContext = peekContext;
34
- Promise.prototype._pushContext = Context.prototype._pushContext;
35
- Promise.prototype._popContext = Context.prototype._popContext;
36
-
37
- return createContext;
38
- };
@@ -1,162 +0,0 @@
1
- "use strict";
2
- module.exports = function(Promise, CapturedTrace) {
3
- var getDomain = Promise._getDomain;
4
- var async = require("./async.js");
5
- var Warning = require("./errors.js").Warning;
6
- var util = require("./util.js");
7
- var canAttachTrace = util.canAttachTrace;
8
- var unhandledRejectionHandled;
9
- var possiblyUnhandledRejection;
10
- var debugging = false || (util.isNode &&
11
- (!!process.env["BLUEBIRD_DEBUG"] ||
12
- process.env["NODE_ENV"] === "development"));
13
-
14
- if (util.isNode && process.env["BLUEBIRD_DEBUG"] == 0) debugging = false;
15
-
16
- if (debugging) {
17
- async.disableTrampolineIfNecessary();
18
- }
19
-
20
- Promise.prototype._ignoreRejections = function() {
21
- this._unsetRejectionIsUnhandled();
22
- this._bitField = this._bitField | 16777216;
23
- };
24
-
25
- Promise.prototype._ensurePossibleRejectionHandled = function () {
26
- if ((this._bitField & 16777216) !== 0) return;
27
- this._setRejectionIsUnhandled();
28
- async.invokeLater(this._notifyUnhandledRejection, this, undefined);
29
- };
30
-
31
- Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
32
- CapturedTrace.fireRejectionEvent("rejectionHandled",
33
- unhandledRejectionHandled, undefined, this);
34
- };
35
-
36
- Promise.prototype._notifyUnhandledRejection = function () {
37
- if (this._isRejectionUnhandled()) {
38
- var reason = this._getCarriedStackTrace() || this._settledValue;
39
- this._setUnhandledRejectionIsNotified();
40
- CapturedTrace.fireRejectionEvent("unhandledRejection",
41
- possiblyUnhandledRejection, reason, this);
42
- }
43
- };
44
-
45
- Promise.prototype._setUnhandledRejectionIsNotified = function () {
46
- this._bitField = this._bitField | 524288;
47
- };
48
-
49
- Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
50
- this._bitField = this._bitField & (~524288);
51
- };
52
-
53
- Promise.prototype._isUnhandledRejectionNotified = function () {
54
- return (this._bitField & 524288) > 0;
55
- };
56
-
57
- Promise.prototype._setRejectionIsUnhandled = function () {
58
- this._bitField = this._bitField | 2097152;
59
- };
60
-
61
- Promise.prototype._unsetRejectionIsUnhandled = function () {
62
- this._bitField = this._bitField & (~2097152);
63
- if (this._isUnhandledRejectionNotified()) {
64
- this._unsetUnhandledRejectionIsNotified();
65
- this._notifyUnhandledRejectionIsHandled();
66
- }
67
- };
68
-
69
- Promise.prototype._isRejectionUnhandled = function () {
70
- return (this._bitField & 2097152) > 0;
71
- };
72
-
73
- Promise.prototype._setCarriedStackTrace = function (capturedTrace) {
74
- this._bitField = this._bitField | 1048576;
75
- this._fulfillmentHandler0 = capturedTrace;
76
- };
77
-
78
- Promise.prototype._isCarryingStackTrace = function () {
79
- return (this._bitField & 1048576) > 0;
80
- };
81
-
82
- Promise.prototype._getCarriedStackTrace = function () {
83
- return this._isCarryingStackTrace()
84
- ? this._fulfillmentHandler0
85
- : undefined;
86
- };
87
-
88
- Promise.prototype._captureStackTrace = function () {
89
- if (debugging) {
90
- this._trace = new CapturedTrace(this._peekContext());
91
- }
92
- return this;
93
- };
94
-
95
- Promise.prototype._attachExtraTrace = function (error, ignoreSelf) {
96
- if (debugging && canAttachTrace(error)) {
97
- var trace = this._trace;
98
- if (trace !== undefined) {
99
- if (ignoreSelf) trace = trace._parent;
100
- }
101
- if (trace !== undefined) {
102
- trace.attachExtraTrace(error);
103
- } else if (!error.__stackCleaned__) {
104
- var parsed = CapturedTrace.parseStackAndMessage(error);
105
- util.notEnumerableProp(error, "stack",
106
- parsed.message + "\n" + parsed.stack.join("\n"));
107
- util.notEnumerableProp(error, "__stackCleaned__", true);
108
- }
109
- }
110
- };
111
-
112
- Promise.prototype._warn = function(message) {
113
- var warning = new Warning(message);
114
- var ctx = this._peekContext();
115
- if (ctx) {
116
- ctx.attachExtraTrace(warning);
117
- } else {
118
- var parsed = CapturedTrace.parseStackAndMessage(warning);
119
- warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
120
- }
121
- CapturedTrace.formatAndLogError(warning, "");
122
- };
123
-
124
- Promise.onPossiblyUnhandledRejection = function (fn) {
125
- var domain = getDomain();
126
- possiblyUnhandledRejection =
127
- typeof fn === "function" ? (domain === null ? fn : domain.bind(fn))
128
- : undefined;
129
- };
130
-
131
- Promise.onUnhandledRejectionHandled = function (fn) {
132
- var domain = getDomain();
133
- unhandledRejectionHandled =
134
- typeof fn === "function" ? (domain === null ? fn : domain.bind(fn))
135
- : undefined;
136
- };
137
-
138
- Promise.longStackTraces = function () {
139
- if (async.haveItemsQueued() &&
140
- debugging === false
141
- ) {
142
- throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/DT1qyG\u000a");
143
- }
144
- debugging = CapturedTrace.isSupported();
145
- if (debugging) {
146
- async.disableTrampolineIfNecessary();
147
- }
148
- };
149
-
150
- Promise.hasLongStackTraces = function () {
151
- return debugging && CapturedTrace.isSupported();
152
- };
153
-
154
- if (!CapturedTrace.isSupported()) {
155
- Promise.longStackTraces = function(){};
156
- debugging = false;
157
- }
158
-
159
- return function() {
160
- return debugging;
161
- };
162
- };
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var util = require("./util.js");
3
- var isPrimitive = util.isPrimitive;
4
-
5
- module.exports = function(Promise) {
6
- var returner = function () {
7
- return this;
8
- };
9
- var thrower = function () {
10
- throw this;
11
- };
12
- var returnUndefined = function() {};
13
- var throwUndefined = function() {
14
- throw undefined;
15
- };
16
-
17
- var wrapper = function (value, action) {
18
- if (action === 1) {
19
- return function () {
20
- throw value;
21
- };
22
- } else if (action === 2) {
23
- return function () {
24
- return value;
25
- };
26
- }
27
- };
28
-
29
-
30
- Promise.prototype["return"] =
31
- Promise.prototype.thenReturn = function (value) {
32
- if (value === undefined) return this.then(returnUndefined);
33
-
34
- if (isPrimitive(value)) {
35
- return this._then(
36
- wrapper(value, 2),
37
- undefined,
38
- undefined,
39
- undefined,
40
- undefined
41
- );
42
- } else if (value instanceof Promise) {
43
- value._ignoreRejections();
44
- }
45
- return this._then(returner, undefined, undefined, value, undefined);
46
- };
47
-
48
- Promise.prototype["throw"] =
49
- Promise.prototype.thenThrow = function (reason) {
50
- if (reason === undefined) return this.then(throwUndefined);
51
-
52
- if (isPrimitive(reason)) {
53
- return this._then(
54
- wrapper(reason, 1),
55
- undefined,
56
- undefined,
57
- undefined,
58
- undefined
59
- );
60
- }
61
- return this._then(thrower, undefined, undefined, reason, undefined);
62
- };
63
- };
@@ -1,12 +0,0 @@
1
- "use strict";
2
- module.exports = function(Promise, INTERNAL) {
3
- var PromiseReduce = Promise.reduce;
4
-
5
- Promise.prototype.each = function (fn) {
6
- return PromiseReduce(this, fn, null, INTERNAL);
7
- };
8
-
9
- Promise.each = function (promises, fn) {
10
- return PromiseReduce(promises, fn, null, INTERNAL);
11
- };
12
- };
@@ -1,111 +0,0 @@
1
- "use strict";
2
- var es5 = require("./es5.js");
3
- var Objectfreeze = es5.freeze;
4
- var util = require("./util.js");
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
- notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes);
100
- }
101
-
102
- module.exports = {
103
- Error: Error,
104
- TypeError: _TypeError,
105
- RangeError: _RangeError,
106
- CancellationError: errorTypes.CancellationError,
107
- OperationalError: errorTypes.OperationalError,
108
- TimeoutError: errorTypes.TimeoutError,
109
- AggregateError: errorTypes.AggregateError,
110
- Warning: Warning
111
- };