commit 2dd7e21d0a0c81276d957e4e7417beb190e1d817
parent 1c4dda1d78557e8b6c5c1d95c97481c4aee88770
Author: Henrik Skupin <mail@hskupin.info>
Date: Tue, 4 Nov 2025 14:19:53 +0000
Bug 1774436 - [webdriver-bidi] Move the private "#getBrowsingContext" helper method to the RootBiDiModule class. r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D270699
Diffstat:
9 files changed, 114 insertions(+), 195 deletions(-)
diff --git a/remote/shared/NavigationManager.sys.mjs b/remote/shared/NavigationManager.sys.mjs
@@ -71,8 +71,9 @@ export const NavigationState = {
/**
* @typedef {object} NavigationInfo
* @property {boolean} committed - Whether the navigation was ever committed.
- * @property {string} navigationId - The UUID for the navigation.
+ * @property {string} contextId - ID of the browsing context.
* @property {string} navigable - The UUID for the navigable.
+ * @property {string} navigationId - The UUID for the navigation.
* @property {NavigationState} state - The navigation state.
* @property {string} url - The target url for the navigation.
*/
@@ -216,6 +217,7 @@ class NavigationRegistry extends EventEmitter {
const navigationId = this.#getOrCreateNavigationId(navigableId);
const navigation = this.#createNavigationObject({
+ contextId: context.id,
state: NavigationState.Finished,
navigationId,
url,
@@ -265,7 +267,11 @@ class NavigationRegistry extends EventEmitter {
const navigableId = lazy.NavigableManager.getIdForBrowsingContext(context);
// History updates are immediately done, fire a single event.
- this.emit(NAVIGATION_EVENTS.HistoryUpdated, { navigableId, url });
+ this.emit(NAVIGATION_EVENTS.HistoryUpdated, {
+ contextId: context.id,
+ navigableId,
+ url,
+ });
}
/**
@@ -543,6 +549,7 @@ class NavigationRegistry extends EventEmitter {
);
this.emit(NAVIGATION_EVENTS.NavigationStarted, {
+ contextId: context.id,
navigationId,
navigableId,
url,
@@ -781,6 +788,7 @@ class NavigationRegistry extends EventEmitter {
// via the DownloadManager for consistency and also to enforce having a
// singleton and consistent navigation ids across sessions.
this.emit(NAVIGATION_EVENTS.DownloadStarted, {
+ contextId: browsingContext.id,
navigationId,
navigableId,
suggestedFilename: PathUtils.filename(download.target.path),
@@ -811,6 +819,7 @@ class NavigationRegistry extends EventEmitter {
const canceled = download.canceled || download.error;
this.emit(NAVIGATION_EVENTS.DownloadEnd, {
canceled,
+ contextId: browsingContext.id,
filepath: download.target.path,
navigableId,
navigationId,
diff --git a/remote/webdriver-bidi/modules/RootBiDiModule.sys.mjs b/remote/webdriver-bidi/modules/RootBiDiModule.sys.mjs
@@ -7,6 +7,8 @@ import { Module } from "chrome://remote/content/shared/messagehandler/Module.sys
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
+ error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
+ NavigableManager: "chrome://remote/content/shared/NavigableManager.sys.mjs",
WindowGlobalMessageHandler:
"chrome://remote/content/shared/messagehandler/WindowGlobalMessageHandler.sys.mjs",
});
@@ -36,6 +38,38 @@ export class RootBiDiModule extends Module {
}
/**
+ * Retrieves a browsing context based on its navigable id.
+ *
+ * @see https://w3c.github.io/webdriver-bidi/#get-a-navigable
+ *
+ * @param {string} navigableId
+ * Unique id of the browsing context.
+ *
+ * @returns {BrowsingContext|null}
+ * The browsing context, or null if `navigableId` is null.
+ *
+ * @throws {NoSuchFrameError}
+ * If the browsing context cannot be found.
+ */
+ _getNavigable(navigableId) {
+ if (navigableId === null) {
+ // The WebDriver BiDi specification expects `null` to be
+ // returned if navigable id is `null`.
+ return null;
+ }
+
+ const context = lazy.NavigableManager.getBrowsingContextById(navigableId);
+
+ if (context === null) {
+ throw new lazy.error.NoSuchFrameError(
+ `Browsing Context with id ${navigableId} not found`
+ );
+ }
+
+ return context;
+ }
+
+ /**
* Checks if there is a listener for a specific event and context information.
*
* @param {string} eventName
diff --git a/remote/webdriver-bidi/modules/root/browsingContext.sys.mjs b/remote/webdriver-bidi/modules/root/browsingContext.sys.mjs
@@ -295,7 +295,7 @@ class BrowsingContextModule extends RootBiDiModule {
contextId,
lazy.pprint`Expected "context" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -395,7 +395,7 @@ class BrowsingContextModule extends RootBiDiModule {
contextId,
lazy.pprint`Expected "context" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
const originTypeValues = Object.values(OriginType);
lazy.assert.that(
@@ -838,7 +838,7 @@ class BrowsingContextModule extends RootBiDiModule {
rootId,
lazy.pprint`Expected "root" to be a string, got ${rootId}`
);
- contexts = [this.#getBrowsingContext(rootId)];
+ contexts = [this._getNavigable(rootId)];
} else {
// Return all top-level browsing contexts.
contexts = lazy.TabManager.getBrowsers().map(
@@ -883,7 +883,7 @@ class BrowsingContextModule extends RootBiDiModule {
lazy.pprint`Expected "context" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.boolean(
accept,
@@ -1074,7 +1074,7 @@ class BrowsingContextModule extends RootBiDiModule {
lazy.pprint`Expected "context" to be a string, got ${navigableId}`
);
- const context = this.#getBrowsingContext(navigableId);
+ const context = this._getNavigable(navigableId);
lazy.assert.object(
locator,
@@ -1145,7 +1145,7 @@ class BrowsingContextModule extends RootBiDiModule {
lazy.pprint`got ${contextId}`
);
- const childContext = this.#getBrowsingContext(contextId);
+ const childContext = this._getNavigable(contextId);
if (childContext.parent !== context) {
throw new lazy.error.InvalidArgumentError(
`Expected "locator.context" (${contextId}) to be a direct child context of "context" (${navigableId})`
@@ -1257,7 +1257,7 @@ class BrowsingContextModule extends RootBiDiModule {
);
}
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
// webProgress will be stable even if the context navigates, retrieve it
// immediately before doing any asynchronous call.
@@ -1390,7 +1390,7 @@ class BrowsingContextModule extends RootBiDiModule {
contextId,
lazy.pprint`Expected "context" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
const settings = lazy.print.addDefaultSettings({
background,
@@ -1501,7 +1501,7 @@ class BrowsingContextModule extends RootBiDiModule {
);
}
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
// webProgress will be stable even if the context navigates, retrieve it
// immediately before doing any asynchronous call.
@@ -1623,7 +1623,7 @@ class BrowsingContextModule extends RootBiDiModule {
const navigables = new Set();
if (contextId !== null) {
- const navigable = this.#getBrowsingContext(contextId);
+ const navigable = this._getNavigable(contextId);
lazy.assert.topLevel(
navigable,
`Browsing context with id ${contextId} is not top-level`
@@ -1725,7 +1725,7 @@ class BrowsingContextModule extends RootBiDiModule {
lazy.pprint`Expected "context" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -1933,33 +1933,6 @@ class BrowsingContextModule extends RootBiDiModule {
);
}
- /**
- * Retrieves a browsing context based on its id.
- *
- * @param {number} contextId
- * Id of the browsing context.
- * @returns {BrowsingContext=}
- * The browsing context or null if <var>contextId</var> is null.
- * @throws {NoSuchFrameError}
- * If the browsing context cannot be found.
- */
- #getBrowsingContext(contextId) {
- // The WebDriver BiDi specification expects null to be
- // returned if no browsing context id has been specified.
- if (contextId === null) {
- return null;
- }
-
- const context = lazy.NavigableManager.getBrowsingContextById(contextId);
- if (context === null) {
- throw new lazy.error.NoSuchFrameError(
- `Browsing Context with id ${contextId} not found`
- );
- }
-
- return context;
- }
-
#hasConfigurationForContext(userContext) {
const internalId = lazy.UserContextManager.getInternalIdById(userContext);
const contextDescriptor = {
@@ -2056,8 +2029,15 @@ class BrowsingContextModule extends RootBiDiModule {
#onDownloadEnd = async (eventName, data) => {
if (this.#subscribedEvents.has("browsingContext.downloadEnd")) {
- const { navigationId, navigableId, canceled, filepath, timestamp, url } =
- data;
+ const {
+ canceled,
+ contextId,
+ filepath,
+ navigableId,
+ navigationId,
+ timestamp,
+ url,
+ } = data;
const browsingContextInfo = {
context: navigableId,
@@ -2075,9 +2055,8 @@ class BrowsingContextModule extends RootBiDiModule {
browsingContextInfo.filepath = filepath;
}
- const context = this.#getBrowsingContext(navigableId);
this.#emitContextEventForBrowsingContext(
- context.id,
+ contextId,
"browsingContext.downloadEnd",
browsingContextInfo
);
@@ -2086,8 +2065,14 @@ class BrowsingContextModule extends RootBiDiModule {
#onDownloadStarted = async (eventName, data) => {
if (this.#subscribedEvents.has("browsingContext.downloadWillBegin")) {
- const { navigationId, navigableId, suggestedFilename, timestamp, url } =
- data;
+ const {
+ contextId,
+ navigationId,
+ navigableId,
+ suggestedFilename,
+ timestamp,
+ url,
+ } = data;
const browsingContextInfo = {
context: navigableId,
@@ -2097,9 +2082,8 @@ class BrowsingContextModule extends RootBiDiModule {
url,
};
- const context = this.#getBrowsingContext(navigableId);
this.#emitContextEventForBrowsingContext(
- context.id,
+ contextId,
"browsingContext.downloadWillBegin",
browsingContextInfo
);
@@ -2107,18 +2091,18 @@ class BrowsingContextModule extends RootBiDiModule {
};
#onFragmentNavigated = async (eventName, data) => {
- const { navigationId, navigableId, url } = data;
- const context = this.#getBrowsingContext(navigableId);
-
if (this.#subscribedEvents.has("browsingContext.fragmentNavigated")) {
+ const { contextId, navigationId, navigableId, url } = data;
+
const browsingContextInfo = {
context: navigableId,
navigation: navigationId,
timestamp: Date.now(),
url,
};
+
this.#emitContextEventForBrowsingContext(
- context.id,
+ contextId,
"browsingContext.fragmentNavigated",
browsingContextInfo
);
@@ -2126,17 +2110,17 @@ class BrowsingContextModule extends RootBiDiModule {
};
#onHistoryUpdated = async (eventName, data) => {
- const { navigableId, url } = data;
- const context = this.#getBrowsingContext(navigableId);
-
if (this.#subscribedEvents.has("browsingContext.historyUpdated")) {
+ const { contextId, navigableId, url } = data;
+
const browsingContextInfo = {
context: navigableId,
timestamp: Date.now(),
url,
};
+
this.#emitContextEventForBrowsingContext(
- context.id,
+ contextId,
"browsingContext.historyUpdated",
browsingContextInfo
);
@@ -2158,6 +2142,7 @@ class BrowsingContextModule extends RootBiDiModule {
type: detail.promptType,
userText: detail.userText,
};
+
this.#emitContextEventForBrowsingContext(
contentBrowser.browsingContext.id,
"browsingContext.userPromptClosed",
@@ -2204,15 +2189,16 @@ class BrowsingContextModule extends RootBiDiModule {
};
#onNavigationCommitted = async (eventName, data) => {
- const { navigableId, navigationId, url, contextId } = data;
-
if (this.#subscribedEvents.has("browsingContext.navigationCommitted")) {
+ const { contextId, navigableId, navigationId, url } = data;
+
const eventPayload = {
context: navigableId,
navigation: navigationId,
timestamp: Date.now(),
url,
};
+
this.#emitContextEventForBrowsingContext(
contextId,
"browsingContext.navigationCommitted",
@@ -2222,15 +2208,16 @@ class BrowsingContextModule extends RootBiDiModule {
};
#onNavigationFailed = async (eventName, data) => {
- const { navigableId, navigationId, url, contextId } = data;
-
if (this.#subscribedEvents.has("browsingContext.navigationFailed")) {
+ const { contextId, navigableId, navigationId, url } = data;
+
const eventPayload = {
context: navigableId,
navigation: navigationId,
timestamp: Date.now(),
url,
};
+
this.#emitContextEventForBrowsingContext(
contextId,
"browsingContext.navigationFailed",
@@ -2240,18 +2227,18 @@ class BrowsingContextModule extends RootBiDiModule {
};
#onNavigationStarted = async (eventName, data) => {
- const { navigableId, navigationId, url } = data;
- const context = this.#getBrowsingContext(navigableId);
-
if (this.#subscribedEvents.has("browsingContext.navigationStarted")) {
+ const { contextId, navigableId, navigationId, url } = data;
+
const eventPayload = {
context: navigableId,
navigation: navigationId,
timestamp: Date.now(),
url,
};
+
this.#emitContextEventForBrowsingContext(
- context.id,
+ contextId,
"browsingContext.navigationStarted",
eventPayload
);
diff --git a/remote/webdriver-bidi/modules/root/emulation.sys.mjs b/remote/webdriver-bidi/modules/root/emulation.sys.mjs
@@ -233,7 +233,7 @@ class EmulationModule extends RootBiDiModule {
lazy.pprint`Expected elements of "contexts" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -407,7 +407,7 @@ class EmulationModule extends RootBiDiModule {
lazy.pprint`Expected elements of "contexts" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -619,7 +619,7 @@ class EmulationModule extends RootBiDiModule {
lazy.pprint`Expected elements of "contexts" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -783,7 +783,7 @@ class EmulationModule extends RootBiDiModule {
lazy.pprint`Expected elements of "contexts" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -960,7 +960,7 @@ class EmulationModule extends RootBiDiModule {
lazy.pprint`Expected elements of "contexts" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -1269,17 +1269,6 @@ class EmulationModule extends RootBiDiModule {
return [overridePerContext, overridePerUserContext, overrideGlobal];
}
- #getBrowsingContext(contextId) {
- const context = lazy.NavigableManager.getBrowsingContextById(contextId);
- if (context === null) {
- throw new lazy.error.NoSuchFrameError(
- `Browsing Context with id ${contextId} not found`
- );
- }
-
- return context;
- }
-
/**
* Validate that a string has timezone offset string format
* (e.g. `+10:00` or `-05:00`).
diff --git a/remote/webdriver-bidi/modules/root/input.sys.mjs b/remote/webdriver-bidi/modules/root/input.sys.mjs
@@ -9,9 +9,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
actions: "chrome://remote/content/shared/webdriver/Actions.sys.mjs",
assert: "chrome://remote/content/shared/webdriver/Assert.sys.mjs",
- error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
event: "chrome://remote/content/shared/webdriver/Event.sys.mjs",
- NavigableManager: "chrome://remote/content/shared/NavigableManager.sys.mjs",
pprint: "chrome://remote/content/shared/Format.sys.mjs",
});
@@ -267,12 +265,7 @@ class InputModule extends RootBiDiModule {
lazy.pprint`Expected "context" to be a string, got ${contextId}`
);
- const context = lazy.NavigableManager.getBrowsingContextById(contextId);
- if (!context) {
- throw new lazy.error.NoSuchFrameError(
- `Browsing context with id ${contextId} not found`
- );
- }
+ const context = this._getNavigable(contextId);
// Bug 1821460: Fetch top-level browsing context.
const inputState = this.#getInputState(context);
@@ -313,12 +306,7 @@ class InputModule extends RootBiDiModule {
lazy.pprint`Expected "context" to be a string, got ${contextId}`
);
- const context = lazy.NavigableManager.getBrowsingContextById(contextId);
- if (!context) {
- throw new lazy.error.NoSuchFrameError(
- `Browsing context with id ${contextId} not found`
- );
- }
+ const context = this._getNavigable(contextId);
// Bug 1821460: Fetch top-level browsing context.
const inputState = this.#getInputState(context);
@@ -366,12 +354,7 @@ class InputModule extends RootBiDiModule {
lazy.pprint`Expected "context" to be a string, got ${contextId}`
);
- const context = lazy.NavigableManager.getBrowsingContextById(contextId);
- if (!context) {
- throw new lazy.error.NoSuchFrameError(
- `Browsing context with id ${contextId} not found`
- );
- }
+ const context = this._getNavigable(contextId);
lazy.assert.array(
files,
diff --git a/remote/webdriver-bidi/modules/root/network.sys.mjs b/remote/webdriver-bidi/modules/root/network.sys.mjs
@@ -576,7 +576,7 @@ class NetworkModule extends RootBiDiModule {
contextId,
lazy.pprint`Expected elements of "contexts" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -676,7 +676,7 @@ class NetworkModule extends RootBiDiModule {
contextId,
`Expected elements of "contexts" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -1624,7 +1624,7 @@ class NetworkModule extends RootBiDiModule {
contextId,
lazy.pprint`Expected elements of "contexts" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -1712,7 +1712,7 @@ class NetworkModule extends RootBiDiModule {
contextId,
lazy.pprint`Expected elements of "contexts" to be a string, got ${contextId}`
);
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -1732,7 +1732,7 @@ class NetworkModule extends RootBiDiModule {
}
} else if (contextIds !== NULL) {
for (const contextId of navigables) {
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
this.#extraHeaders.navigableHeaders.set(
context.webProgress,
deserializedHeaders
@@ -2020,23 +2020,6 @@ class NetworkModule extends RootBiDiModule {
return challenges;
}
- #getBrowsingContext(contextId) {
- const context = lazy.NavigableManager.getBrowsingContextById(contextId);
- if (context === null) {
- throw new lazy.error.NoSuchFrameError(
- `Browsing Context with id ${contextId} not found`
- );
- }
-
- if (!context.currentWindowGlobal) {
- throw new lazy.error.NoSuchFrameError(
- `No window found for BrowsingContext with id ${contextId}`
- );
- }
-
- return context;
- }
-
#getCollectedData(requestId, dataType) {
return this.#collectedNetworkData.get(`${requestId}-${dataType}`) || null;
}
diff --git a/remote/webdriver-bidi/modules/root/script.sys.mjs b/remote/webdriver-bidi/modules/root/script.sys.mjs
@@ -208,7 +208,7 @@ class ScriptModule extends RootBiDiModule {
navigables = new Set();
for (const contextId of contextIds) {
- const context = this.#getBrowsingContext(contextId);
+ const context = this._getNavigable(contextId);
lazy.assert.topLevel(
context,
@@ -644,7 +644,7 @@ class ScriptModule extends RootBiDiModule {
contextId,
lazy.pprint`Expected "context" to be a string, got ${contextId}`
);
- destination.id = this.#getBrowsingContext(contextId).id;
+ destination.id = this._getNavigable(contextId).id;
} else {
destination.contextDescriptor = {
type: lazy.ContextDescriptorType.All,
@@ -855,26 +855,9 @@ class ScriptModule extends RootBiDiModule {
return rv;
}
- #getBrowsingContext(contextId) {
- const context = lazy.NavigableManager.getBrowsingContextById(contextId);
- if (context === null) {
- throw new lazy.error.NoSuchFrameError(
- `Browsing Context with id ${contextId} not found`
- );
- }
-
- if (!context.currentWindowGlobal) {
- throw new lazy.error.NoSuchFrameError(
- `No window found for BrowsingContext with id ${contextId}`
- );
- }
-
- return context;
- }
-
async #getContextFromTarget({ contextId, realmId }) {
if (contextId !== null) {
- return this.#getBrowsingContext(contextId);
+ return this._getNavigable(contextId);
}
const destination = {
@@ -886,7 +869,7 @@ class ScriptModule extends RootBiDiModule {
const realm = realms.find(el => el.realm == realmId);
if (realm && realm.context !== null) {
- return this.#getBrowsingContext(realm.context);
+ return this._getNavigable(realm.context);
}
throw new lazy.error.NoSuchFrameError(`Realm with id ${realmId} not found`);
diff --git a/remote/webdriver-bidi/modules/root/session.sys.mjs b/remote/webdriver-bidi/modules/root/session.sys.mjs
@@ -508,6 +508,7 @@ class SessionModule extends RootBiDiModule {
// Do nothing if traversable is already closed or still has another subscription.
const traversable =
lazy.NavigableManager.getBrowsingContextById(traversableId);
+
if (
traversable === null ||
this.#hasSubscriptionByAssociatedUserContext(eventName, traversable) ||
@@ -552,34 +553,6 @@ class SessionModule extends RootBiDiModule {
}
/**
- * Retrieves a navigable based on its id.
- *
- * @see https://w3c.github.io/webdriver-bidi/#get-a-navigable
- *
- * @param {number} navigableId
- * Id of the navigable.
- *
- * @returns {BrowsingContext=}
- * The navigable or null if <var>navigableId</var> is null.
- * @throws {NoSuchFrameError}
- * If the navigable cannot be found.
- */
- #getNavigable(navigableId) {
- if (navigableId === null) {
- return null;
- }
-
- const navigable = lazy.NavigableManager.getBrowsingContextById(navigableId);
- if (!navigable) {
- throw new lazy.error.NoSuchFrameError(
- `Browsing context with id ${navigableId} not found`
- );
- }
-
- return navigable;
- }
-
- /**
* Get a list of navigables by provided ids.
*
* @see https://w3c.github.io/webdriver-bidi/#get-navigables-by-ids
@@ -685,7 +658,7 @@ class SessionModule extends RootBiDiModule {
const result = new Set();
for (const navigableId of navigableIds) {
- result.add(this.#getNavigable(navigableId));
+ result.add(this._getNavigable(navigableId));
}
return result;
diff --git a/remote/webdriver-bidi/modules/root/storage.sys.mjs b/remote/webdriver-bidi/modules/root/storage.sys.mjs
@@ -13,7 +13,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
deserializeBytesValue:
"chrome://remote/content/webdriver-bidi/modules/root/network.sys.mjs",
error: "chrome://remote/content/shared/webdriver/Errors.sys.mjs",
- NavigableManager: "chrome://remote/content/shared/NavigableManager.sys.mjs",
pprint: "chrome://remote/content/shared/Format.sys.mjs",
UserContextManager:
"chrome://remote/content/shared/UserContextManager.sys.mjs",
@@ -629,7 +628,7 @@ class StorageModule extends RootBiDiModule {
if (partitionSpec.type === PartitionType.Context) {
const { context: contextId } = partitionSpec;
- const browsingContext = this.#getBrowsingContext(contextId);
+ const browsingContext = this._getNavigable(contextId);
const principal = Services.scriptSecurityManager.createContentPrincipal(
browsingContext.currentURI,
{}
@@ -697,27 +696,6 @@ class StorageModule extends RootBiDiModule {
}
/**
- * Retrieves a browsing context based on its id.
- *
- * @param {number} contextId
- * Id of the browsing context.
- * @returns {BrowsingContext}
- * The browsing context.
- * @throws {NoSuchFrameError}
- * If the browsing context cannot be found.
- */
- #getBrowsingContext(contextId) {
- const context = lazy.NavigableManager.getBrowsingContextById(contextId);
- if (context === null) {
- throw new lazy.error.NoSuchFrameError(
- `Browsing Context with id ${contextId} not found`
- );
- }
-
- return context;
- }
-
- /**
* Since cookies retrieved from the platform API
* always contain expiry even for session cookies,
* we should check ourselves if it's a session cookie