tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 8f679077da8974c329257829b9a35f81c0d09864
parent 7bfaf2751e634e3d5cde061cf20027c46420488b
Author: Julian Descottes <jdescottes@mozilla.com>
Date:   Fri, 17 Oct 2025 12:10:01 +0000

Bug 1992348 - [bidi] Use unique ids for requests handled in different processes r=webdriver-reviewers,whimboo

Differential Revision: https://phabricator.services.mozilla.com/D267377

Diffstat:
Mremote/shared/NetworkRequest.sys.mjs | 17++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/remote/shared/NetworkRequest.sys.mjs b/remote/shared/NetworkRequest.sys.mjs @@ -4,12 +4,14 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { - NavigableManager: "chrome://remote/content/shared/NavigableManager.sys.mjs", - NavigationState: "chrome://remote/content/shared/NavigationManager.sys.mjs", NetworkHelper: "resource://devtools/shared/network-observer/NetworkHelper.sys.mjs", NetworkUtils: "resource://devtools/shared/network-observer/NetworkUtils.sys.mjs", + + generateUUID: "chrome://remote/content/shared/UUID.sys.mjs", + NavigableManager: "chrome://remote/content/shared/NavigableManager.sys.mjs", + NavigationState: "chrome://remote/content/shared/NavigationManager.sys.mjs", notifyNavigationStarted: "chrome://remote/content/shared/NavigationManager.sys.mjs", }); @@ -35,6 +37,13 @@ export class NetworkRequest { #wrappedChannel; /** + * NetworkRequest relies on WrappedChannel's id to identify requests. However + * this id is generated based on a counter in each process. Therefore we can + * have overlaps for network requests handled in different processes + */ + static UNIQUE_ID_SUFFIX = lazy.generateUUID(); + + /** * * @param {nsIChannel} channel * The channel for the request. @@ -79,9 +88,11 @@ export class NetworkRequest { this.#wrappedChannel = ChannelWrapper.get(channel); this.#redirectCount = this.#timedChannel.redirectCount; + // The wrappedChannel id remains identical across redirects, whereas // nsIChannel.channelId is different for each and every request. - this.#requestId = this.#wrappedChannel.id.toString(); + // Add a suffix unique to the process where the event is handled. + this.#requestId = `${this.#wrappedChannel.id.toString()}-${NetworkRequest.UNIQUE_ID_SUFFIX}`; this.#contextId = this.#getContextId(); this.#navigationId = this.#getNavigationId();