Skip to content

Commit 12154ad

Browse files
committedMay 25, 2019
Fix #1505
1 parent 420cf4e commit 12154ad

File tree

3 files changed

+3
-52
lines changed

3 files changed

+3
-52
lines changed
 

‎src/async.js

+3-48
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ try {throw new Error(); } catch (e) {firstLineError = e;}
44
var ASSERT = require("./assert");
55
var schedule = require("./schedule");
66
var Queue = require("./queue");
7-
var util = require("./util");
87

98
function Async() {
109
this._customScheduler = false;
1110
this._isTickUsed = false;
1211
this._lateQueue = new Queue(LATE_QUEUE_CAPACITY);
1312
this._normalQueue = new Queue(NORMAL_QUEUE_CAPACITY);
1413
this._haveDrainedQueues = false;
15-
this._trampolineEnabled = true;
1614
var self = this;
1715
this.drainQueues = function () {
1816
self._drainQueues();
@@ -31,16 +29,6 @@ Async.prototype.hasCustomScheduler = function() {
3129
return this._customScheduler;
3230
};
3331

34-
Async.prototype.enableTrampoline = function() {
35-
this._trampolineEnabled = true;
36-
};
37-
38-
Async.prototype.disableTrampolineIfNecessary = function() {
39-
if (util.hasDevTools) {
40-
this._trampolineEnabled = false;
41-
}
42-
};
43-
4432
Async.prototype.haveItemsQueued = function () {
4533
return this._isTickUsed || this._haveDrainedQueues;
4634
};
@@ -94,43 +82,10 @@ function AsyncSettlePromises(promise) {
9482
this._queueTick();
9583
}
9684

97-
if (!util.hasDevTools) {
98-
Async.prototype.invokeLater = AsyncInvokeLater;
99-
Async.prototype.invoke = AsyncInvoke;
100-
Async.prototype.settlePromises = AsyncSettlePromises;
101-
} else {
102-
Async.prototype.invokeLater = function (fn, receiver, arg) {
103-
if (this._trampolineEnabled) {
104-
AsyncInvokeLater.call(this, fn, receiver, arg);
105-
} else {
106-
this._schedule(function() {
107-
setTimeout(function() {
108-
fn.call(receiver, arg);
109-
}, 100);
110-
});
111-
}
112-
};
113-
114-
Async.prototype.invoke = function (fn, receiver, arg) {
115-
if (this._trampolineEnabled) {
116-
AsyncInvoke.call(this, fn, receiver, arg);
117-
} else {
118-
this._schedule(function() {
119-
fn.call(receiver, arg);
120-
});
121-
}
122-
};
85+
Async.prototype.invokeLater = AsyncInvokeLater;
86+
Async.prototype.invoke = AsyncInvoke;
87+
Async.prototype.settlePromises = AsyncSettlePromises;
12388

124-
Async.prototype.settlePromises = function(promise) {
125-
if (this._trampolineEnabled) {
126-
AsyncSettlePromises.call(this, promise);
127-
} else {
128-
this._schedule(function() {
129-
promise._settlePromises();
130-
});
131-
}
132-
};
133-
}
13489

13590
function _drainQueue(queue) {
13691
while (queue.length() > 0) {

‎src/debuggability.js

-2
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,12 @@ Promise.longStackTraces = function () {
131131
Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
132132
Promise.prototype._dereferenceTrace = Promise_dereferenceTrace;
133133
Context.deactivateLongStackTraces();
134-
async.enableTrampoline();
135134
config.longStackTraces = false;
136135
};
137136
Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
138137
Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
139138
Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace;
140139
Context.activateLongStackTraces();
141-
async.disableTrampolineIfNecessary();
142140
}
143141
};
144142

‎src/util.js

-2
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,6 @@ var ret = {
399399
markAsOriginatingFromRejection: markAsOriginatingFromRejection,
400400
classString: classString,
401401
copyDescriptors: copyDescriptors,
402-
hasDevTools: typeof chrome !== "undefined" && chrome &&
403-
typeof chrome.loadTimes === "function",
404402
isNode: isNode,
405403
hasEnvVariables: hasEnvVariables,
406404
env: env,

0 commit comments

Comments
 (0)
Please sign in to comment.