commit 95529d6d243519d7ce68c8a66a3a04496036e4b2 parent d9ff7a85ca5789016b93bfbfeaf3318c7429113c Author: Henrik Skupin <mail@hskupin.info> Date: Tue, 16 Dec 2025 12:03:46 +0000 Bug 1851788 - [remote] Add extra checks when retrieving child browsing contexts by navigable id. r=Sasha Differential Revision: https://phabricator.services.mozilla.com/D276226 Diffstat:
| M | remote/shared/NavigableManager.sys.mjs | | | 10 | ++++++++-- |
| M | remote/shared/NavigationManager.sys.mjs | | | 6 | ++---- |
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/remote/shared/NavigableManager.sys.mjs b/remote/shared/NavigableManager.sys.mjs @@ -91,14 +91,20 @@ class NavigableManagerClass { let browsingContext; if (this.#chromeNavigables.hasId(id)) { + // Chrome browsing context browsingContext = this.#chromeNavigables.getObject(id); } else { + // Content browsing context const browser = this.getBrowserById(id); if (browser) { - // top-level browsing context + // Top-level browsing context browsingContext = browser.browsingContext; } else { - browsingContext = BrowsingContext.get(id); + // Content child browsing contexts + const context = BrowsingContext.get(id); + if (context && context.isContent && context.parent) { + browsingContext = context; + } } } diff --git a/remote/shared/NavigationManager.sys.mjs b/remote/shared/NavigationManager.sys.mjs @@ -763,8 +763,7 @@ class NavigationRegistry extends EventEmitter { const { download } = data; const contextId = download.source.browsingContextId; - const browsingContext = - lazy.NavigableManager.getBrowsingContextById(contextId); + const browsingContext = BrowsingContext.get(contextId); if (!browsingContext) { return; } @@ -801,8 +800,7 @@ class NavigationRegistry extends EventEmitter { const { download } = data; const contextId = download.source.browsingContextId; - const browsingContext = - lazy.NavigableManager.getBrowsingContextById(contextId); + const browsingContext = BrowsingContext.get(contextId); if (!browsingContext) { return; }