
Pier Angelo Vendrame pushed to branch tor-browser-128.7.0esr-14.5-1 at The Tor Project / Applications / Tor Browser Commits: a19577f9 by Henry Wilkes at 2025-02-26T12:53:50+00:00 fixup! TB 40597: Implement TorSettings module TB 43529: Await BootstrapAttempt.cancel in AutoBootstrapAttempt. We also add a comment for the reason why we need to await. - - - - - 1 changed file: - toolkit/modules/TorConnect.sys.mjs Changes: ===================================== toolkit/modules/TorConnect.sys.mjs ===================================== @@ -278,10 +278,13 @@ class BootstrapAttempt { lazy.logger.warn("Cancelled bootstrap after it has already resolved"); return; } - // Wait until after bootstrap.cancel returns before we resolve with - // cancelled. In particular, there is a small chance that the bootstrap - // completes, in which case we want to be able to resolve with a success - // instead. + // Wait until after #bootstrap.cancel returns before we resolve with + // cancelled. In particular: + // + there is a small chance that the bootstrap completes, in which case we + // want to be able to resolve with a success instead. + // + we want to make sure that we only resolve this BootstrapAttempt + // when the current TorBootstrapRequest instance is fully resolved so + // there are never two competing instances. await this.#bootstrap?.cancel(); this.#resolveRun({ result: "cancelled" }); } @@ -636,13 +639,15 @@ class AutoBootstrapAttempt { return; } - // Wait until after bootstrap.cancel returns before we resolve with - // cancelled. In particular, there is a small chance that the bootstrap - // completes, in which case we want to be able to resolve with a success - // instead. + // Wait until after #bootstrapAttempt.cancel returns before we resolve with + // cancelled. In particular: + // + there is a small chance that the bootstrap completes, in which case we + // want to be able to resolve with a success instead. + // + we want to make sure that we only resolve this AutoBootstrapAttempt + // when the current TorBootstrapRequest instance is fully resolved so + // there are never two competing instances. if (this.#bootstrapAttempt) { - this.#bootstrapAttempt.cancel(); - await this.#bootstrapAttempt; + await this.#bootstrapAttempt.cancel(); } // In case no bootstrap is running, we resolve with "cancelled". this.#resolveRun({ result: "cancelled" }); View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/a19577f9... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/a19577f9... You're receiving this email because of your account on gitlab.torproject.org.
participants (1)
-
Pier Angelo Vendrame (@pierov)