diff --git a/lib/browser/api/net.ts b/lib/browser/api/net.ts index c50395668fad..8c19fb7adafb 100644 --- a/lib/browser/api/net.ts +++ b/lib/browser/api/net.ts @@ -119,10 +119,13 @@ class IncomingMessage extends Readable { this._shouldPush = this.push(chunk); } if (this._shouldPush && this._resume) { - this._resume(); // Reset the callback, so that a new one is used for each - // batch of throttled data + // batch of throttled data. Do this before calling resume to avoid a + // potential race-condition + const resume = this._resume; this._resume = null; + + resume(); } }