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,789 +0,0 @@
1
- "use strict";
2
- module.exports = function() {
3
- var makeSelfResolutionError = function () {
4
- return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a");
5
- };
6
- var reflectHandler = function() {
7
- return new Promise.PromiseInspection(this._target());
8
- };
9
- var apiRejection = function(msg) {
10
- return Promise.reject(new TypeError(msg));
11
- };
12
- function Proxyable() {}
13
- var UNDEFINED_BINDING = {};
14
- var util = require("./util");
15
-
16
- var getDomain;
17
- if (util.isNode) {
18
- getDomain = function() {
19
- var ret = process.domain;
20
- if (ret === undefined) ret = null;
21
- return ret;
22
- };
23
- } else {
24
- getDomain = function() {
25
- return null;
26
- };
27
- }
28
- util.notEnumerableProp(Promise, "_getDomain", getDomain);
29
-
30
- var es5 = require("./es5");
31
- var Async = require("./async");
32
- var async = new Async();
33
- es5.defineProperty(Promise, "_async", {value: async});
34
- var errors = require("./errors");
35
- var TypeError = Promise.TypeError = errors.TypeError;
36
- Promise.RangeError = errors.RangeError;
37
- var CancellationError = Promise.CancellationError = errors.CancellationError;
38
- Promise.TimeoutError = errors.TimeoutError;
39
- Promise.OperationalError = errors.OperationalError;
40
- Promise.RejectionError = errors.OperationalError;
41
- Promise.AggregateError = errors.AggregateError;
42
- var INTERNAL = function(){};
43
- var APPLY = {};
44
- var NEXT_FILTER = {};
45
- var tryConvertToPromise = require("./thenables")(Promise, INTERNAL);
46
- var PromiseArray =
47
- require("./promise_array")(Promise, INTERNAL,
48
- tryConvertToPromise, apiRejection, Proxyable);
49
- var Context = require("./context")(Promise);
50
- /*jshint unused:false*/
51
- var createContext = Context.create;
52
- var debug = require("./debuggability")(Promise, Context);
53
- var CapturedTrace = debug.CapturedTrace;
54
- var PassThroughHandlerContext =
55
- require("./finally")(Promise, tryConvertToPromise, NEXT_FILTER);
56
- var catchFilter = require("./catch_filter")(NEXT_FILTER);
57
- var nodebackForPromise = require("./nodeback");
58
- var errorObj = util.errorObj;
59
- var tryCatch = util.tryCatch;
60
- function check(self, executor) {
61
- if (self == null || self.constructor !== Promise) {
62
- throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a");
63
- }
64
- if (typeof executor !== "function") {
65
- throw new TypeError("expecting a function but got " + util.classString(executor));
66
- }
67
-
68
- }
69
-
70
- function Promise(executor) {
71
- if (executor !== INTERNAL) {
72
- check(this, executor);
73
- }
74
- this._bitField = 0;
75
- this._fulfillmentHandler0 = undefined;
76
- this._rejectionHandler0 = undefined;
77
- this._promise0 = undefined;
78
- this._receiver0 = undefined;
79
- this._resolveFromExecutor(executor);
80
- this._promiseCreated();
81
- this._fireEvent("promiseCreated", this);
82
- }
83
-
84
- Promise.prototype.toString = function () {
85
- return "[object Promise]";
86
- };
87
-
88
- Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
89
- var len = arguments.length;
90
- if (len > 1) {
91
- var catchInstances = new Array(len - 1),
92
- j = 0, i;
93
- for (i = 0; i < len - 1; ++i) {
94
- var item = arguments[i];
95
- if (util.isObject(item)) {
96
- catchInstances[j++] = item;
97
- } else {
98
- return apiRejection("Catch statement predicate: " +
99
- "expecting an object but got " + util.classString(item));
100
- }
101
- }
102
- catchInstances.length = j;
103
- fn = arguments[i];
104
-
105
- if (typeof fn !== "function") {
106
- throw new TypeError("The last argument to .catch() " +
107
- "must be a function, got " + util.toString(fn));
108
- }
109
- return this.then(undefined, catchFilter(catchInstances, fn, this));
110
- }
111
- return this.then(undefined, fn);
112
- };
113
-
114
- Promise.prototype.reflect = function () {
115
- return this._then(reflectHandler,
116
- reflectHandler, undefined, this, undefined);
117
- };
118
-
119
- Promise.prototype.then = function (didFulfill, didReject) {
120
- if (debug.warnings() && arguments.length > 0 &&
121
- typeof didFulfill !== "function" &&
122
- typeof didReject !== "function") {
123
- var msg = ".then() only accepts functions but was passed: " +
124
- util.classString(didFulfill);
125
- if (arguments.length > 1) {
126
- msg += ", " + util.classString(didReject);
127
- }
128
- this._warn(msg);
129
- }
130
- return this._then(didFulfill, didReject, undefined, undefined, undefined);
131
- };
132
-
133
- Promise.prototype.done = function (didFulfill, didReject) {
134
- var promise =
135
- this._then(didFulfill, didReject, undefined, undefined, undefined);
136
- promise._setIsFinal();
137
- };
138
-
139
- Promise.prototype.spread = function (fn) {
140
- if (typeof fn !== "function") {
141
- return apiRejection("expecting a function but got " + util.classString(fn));
142
- }
143
- return this.all()._then(fn, undefined, undefined, APPLY, undefined);
144
- };
145
-
146
- Promise.prototype.toJSON = function () {
147
- var ret = {
148
- isFulfilled: false,
149
- isRejected: false,
150
- fulfillmentValue: undefined,
151
- rejectionReason: undefined
152
- };
153
- if (this.isFulfilled()) {
154
- ret.fulfillmentValue = this.value();
155
- ret.isFulfilled = true;
156
- } else if (this.isRejected()) {
157
- ret.rejectionReason = this.reason();
158
- ret.isRejected = true;
159
- }
160
- return ret;
161
- };
162
-
163
- Promise.prototype.all = function () {
164
- if (arguments.length > 0) {
165
- this._warn(".all() was passed arguments but it does not take any");
166
- }
167
- return new PromiseArray(this).promise();
168
- };
169
-
170
- Promise.prototype.error = function (fn) {
171
- return this.caught(util.originatesFromRejection, fn);
172
- };
173
-
174
- Promise.getNewLibraryCopy = module.exports;
175
-
176
- Promise.is = function (val) {
177
- return val instanceof Promise;
178
- };
179
-
180
- Promise.fromNode = Promise.fromCallback = function(fn) {
181
- var ret = new Promise(INTERNAL);
182
- ret._captureStackTrace();
183
- var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
184
- : false;
185
- var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
186
- if (result === errorObj) {
187
- ret._rejectCallback(result.e, true);
188
- }
189
- if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
190
- return ret;
191
- };
192
-
193
- Promise.all = function (promises) {
194
- return new PromiseArray(promises).promise();
195
- };
196
-
197
- Promise.cast = function (obj) {
198
- var ret = tryConvertToPromise(obj);
199
- if (!(ret instanceof Promise)) {
200
- ret = new Promise(INTERNAL);
201
- ret._captureStackTrace();
202
- ret._setFulfilled();
203
- ret._rejectionHandler0 = obj;
204
- }
205
- return ret;
206
- };
207
-
208
- Promise.resolve = Promise.fulfilled = Promise.cast;
209
-
210
- Promise.reject = Promise.rejected = function (reason) {
211
- var ret = new Promise(INTERNAL);
212
- ret._captureStackTrace();
213
- ret._rejectCallback(reason, true);
214
- return ret;
215
- };
216
-
217
- Promise.setScheduler = function(fn) {
218
- if (typeof fn !== "function") {
219
- throw new TypeError("expecting a function but got " + util.classString(fn));
220
- }
221
- return async.setScheduler(fn);
222
- };
223
-
224
- Promise.prototype._then = function (
225
- didFulfill,
226
- didReject,
227
- _, receiver,
228
- internalData
229
- ) {
230
- var haveInternalData = internalData !== undefined;
231
- var promise = haveInternalData ? internalData : new Promise(INTERNAL);
232
- var target = this._target();
233
- var bitField = target._bitField;
234
-
235
- if (!haveInternalData) {
236
- promise._propagateFrom(this, 3);
237
- promise._captureStackTrace();
238
- if (receiver === undefined &&
239
- ((this._bitField & 2097152) !== 0)) {
240
- if (!((bitField & 50397184) === 0)) {
241
- receiver = this._boundValue();
242
- } else {
243
- receiver = target === this ? undefined : this._boundTo;
244
- }
245
- }
246
- this._fireEvent("promiseChained", this, promise);
247
- }
248
-
249
- var domain = getDomain();
250
- if (!((bitField & 50397184) === 0)) {
251
- var handler, value, settler = target._settlePromiseCtx;
252
- if (((bitField & 33554432) !== 0)) {
253
- value = target._rejectionHandler0;
254
- handler = didFulfill;
255
- } else if (((bitField & 16777216) !== 0)) {
256
- value = target._fulfillmentHandler0;
257
- handler = didReject;
258
- target._unsetRejectionIsUnhandled();
259
- } else {
260
- settler = target._settlePromiseLateCancellationObserver;
261
- value = new CancellationError("late cancellation observer");
262
- target._attachExtraTrace(value);
263
- handler = didReject;
264
- }
265
-
266
- async.invoke(settler, target, {
267
- handler: domain === null ? handler
268
- : (typeof handler === "function" &&
269
- util.domainBind(domain, handler)),
270
- promise: promise,
271
- receiver: receiver,
272
- value: value
273
- });
274
- } else {
275
- target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
276
- }
277
-
278
- return promise;
279
- };
280
-
281
- Promise.prototype._length = function () {
282
- return this._bitField & 65535;
283
- };
284
-
285
- Promise.prototype._isFateSealed = function () {
286
- return (this._bitField & 117506048) !== 0;
287
- };
288
-
289
- Promise.prototype._isFollowing = function () {
290
- return (this._bitField & 67108864) === 67108864;
291
- };
292
-
293
- Promise.prototype._setLength = function (len) {
294
- this._bitField = (this._bitField & -65536) |
295
- (len & 65535);
296
- };
297
-
298
- Promise.prototype._setFulfilled = function () {
299
- this._bitField = this._bitField | 33554432;
300
- this._fireEvent("promiseFulfilled", this);
301
- };
302
-
303
- Promise.prototype._setRejected = function () {
304
- this._bitField = this._bitField | 16777216;
305
- this._fireEvent("promiseRejected", this);
306
- };
307
-
308
- Promise.prototype._setFollowing = function () {
309
- this._bitField = this._bitField | 67108864;
310
- this._fireEvent("promiseResolved", this);
311
- };
312
-
313
- Promise.prototype._setIsFinal = function () {
314
- this._bitField = this._bitField | 4194304;
315
- };
316
-
317
- Promise.prototype._isFinal = function () {
318
- return (this._bitField & 4194304) > 0;
319
- };
320
-
321
- Promise.prototype._unsetCancelled = function() {
322
- this._bitField = this._bitField & (~65536);
323
- };
324
-
325
- Promise.prototype._setCancelled = function() {
326
- this._bitField = this._bitField | 65536;
327
- this._fireEvent("promiseCancelled", this);
328
- };
329
-
330
- Promise.prototype._setWillBeCancelled = function() {
331
- this._bitField = this._bitField | 8388608;
332
- };
333
-
334
- Promise.prototype._setAsyncGuaranteed = function() {
335
- if (async.hasCustomScheduler()) return;
336
- this._bitField = this._bitField | 134217728;
337
- };
338
-
339
- Promise.prototype._receiverAt = function (index) {
340
- var ret = index === 0 ? this._receiver0 : this[
341
- index * 4 - 4 + 3];
342
- if (ret === UNDEFINED_BINDING) {
343
- return undefined;
344
- } else if (ret === undefined && this._isBound()) {
345
- return this._boundValue();
346
- }
347
- return ret;
348
- };
349
-
350
- Promise.prototype._promiseAt = function (index) {
351
- return this[
352
- index * 4 - 4 + 2];
353
- };
354
-
355
- Promise.prototype._fulfillmentHandlerAt = function (index) {
356
- return this[
357
- index * 4 - 4 + 0];
358
- };
359
-
360
- Promise.prototype._rejectionHandlerAt = function (index) {
361
- return this[
362
- index * 4 - 4 + 1];
363
- };
364
-
365
- Promise.prototype._boundValue = function() {};
366
-
367
- Promise.prototype._migrateCallback0 = function (follower) {
368
- var bitField = follower._bitField;
369
- var fulfill = follower._fulfillmentHandler0;
370
- var reject = follower._rejectionHandler0;
371
- var promise = follower._promise0;
372
- var receiver = follower._receiverAt(0);
373
- if (receiver === undefined) receiver = UNDEFINED_BINDING;
374
- this._addCallbacks(fulfill, reject, promise, receiver, null);
375
- };
376
-
377
- Promise.prototype._migrateCallbackAt = function (follower, index) {
378
- var fulfill = follower._fulfillmentHandlerAt(index);
379
- var reject = follower._rejectionHandlerAt(index);
380
- var promise = follower._promiseAt(index);
381
- var receiver = follower._receiverAt(index);
382
- if (receiver === undefined) receiver = UNDEFINED_BINDING;
383
- this._addCallbacks(fulfill, reject, promise, receiver, null);
384
- };
385
-
386
- Promise.prototype._addCallbacks = function (
387
- fulfill,
388
- reject,
389
- promise,
390
- receiver,
391
- domain
392
- ) {
393
- var index = this._length();
394
-
395
- if (index >= 65535 - 4) {
396
- index = 0;
397
- this._setLength(0);
398
- }
399
-
400
- if (index === 0) {
401
- this._promise0 = promise;
402
- this._receiver0 = receiver;
403
- if (typeof fulfill === "function") {
404
- this._fulfillmentHandler0 =
405
- domain === null ? fulfill : util.domainBind(domain, fulfill);
406
- }
407
- if (typeof reject === "function") {
408
- this._rejectionHandler0 =
409
- domain === null ? reject : util.domainBind(domain, reject);
410
- }
411
- } else {
412
- var base = index * 4 - 4;
413
- this[base + 2] = promise;
414
- this[base + 3] = receiver;
415
- if (typeof fulfill === "function") {
416
- this[base + 0] =
417
- domain === null ? fulfill : util.domainBind(domain, fulfill);
418
- }
419
- if (typeof reject === "function") {
420
- this[base + 1] =
421
- domain === null ? reject : util.domainBind(domain, reject);
422
- }
423
- }
424
- this._setLength(index + 1);
425
- return index;
426
- };
427
-
428
- Promise.prototype._proxy = function (proxyable, arg) {
429
- this._addCallbacks(undefined, undefined, arg, proxyable, null);
430
- };
431
-
432
- Promise.prototype._resolveCallback = function(value, shouldBind) {
433
- if (((this._bitField & 117506048) !== 0)) return;
434
- if (value === this)
435
- return this._rejectCallback(makeSelfResolutionError(), false);
436
- var maybePromise = tryConvertToPromise(value, this);
437
- if (!(maybePromise instanceof Promise)) return this._fulfill(value);
438
-
439
- if (shouldBind) this._propagateFrom(maybePromise, 2);
440
-
441
- var promise = maybePromise._target();
442
-
443
- if (promise === this) {
444
- this._reject(makeSelfResolutionError());
445
- return;
446
- }
447
-
448
- var bitField = promise._bitField;
449
- if (((bitField & 50397184) === 0)) {
450
- var len = this._length();
451
- if (len > 0) promise._migrateCallback0(this);
452
- for (var i = 1; i < len; ++i) {
453
- promise._migrateCallbackAt(this, i);
454
- }
455
- this._setFollowing();
456
- this._setLength(0);
457
- this._setFollowee(promise);
458
- } else if (((bitField & 33554432) !== 0)) {
459
- this._fulfill(promise._value());
460
- } else if (((bitField & 16777216) !== 0)) {
461
- this._reject(promise._reason());
462
- } else {
463
- var reason = new CancellationError("late cancellation observer");
464
- promise._attachExtraTrace(reason);
465
- this._reject(reason);
466
- }
467
- };
468
-
469
- Promise.prototype._rejectCallback =
470
- function(reason, synchronous, ignoreNonErrorWarnings) {
471
- var trace = util.ensureErrorObject(reason);
472
- var hasStack = trace === reason;
473
- if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
474
- var message = "a promise was rejected with a non-error: " +
475
- util.classString(reason);
476
- this._warn(message, true);
477
- }
478
- this._attachExtraTrace(trace, synchronous ? hasStack : false);
479
- this._reject(reason);
480
- };
481
-
482
- Promise.prototype._resolveFromExecutor = function (executor) {
483
- if (executor === INTERNAL) return;
484
- var promise = this;
485
- this._captureStackTrace();
486
- this._pushContext();
487
- var synchronous = true;
488
- var r = this._execute(executor, function(value) {
489
- promise._resolveCallback(value);
490
- }, function (reason) {
491
- promise._rejectCallback(reason, synchronous);
492
- });
493
- synchronous = false;
494
- this._popContext();
495
-
496
- if (r !== undefined) {
497
- promise._rejectCallback(r, true);
498
- }
499
- };
500
-
501
- Promise.prototype._settlePromiseFromHandler = function (
502
- handler, receiver, value, promise
503
- ) {
504
- var bitField = promise._bitField;
505
- if (((bitField & 65536) !== 0)) return;
506
- promise._pushContext();
507
- var x;
508
- if (receiver === APPLY) {
509
- if (!value || typeof value.length !== "number") {
510
- x = errorObj;
511
- x.e = new TypeError("cannot .spread() a non-array: " +
512
- util.classString(value));
513
- } else {
514
- x = tryCatch(handler).apply(this._boundValue(), value);
515
- }
516
- } else {
517
- x = tryCatch(handler).call(receiver, value);
518
- }
519
- var promiseCreated = promise._popContext();
520
- bitField = promise._bitField;
521
- if (((bitField & 65536) !== 0)) return;
522
-
523
- if (x === NEXT_FILTER) {
524
- promise._reject(value);
525
- } else if (x === errorObj) {
526
- promise._rejectCallback(x.e, false);
527
- } else {
528
- debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
529
- promise._resolveCallback(x);
530
- }
531
- };
532
-
533
- Promise.prototype._target = function() {
534
- var ret = this;
535
- while (ret._isFollowing()) ret = ret._followee();
536
- return ret;
537
- };
538
-
539
- Promise.prototype._followee = function() {
540
- return this._rejectionHandler0;
541
- };
542
-
543
- Promise.prototype._setFollowee = function(promise) {
544
- this._rejectionHandler0 = promise;
545
- };
546
-
547
- Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
548
- var isPromise = promise instanceof Promise;
549
- var bitField = this._bitField;
550
- var asyncGuaranteed = ((bitField & 134217728) !== 0);
551
- if (((bitField & 65536) !== 0)) {
552
- if (isPromise) promise._invokeInternalOnCancel();
553
-
554
- if (receiver instanceof PassThroughHandlerContext &&
555
- receiver.isFinallyHandler()) {
556
- receiver.cancelPromise = promise;
557
- if (tryCatch(handler).call(receiver, value) === errorObj) {
558
- promise._reject(errorObj.e);
559
- }
560
- } else if (handler === reflectHandler) {
561
- promise._fulfill(reflectHandler.call(receiver));
562
- } else if (receiver instanceof Proxyable) {
563
- receiver._promiseCancelled(promise);
564
- } else if (isPromise || promise instanceof PromiseArray) {
565
- promise._cancel();
566
- } else {
567
- receiver.cancel();
568
- }
569
- } else if (typeof handler === "function") {
570
- if (!isPromise) {
571
- handler.call(receiver, value, promise);
572
- } else {
573
- if (asyncGuaranteed) promise._setAsyncGuaranteed();
574
- this._settlePromiseFromHandler(handler, receiver, value, promise);
575
- }
576
- } else if (receiver instanceof Proxyable) {
577
- if (!receiver._isResolved()) {
578
- if (((bitField & 33554432) !== 0)) {
579
- receiver._promiseFulfilled(value, promise);
580
- } else {
581
- receiver._promiseRejected(value, promise);
582
- }
583
- }
584
- } else if (isPromise) {
585
- if (asyncGuaranteed) promise._setAsyncGuaranteed();
586
- if (((bitField & 33554432) !== 0)) {
587
- promise._fulfill(value);
588
- } else {
589
- promise._reject(value);
590
- }
591
- }
592
- };
593
-
594
- Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
595
- var handler = ctx.handler;
596
- var promise = ctx.promise;
597
- var receiver = ctx.receiver;
598
- var value = ctx.value;
599
- if (typeof handler === "function") {
600
- if (!(promise instanceof Promise)) {
601
- handler.call(receiver, value, promise);
602
- } else {
603
- this._settlePromiseFromHandler(handler, receiver, value, promise);
604
- }
605
- } else if (promise instanceof Promise) {
606
- promise._reject(value);
607
- }
608
- };
609
-
610
- Promise.prototype._settlePromiseCtx = function(ctx) {
611
- this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
612
- };
613
-
614
- Promise.prototype._settlePromise0 = function(handler, value, bitField) {
615
- var promise = this._promise0;
616
- var receiver = this._receiverAt(0);
617
- this._promise0 = undefined;
618
- this._receiver0 = undefined;
619
- this._settlePromise(promise, handler, receiver, value);
620
- };
621
-
622
- Promise.prototype._clearCallbackDataAtIndex = function(index) {
623
- var base = index * 4 - 4;
624
- this[base + 2] =
625
- this[base + 3] =
626
- this[base + 0] =
627
- this[base + 1] = undefined;
628
- };
629
-
630
- Promise.prototype._fulfill = function (value) {
631
- var bitField = this._bitField;
632
- if (((bitField & 117506048) >>> 16)) return;
633
- if (value === this) {
634
- var err = makeSelfResolutionError();
635
- this._attachExtraTrace(err);
636
- return this._reject(err);
637
- }
638
- this._setFulfilled();
639
- this._rejectionHandler0 = value;
640
-
641
- if ((bitField & 65535) > 0) {
642
- if (((bitField & 134217728) !== 0)) {
643
- this._settlePromises();
644
- } else {
645
- async.settlePromises(this);
646
- }
647
- this._dereferenceTrace();
648
- }
649
- };
650
-
651
- Promise.prototype._reject = function (reason) {
652
- var bitField = this._bitField;
653
- if (((bitField & 117506048) >>> 16)) return;
654
- this._setRejected();
655
- this._fulfillmentHandler0 = reason;
656
-
657
- if (this._isFinal()) {
658
- return async.fatalError(reason, util.isNode);
659
- }
660
-
661
- if ((bitField & 65535) > 0) {
662
- async.settlePromises(this);
663
- } else {
664
- this._ensurePossibleRejectionHandled();
665
- }
666
- };
667
-
668
- Promise.prototype._fulfillPromises = function (len, value) {
669
- for (var i = 1; i < len; i++) {
670
- var handler = this._fulfillmentHandlerAt(i);
671
- var promise = this._promiseAt(i);
672
- var receiver = this._receiverAt(i);
673
- this._clearCallbackDataAtIndex(i);
674
- this._settlePromise(promise, handler, receiver, value);
675
- }
676
- };
677
-
678
- Promise.prototype._rejectPromises = function (len, reason) {
679
- for (var i = 1; i < len; i++) {
680
- var handler = this._rejectionHandlerAt(i);
681
- var promise = this._promiseAt(i);
682
- var receiver = this._receiverAt(i);
683
- this._clearCallbackDataAtIndex(i);
684
- this._settlePromise(promise, handler, receiver, reason);
685
- }
686
- };
687
-
688
- Promise.prototype._settlePromises = function () {
689
- var bitField = this._bitField;
690
- var len = (bitField & 65535);
691
-
692
- if (len > 0) {
693
- if (((bitField & 16842752) !== 0)) {
694
- var reason = this._fulfillmentHandler0;
695
- this._settlePromise0(this._rejectionHandler0, reason, bitField);
696
- this._rejectPromises(len, reason);
697
- } else {
698
- var value = this._rejectionHandler0;
699
- this._settlePromise0(this._fulfillmentHandler0, value, bitField);
700
- this._fulfillPromises(len, value);
701
- }
702
- this._setLength(0);
703
- }
704
- this._clearCancellationData();
705
- };
706
-
707
- Promise.prototype._settledValue = function() {
708
- var bitField = this._bitField;
709
- if (((bitField & 33554432) !== 0)) {
710
- return this._rejectionHandler0;
711
- } else if (((bitField & 16777216) !== 0)) {
712
- return this._fulfillmentHandler0;
713
- }
714
- };
715
-
716
- if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
717
- es5.defineProperty(Promise.prototype, Symbol.toStringTag, {
718
- get: function () {
719
- return "Object";
720
- }
721
- });
722
- }
723
-
724
- function deferResolve(v) {this.promise._resolveCallback(v);}
725
- function deferReject(v) {this.promise._rejectCallback(v, false);}
726
-
727
- Promise.defer = Promise.pending = function() {
728
- debug.deprecated("Promise.defer", "new Promise");
729
- var promise = new Promise(INTERNAL);
730
- return {
731
- promise: promise,
732
- resolve: deferResolve,
733
- reject: deferReject
734
- };
735
- };
736
-
737
- util.notEnumerableProp(Promise,
738
- "_makeSelfResolutionError",
739
- makeSelfResolutionError);
740
-
741
- require("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection,
742
- debug);
743
- require("./bind")(Promise, INTERNAL, tryConvertToPromise, debug);
744
- require("./cancel")(Promise, PromiseArray, apiRejection, debug);
745
- require("./direct_resolve")(Promise);
746
- require("./synchronous_inspection")(Promise);
747
- require("./join")(
748
- Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
749
- Promise.Promise = Promise;
750
- Promise.version = "3.5.5";
751
- require('./call_get.js')(Promise);
752
- require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
753
- require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
754
- require('./nodeify.js')(Promise);
755
- require('./promisify.js')(Promise, INTERNAL);
756
- require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
757
- require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
758
- require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
759
- require('./settle.js')(Promise, PromiseArray, debug);
760
- require('./some.js')(Promise, PromiseArray, apiRejection);
761
- require('./timers.js')(Promise, INTERNAL, debug);
762
- require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
763
- require('./any.js')(Promise);
764
- require('./each.js')(Promise, INTERNAL);
765
- require('./filter.js')(Promise, INTERNAL);
766
-
767
- util.toFastProperties(Promise);
768
- util.toFastProperties(Promise.prototype);
769
- function fillTypes(value) {
770
- var p = new Promise(INTERNAL);
771
- p._fulfillmentHandler0 = value;
772
- p._rejectionHandler0 = value;
773
- p._promise0 = value;
774
- p._receiver0 = value;
775
- }
776
- // Complete slack tracking, opt out of field-type tracking and
777
- // stabilize map
778
- fillTypes({a: 1});
779
- fillTypes({b: 2});
780
- fillTypes({c: 3});
781
- fillTypes(1);
782
- fillTypes(function(){});
783
- fillTypes(undefined);
784
- fillTypes(false);
785
- fillTypes(new Promise(INTERNAL));
786
- debug.setBounds(Async.firstLineError, util.lastLineError);
787
- return Promise;
788
-
789
- };