browsed 0.3.0 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +27 -27
  3. data/browsed.gemspec +2 -3
  4. data/lib/browsed.rb +1 -1
  5. data/lib/browsed/chrome.rb +2 -2
  6. data/lib/browsed/client.rb +2 -2
  7. data/lib/browsed/firefox.rb +2 -2
  8. data/lib/browsed/version.rb +1 -1
  9. metadata +11 -164
  10. data/lib/browsed/proxies/proxy-chain-server/node_modules/.bin/portastic +0 -1
  11. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/LICENSE +0 -21
  12. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/README.md +0 -57
  13. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/changelog.md +0 -1
  14. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.js +0 -3824
  15. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.core.min.js +0 -31
  16. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.js +0 -5666
  17. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
  18. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/any.js +0 -21
  19. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/assert.js +0 -55
  20. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/async.js +0 -165
  21. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bind.js +0 -67
  22. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/bluebird.js +0 -11
  23. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/call_get.js +0 -123
  24. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/cancel.js +0 -129
  25. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/catch_filter.js +0 -42
  26. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/context.js +0 -69
  27. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/debuggability.js +0 -934
  28. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/direct_resolve.js +0 -46
  29. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/each.js +0 -30
  30. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/errors.js +0 -116
  31. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/es5.js +0 -80
  32. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/filter.js +0 -12
  33. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/finally.js +0 -146
  34. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/generators.js +0 -223
  35. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/join.js +0 -168
  36. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/map.js +0 -168
  37. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/method.js +0 -55
  38. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeback.js +0 -51
  39. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/nodeify.js +0 -58
  40. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise.js +0 -789
  41. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promise_array.js +0 -185
  42. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/promisify.js +0 -314
  43. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/props.js +0 -118
  44. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/queue.js +0 -73
  45. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/race.js +0 -49
  46. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/reduce.js +0 -172
  47. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/schedule.js +0 -62
  48. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/settle.js +0 -43
  49. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/some.js +0 -148
  50. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/synchronous_inspection.js +0 -103
  51. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/thenables.js +0 -86
  52. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/timers.js +0 -93
  53. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/using.js +0 -226
  54. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/js/release/util.js +0 -389
  55. data/lib/browsed/proxies/proxy-chain-server/node_modules/bluebird/package.json +0 -102
  56. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/CHANGELOG.md +0 -408
  57. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/LICENSE +0 -22
  58. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/Readme.md +0 -428
  59. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/index.js +0 -1224
  60. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/package.json +0 -70
  61. data/lib/browsed/proxies/proxy-chain-server/node_modules/commander/typings/index.d.ts +0 -310
  62. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.coveralls.yml +0 -1
  63. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.eslintrc +0 -11
  64. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.npmignore +0 -9
  65. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/.travis.yml +0 -14
  66. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/CHANGELOG.md +0 -362
  67. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/LICENSE +0 -19
  68. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/Makefile +0 -50
  69. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/README.md +0 -312
  70. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/component.json +0 -19
  71. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/karma.conf.js +0 -70
  72. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/node.js +0 -1
  73. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/package.json +0 -88
  74. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/browser.js +0 -185
  75. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/debug.js +0 -202
  76. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/index.js +0 -10
  77. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/inspector-log.js +0 -15
  78. data/lib/browsed/proxies/proxy-chain-server/node_modules/debug/src/node.js +0 -248
  79. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/index.js +0 -152
  80. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/license.md +0 -21
  81. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/package.json +0 -69
  82. data/lib/browsed/proxies/proxy-chain-server/node_modules/ms/readme.md +0 -51
  83. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/LICENSE +0 -13
  84. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/README.md +0 -148
  85. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/bin/portastic +0 -65
  86. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/history.md +0 -7
  87. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/index.js +0 -4
  88. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/monitor.js +0 -59
  89. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/lib/portastic.js +0 -167
  90. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/LICENSE +0 -21
  91. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/README.md +0 -677
  92. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/changelog.md +0 -1730
  93. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.js +0 -4892
  94. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/browser/bluebird.min.js +0 -31
  95. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/any.js +0 -21
  96. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/assert.js +0 -55
  97. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/async.js +0 -150
  98. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bind.js +0 -72
  99. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/bluebird.js +0 -11
  100. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/call_get.js +0 -123
  101. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/cancel.js +0 -48
  102. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/captured_trace.js +0 -493
  103. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/catch_filter.js +0 -66
  104. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/context.js +0 -38
  105. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/debuggability.js +0 -162
  106. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/direct_resolve.js +0 -63
  107. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/each.js +0 -12
  108. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/errors.js +0 -111
  109. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/es5.js +0 -80
  110. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/filter.js +0 -12
  111. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/finally.js +0 -98
  112. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/generators.js +0 -136
  113. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/join.js +0 -107
  114. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/map.js +0 -133
  115. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/method.js +0 -44
  116. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/nodeify.js +0 -59
  117. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/progress.js +0 -76
  118. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise.js +0 -759
  119. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_array.js +0 -142
  120. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promise_resolver.js +0 -123
  121. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/promisify.js +0 -307
  122. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/props.js +0 -79
  123. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/queue.js +0 -90
  124. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/race.js +0 -47
  125. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/reduce.js +0 -148
  126. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/schedule.js +0 -35
  127. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/settle.js +0 -40
  128. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/some.js +0 -125
  129. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/synchronous_inspection.js +0 -94
  130. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/thenables.js +0 -84
  131. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/timers.js +0 -64
  132. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/using.js +0 -213
  133. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/js/main/util.js +0 -321
  134. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/node_modules/bluebird/package.json +0 -103
  135. data/lib/browsed/proxies/proxy-chain-server/node_modules/portastic/package.json +0 -69
  136. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/CHANGELOG.md +0 -109
  137. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/LICENSE +0 -201
  138. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/README.md +0 -278
  139. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/anonymize_proxy.js +0 -100
  140. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_base.js +0 -319
  141. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_custom_response.js +0 -96
  142. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_forward.js +0 -173
  143. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_chain.js +0 -132
  144. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_direct.js +0 -89
  145. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/handler_tunnel_tcp_chain.js +0 -271
  146. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/index.js +0 -26
  147. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/run_locally.js +0 -66
  148. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/server.js +0 -595
  149. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tcp_tunnel.js +0 -138
  150. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/testing_tcp_service.js +0 -37
  151. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/build/tools.js +0 -220
  152. data/lib/browsed/proxies/proxy-chain-server/node_modules/proxy-chain/package.json +0 -104
  153. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/LICENSE +0 -23
  154. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/README.md +0 -28
  155. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/package.json +0 -81
  156. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js +0 -5
  157. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore-min.js.map +0 -1
  158. data/lib/browsed/proxies/proxy-chain-server/node_modules/underscore/underscore.js +0 -1692
  159. data/lib/browsed/proxies/proxy-chain-server/package-lock.json +0 -63
  160. data/lib/browsed/proxies/proxy-chain-server/package.json +0 -15
  161. data/lib/browsed/proxies/proxy-chain-server/server.js +0 -25
  162. data/lib/browsed/proxies/proxy_chain.rb +0 -46
@@ -1,226 +0,0 @@
1
- "use strict";
2
- module.exports = function (Promise, apiRejection, tryConvertToPromise,
3
- createContext, INTERNAL, debug) {
4
- var util = require("./util");
5
- var TypeError = require("./errors").TypeError;
6
- var inherits = require("./util").inherits;
7
- var errorObj = util.errorObj;
8
- var tryCatch = util.tryCatch;
9
- var NULL = {};
10
-
11
- function thrower(e) {
12
- setTimeout(function(){throw e;}, 0);
13
- }
14
-
15
- function castPreservingDisposable(thenable) {
16
- var maybePromise = tryConvertToPromise(thenable);
17
- if (maybePromise !== thenable &&
18
- typeof thenable._isDisposable === "function" &&
19
- typeof thenable._getDisposer === "function" &&
20
- thenable._isDisposable()) {
21
- maybePromise._setDisposable(thenable._getDisposer());
22
- }
23
- return maybePromise;
24
- }
25
- function dispose(resources, inspection) {
26
- var i = 0;
27
- var len = resources.length;
28
- var ret = new Promise(INTERNAL);
29
- function iterator() {
30
- if (i >= len) return ret._fulfill();
31
- var maybePromise = castPreservingDisposable(resources[i++]);
32
- if (maybePromise instanceof Promise &&
33
- maybePromise._isDisposable()) {
34
- try {
35
- maybePromise = tryConvertToPromise(
36
- maybePromise._getDisposer().tryDispose(inspection),
37
- resources.promise);
38
- } catch (e) {
39
- return thrower(e);
40
- }
41
- if (maybePromise instanceof Promise) {
42
- return maybePromise._then(iterator, thrower,
43
- null, null, null);
44
- }
45
- }
46
- iterator();
47
- }
48
- iterator();
49
- return ret;
50
- }
51
-
52
- function Disposer(data, promise, context) {
53
- this._data = data;
54
- this._promise = promise;
55
- this._context = context;
56
- }
57
-
58
- Disposer.prototype.data = function () {
59
- return this._data;
60
- };
61
-
62
- Disposer.prototype.promise = function () {
63
- return this._promise;
64
- };
65
-
66
- Disposer.prototype.resource = function () {
67
- if (this.promise().isFulfilled()) {
68
- return this.promise().value();
69
- }
70
- return NULL;
71
- };
72
-
73
- Disposer.prototype.tryDispose = function(inspection) {
74
- var resource = this.resource();
75
- var context = this._context;
76
- if (context !== undefined) context._pushContext();
77
- var ret = resource !== NULL
78
- ? this.doDispose(resource, inspection) : null;
79
- if (context !== undefined) context._popContext();
80
- this._promise._unsetDisposable();
81
- this._data = null;
82
- return ret;
83
- };
84
-
85
- Disposer.isDisposer = function (d) {
86
- return (d != null &&
87
- typeof d.resource === "function" &&
88
- typeof d.tryDispose === "function");
89
- };
90
-
91
- function FunctionDisposer(fn, promise, context) {
92
- this.constructor$(fn, promise, context);
93
- }
94
- inherits(FunctionDisposer, Disposer);
95
-
96
- FunctionDisposer.prototype.doDispose = function (resource, inspection) {
97
- var fn = this.data();
98
- return fn.call(resource, resource, inspection);
99
- };
100
-
101
- function maybeUnwrapDisposer(value) {
102
- if (Disposer.isDisposer(value)) {
103
- this.resources[this.index]._setDisposable(value);
104
- return value.promise();
105
- }
106
- return value;
107
- }
108
-
109
- function ResourceList(length) {
110
- this.length = length;
111
- this.promise = null;
112
- this[length-1] = null;
113
- }
114
-
115
- ResourceList.prototype._resultCancelled = function() {
116
- var len = this.length;
117
- for (var i = 0; i < len; ++i) {
118
- var item = this[i];
119
- if (item instanceof Promise) {
120
- item.cancel();
121
- }
122
- }
123
- };
124
-
125
- Promise.using = function () {
126
- var len = arguments.length;
127
- if (len < 2) return apiRejection(
128
- "you must pass at least 2 arguments to Promise.using");
129
- var fn = arguments[len - 1];
130
- if (typeof fn !== "function") {
131
- return apiRejection("expecting a function but got " + util.classString(fn));
132
- }
133
- var input;
134
- var spreadArgs = true;
135
- if (len === 2 && Array.isArray(arguments[0])) {
136
- input = arguments[0];
137
- len = input.length;
138
- spreadArgs = false;
139
- } else {
140
- input = arguments;
141
- len--;
142
- }
143
- var resources = new ResourceList(len);
144
- for (var i = 0; i < len; ++i) {
145
- var resource = input[i];
146
- if (Disposer.isDisposer(resource)) {
147
- var disposer = resource;
148
- resource = resource.promise();
149
- resource._setDisposable(disposer);
150
- } else {
151
- var maybePromise = tryConvertToPromise(resource);
152
- if (maybePromise instanceof Promise) {
153
- resource =
154
- maybePromise._then(maybeUnwrapDisposer, null, null, {
155
- resources: resources,
156
- index: i
157
- }, undefined);
158
- }
159
- }
160
- resources[i] = resource;
161
- }
162
-
163
- var reflectedResources = new Array(resources.length);
164
- for (var i = 0; i < reflectedResources.length; ++i) {
165
- reflectedResources[i] = Promise.resolve(resources[i]).reflect();
166
- }
167
-
168
- var resultPromise = Promise.all(reflectedResources)
169
- .then(function(inspections) {
170
- for (var i = 0; i < inspections.length; ++i) {
171
- var inspection = inspections[i];
172
- if (inspection.isRejected()) {
173
- errorObj.e = inspection.error();
174
- return errorObj;
175
- } else if (!inspection.isFulfilled()) {
176
- resultPromise.cancel();
177
- return;
178
- }
179
- inspections[i] = inspection.value();
180
- }
181
- promise._pushContext();
182
-
183
- fn = tryCatch(fn);
184
- var ret = spreadArgs
185
- ? fn.apply(undefined, inspections) : fn(inspections);
186
- var promiseCreated = promise._popContext();
187
- debug.checkForgottenReturns(
188
- ret, promiseCreated, "Promise.using", promise);
189
- return ret;
190
- });
191
-
192
- var promise = resultPromise.lastly(function() {
193
- var inspection = new Promise.PromiseInspection(resultPromise);
194
- return dispose(resources, inspection);
195
- });
196
- resources.promise = promise;
197
- promise._setOnCancel(resources);
198
- return promise;
199
- };
200
-
201
- Promise.prototype._setDisposable = function (disposer) {
202
- this._bitField = this._bitField | 131072;
203
- this._disposer = disposer;
204
- };
205
-
206
- Promise.prototype._isDisposable = function () {
207
- return (this._bitField & 131072) > 0;
208
- };
209
-
210
- Promise.prototype._getDisposer = function () {
211
- return this._disposer;
212
- };
213
-
214
- Promise.prototype._unsetDisposable = function () {
215
- this._bitField = this._bitField & (~131072);
216
- this._disposer = undefined;
217
- };
218
-
219
- Promise.prototype.disposer = function (fn) {
220
- if (typeof fn === "function") {
221
- return new FunctionDisposer(fn, this, createContext());
222
- }
223
- throw new TypeError();
224
- };
225
-
226
- };
@@ -1,389 +0,0 @@
1
- "use strict";
2
- var es5 = require("./es5");
3
- var canEvaluate = typeof navigator == "undefined";
4
-
5
- var errorObj = {e: {}};
6
- var tryCatchTarget;
7
- var globalObject = typeof self !== "undefined" ? self :
8
- typeof window !== "undefined" ? window :
9
- typeof global !== "undefined" ? global :
10
- this !== undefined ? this : null;
11
-
12
- function tryCatcher() {
13
- try {
14
- var target = tryCatchTarget;
15
- tryCatchTarget = null;
16
- return target.apply(this, arguments);
17
- } catch (e) {
18
- errorObj.e = e;
19
- return errorObj;
20
- }
21
- }
22
- function tryCatch(fn) {
23
- tryCatchTarget = fn;
24
- return tryCatcher;
25
- }
26
-
27
- var inherits = function(Child, Parent) {
28
- var hasProp = {}.hasOwnProperty;
29
-
30
- function T() {
31
- this.constructor = Child;
32
- this.constructor$ = Parent;
33
- for (var propertyName in Parent.prototype) {
34
- if (hasProp.call(Parent.prototype, propertyName) &&
35
- propertyName.charAt(propertyName.length-1) !== "$"
36
- ) {
37
- this[propertyName + "$"] = Parent.prototype[propertyName];
38
- }
39
- }
40
- }
41
- T.prototype = Parent.prototype;
42
- Child.prototype = new T();
43
- return Child.prototype;
44
- };
45
-
46
-
47
- function isPrimitive(val) {
48
- return val == null || val === true || val === false ||
49
- typeof val === "string" || typeof val === "number";
50
-
51
- }
52
-
53
- function isObject(value) {
54
- return typeof value === "function" ||
55
- typeof value === "object" && value !== null;
56
- }
57
-
58
- function maybeWrapAsError(maybeError) {
59
- if (!isPrimitive(maybeError)) return maybeError;
60
-
61
- return new Error(safeToString(maybeError));
62
- }
63
-
64
- function withAppended(target, appendee) {
65
- var len = target.length;
66
- var ret = new Array(len + 1);
67
- var i;
68
- for (i = 0; i < len; ++i) {
69
- ret[i] = target[i];
70
- }
71
- ret[i] = appendee;
72
- return ret;
73
- }
74
-
75
- function getDataPropertyOrDefault(obj, key, defaultValue) {
76
- if (es5.isES5) {
77
- var desc = Object.getOwnPropertyDescriptor(obj, key);
78
-
79
- if (desc != null) {
80
- return desc.get == null && desc.set == null
81
- ? desc.value
82
- : defaultValue;
83
- }
84
- } else {
85
- return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
86
- }
87
- }
88
-
89
- function notEnumerableProp(obj, name, value) {
90
- if (isPrimitive(obj)) return obj;
91
- var descriptor = {
92
- value: value,
93
- configurable: true,
94
- enumerable: false,
95
- writable: true
96
- };
97
- es5.defineProperty(obj, name, descriptor);
98
- return obj;
99
- }
100
-
101
- function thrower(r) {
102
- throw r;
103
- }
104
-
105
- var inheritedDataKeys = (function() {
106
- var excludedPrototypes = [
107
- Array.prototype,
108
- Object.prototype,
109
- Function.prototype
110
- ];
111
-
112
- var isExcludedProto = function(val) {
113
- for (var i = 0; i < excludedPrototypes.length; ++i) {
114
- if (excludedPrototypes[i] === val) {
115
- return true;
116
- }
117
- }
118
- return false;
119
- };
120
-
121
- if (es5.isES5) {
122
- var getKeys = Object.getOwnPropertyNames;
123
- return function(obj) {
124
- var ret = [];
125
- var visitedKeys = Object.create(null);
126
- while (obj != null && !isExcludedProto(obj)) {
127
- var keys;
128
- try {
129
- keys = getKeys(obj);
130
- } catch (e) {
131
- return ret;
132
- }
133
- for (var i = 0; i < keys.length; ++i) {
134
- var key = keys[i];
135
- if (visitedKeys[key]) continue;
136
- visitedKeys[key] = true;
137
- var desc = Object.getOwnPropertyDescriptor(obj, key);
138
- if (desc != null && desc.get == null && desc.set == null) {
139
- ret.push(key);
140
- }
141
- }
142
- obj = es5.getPrototypeOf(obj);
143
- }
144
- return ret;
145
- };
146
- } else {
147
- var hasProp = {}.hasOwnProperty;
148
- return function(obj) {
149
- if (isExcludedProto(obj)) return [];
150
- var ret = [];
151
-
152
- /*jshint forin:false */
153
- enumeration: for (var key in obj) {
154
- if (hasProp.call(obj, key)) {
155
- ret.push(key);
156
- } else {
157
- for (var i = 0; i < excludedPrototypes.length; ++i) {
158
- if (hasProp.call(excludedPrototypes[i], key)) {
159
- continue enumeration;
160
- }
161
- }
162
- ret.push(key);
163
- }
164
- }
165
- return ret;
166
- };
167
- }
168
-
169
- })();
170
-
171
- var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
172
- function isClass(fn) {
173
- try {
174
- if (typeof fn === "function") {
175
- var keys = es5.names(fn.prototype);
176
-
177
- var hasMethods = es5.isES5 && keys.length > 1;
178
- var hasMethodsOtherThanConstructor = keys.length > 0 &&
179
- !(keys.length === 1 && keys[0] === "constructor");
180
- var hasThisAssignmentAndStaticMethods =
181
- thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
182
-
183
- if (hasMethods || hasMethodsOtherThanConstructor ||
184
- hasThisAssignmentAndStaticMethods) {
185
- return true;
186
- }
187
- }
188
- return false;
189
- } catch (e) {
190
- return false;
191
- }
192
- }
193
-
194
- function toFastProperties(obj) {
195
- /*jshint -W027,-W055,-W031*/
196
- function FakeConstructor() {}
197
- FakeConstructor.prototype = obj;
198
- var receiver = new FakeConstructor();
199
- function ic() {
200
- return typeof receiver.foo;
201
- }
202
- ic();
203
- ic();
204
- return obj;
205
- eval(obj);
206
- }
207
-
208
- var rident = /^[a-z$_][a-z$_0-9]*$/i;
209
- function isIdentifier(str) {
210
- return rident.test(str);
211
- }
212
-
213
- function filledRange(count, prefix, suffix) {
214
- var ret = new Array(count);
215
- for(var i = 0; i < count; ++i) {
216
- ret[i] = prefix + i + suffix;
217
- }
218
- return ret;
219
- }
220
-
221
- function safeToString(obj) {
222
- try {
223
- return obj + "";
224
- } catch (e) {
225
- return "[no string representation]";
226
- }
227
- }
228
-
229
- function isError(obj) {
230
- return obj instanceof Error ||
231
- (obj !== null &&
232
- typeof obj === "object" &&
233
- typeof obj.message === "string" &&
234
- typeof obj.name === "string");
235
- }
236
-
237
- function markAsOriginatingFromRejection(e) {
238
- try {
239
- notEnumerableProp(e, "isOperational", true);
240
- }
241
- catch(ignore) {}
242
- }
243
-
244
- function originatesFromRejection(e) {
245
- if (e == null) return false;
246
- return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
247
- e["isOperational"] === true);
248
- }
249
-
250
- function canAttachTrace(obj) {
251
- return isError(obj) && es5.propertyIsWritable(obj, "stack");
252
- }
253
-
254
- var ensureErrorObject = (function() {
255
- if (!("stack" in new Error())) {
256
- return function(value) {
257
- if (canAttachTrace(value)) return value;
258
- try {throw new Error(safeToString(value));}
259
- catch(err) {return err;}
260
- };
261
- } else {
262
- return function(value) {
263
- if (canAttachTrace(value)) return value;
264
- return new Error(safeToString(value));
265
- };
266
- }
267
- })();
268
-
269
- function classString(obj) {
270
- return {}.toString.call(obj);
271
- }
272
-
273
- function copyDescriptors(from, to, filter) {
274
- var keys = es5.names(from);
275
- for (var i = 0; i < keys.length; ++i) {
276
- var key = keys[i];
277
- if (filter(key)) {
278
- try {
279
- es5.defineProperty(to, key, es5.getDescriptor(from, key));
280
- } catch (ignore) {}
281
- }
282
- }
283
- }
284
-
285
- var asArray = function(v) {
286
- if (es5.isArray(v)) {
287
- return v;
288
- }
289
- return null;
290
- };
291
-
292
- if (typeof Symbol !== "undefined" && Symbol.iterator) {
293
- var ArrayFrom = typeof Array.from === "function" ? function(v) {
294
- return Array.from(v);
295
- } : function(v) {
296
- var ret = [];
297
- var it = v[Symbol.iterator]();
298
- var itResult;
299
- while (!((itResult = it.next()).done)) {
300
- ret.push(itResult.value);
301
- }
302
- return ret;
303
- };
304
-
305
- asArray = function(v) {
306
- if (es5.isArray(v)) {
307
- return v;
308
- } else if (v != null && typeof v[Symbol.iterator] === "function") {
309
- return ArrayFrom(v);
310
- }
311
- return null;
312
- };
313
- }
314
-
315
- var isNode = typeof process !== "undefined" &&
316
- classString(process).toLowerCase() === "[object process]";
317
-
318
- var hasEnvVariables = typeof process !== "undefined" &&
319
- typeof process.env !== "undefined";
320
-
321
- function env(key) {
322
- return hasEnvVariables ? process.env[key] : undefined;
323
- }
324
-
325
- function getNativePromise() {
326
- if (typeof Promise === "function") {
327
- try {
328
- var promise = new Promise(function(){});
329
- if ({}.toString.call(promise) === "[object Promise]") {
330
- return Promise;
331
- }
332
- } catch (e) {}
333
- }
334
- }
335
-
336
- function domainBind(self, cb) {
337
- return self.bind(cb);
338
- }
339
-
340
- var ret = {
341
- isClass: isClass,
342
- isIdentifier: isIdentifier,
343
- inheritedDataKeys: inheritedDataKeys,
344
- getDataPropertyOrDefault: getDataPropertyOrDefault,
345
- thrower: thrower,
346
- isArray: es5.isArray,
347
- asArray: asArray,
348
- notEnumerableProp: notEnumerableProp,
349
- isPrimitive: isPrimitive,
350
- isObject: isObject,
351
- isError: isError,
352
- canEvaluate: canEvaluate,
353
- errorObj: errorObj,
354
- tryCatch: tryCatch,
355
- inherits: inherits,
356
- withAppended: withAppended,
357
- maybeWrapAsError: maybeWrapAsError,
358
- toFastProperties: toFastProperties,
359
- filledRange: filledRange,
360
- toString: safeToString,
361
- canAttachTrace: canAttachTrace,
362
- ensureErrorObject: ensureErrorObject,
363
- originatesFromRejection: originatesFromRejection,
364
- markAsOriginatingFromRejection: markAsOriginatingFromRejection,
365
- classString: classString,
366
- copyDescriptors: copyDescriptors,
367
- hasDevTools: typeof chrome !== "undefined" && chrome &&
368
- typeof chrome.loadTimes === "function",
369
- isNode: isNode,
370
- hasEnvVariables: hasEnvVariables,
371
- env: env,
372
- global: globalObject,
373
- getNativePromise: getNativePromise,
374
- domainBind: domainBind
375
- };
376
- ret.isRecentNode = ret.isNode && (function() {
377
- var version;
378
- if (process.versions && process.versions.node) {
379
- version = process.versions.node.split(".").map(Number);
380
- } else if (process.version) {
381
- version = process.version.split(".").map(Number);
382
- }
383
- return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
384
- })();
385
-
386
- if (ret.isNode) ret.toFastProperties(process);
387
-
388
- try {throw new Error(); } catch (e) {ret.lastLineError = e;}
389
- module.exports = ret;