From 12154adb5016609901550aad5250045670644dd4 Mon Sep 17 00:00:00 2001 From: Petka Antonov Date: Sat, 25 May 2019 21:03:34 +0300 Subject: [PATCH] Fix #1505 --- src/async.js | 51 +++----------------------------------------- src/debuggability.js | 2 -- src/util.js | 2 -- 3 files changed, 3 insertions(+), 52 deletions(-) diff --git a/src/async.js b/src/async.js index e6ea1f660..98873ff6d 100644 --- a/src/async.js +++ b/src/async.js @@ -4,7 +4,6 @@ try {throw new Error(); } catch (e) {firstLineError = e;} var ASSERT = require("./assert"); var schedule = require("./schedule"); var Queue = require("./queue"); -var util = require("./util"); function Async() { this._customScheduler = false; @@ -12,7 +11,6 @@ function Async() { this._lateQueue = new Queue(LATE_QUEUE_CAPACITY); this._normalQueue = new Queue(NORMAL_QUEUE_CAPACITY); this._haveDrainedQueues = false; - this._trampolineEnabled = true; var self = this; this.drainQueues = function () { self._drainQueues(); @@ -31,16 +29,6 @@ Async.prototype.hasCustomScheduler = function() { return this._customScheduler; }; -Async.prototype.enableTrampoline = function() { - this._trampolineEnabled = true; -}; - -Async.prototype.disableTrampolineIfNecessary = function() { - if (util.hasDevTools) { - this._trampolineEnabled = false; - } -}; - Async.prototype.haveItemsQueued = function () { return this._isTickUsed || this._haveDrainedQueues; }; @@ -94,43 +82,10 @@ function AsyncSettlePromises(promise) { this._queueTick(); } -if (!util.hasDevTools) { - Async.prototype.invokeLater = AsyncInvokeLater; - Async.prototype.invoke = AsyncInvoke; - Async.prototype.settlePromises = AsyncSettlePromises; -} else { - Async.prototype.invokeLater = function (fn, receiver, arg) { - if (this._trampolineEnabled) { - AsyncInvokeLater.call(this, fn, receiver, arg); - } else { - this._schedule(function() { - setTimeout(function() { - fn.call(receiver, arg); - }, 100); - }); - } - }; - - Async.prototype.invoke = function (fn, receiver, arg) { - if (this._trampolineEnabled) { - AsyncInvoke.call(this, fn, receiver, arg); - } else { - this._schedule(function() { - fn.call(receiver, arg); - }); - } - }; +Async.prototype.invokeLater = AsyncInvokeLater; +Async.prototype.invoke = AsyncInvoke; +Async.prototype.settlePromises = AsyncSettlePromises; - Async.prototype.settlePromises = function(promise) { - if (this._trampolineEnabled) { - AsyncSettlePromises.call(this, promise); - } else { - this._schedule(function() { - promise._settlePromises(); - }); - } - }; -} function _drainQueue(queue) { while (queue.length() > 0) { diff --git a/src/debuggability.js b/src/debuggability.js index 949290b86..b99939823 100644 --- a/src/debuggability.js +++ b/src/debuggability.js @@ -131,14 +131,12 @@ Promise.longStackTraces = function () { Promise.prototype._attachExtraTrace = Promise_attachExtraTrace; Promise.prototype._dereferenceTrace = Promise_dereferenceTrace; Context.deactivateLongStackTraces(); - async.enableTrampoline(); config.longStackTraces = false; }; Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace; Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace; Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace; Context.activateLongStackTraces(); - async.disableTrampolineIfNecessary(); } }; diff --git a/src/util.js b/src/util.js index 164bb9f4e..1ef4213b6 100644 --- a/src/util.js +++ b/src/util.js @@ -399,8 +399,6 @@ var ret = { markAsOriginatingFromRejection: markAsOriginatingFromRejection, classString: classString, copyDescriptors: copyDescriptors, - hasDevTools: typeof chrome !== "undefined" && chrome && - typeof chrome.loadTimes === "function", isNode: isNode, hasEnvVariables: hasEnvVariables, env: env,