Skip to content

Commit 7720a4e

Browse files
committed
🎨 Use ProcessArguments module for determining URI to load and tabs to adopt in BrowserTabs
1 parent 0fd1f62 commit 7720a4e

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

‎components/tabs/BrowserTabs.sys.mjs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ const { BrowserTabsUtils } = ChromeUtils.importESModule(
1818
"resource://gre/modules/BrowserTabsUtils.sys.mjs"
1919
);
2020

21+
const { ProcessArguments } = ChromeUtils.importESModule(
22+
"resource://gre/modules/ProcessArguments.sys.mjs"
23+
);
24+
2125
/**
2226
* Clamps a number between a min and max value
2327
* @param {number} value
@@ -445,7 +449,7 @@ BrowserTabs.prototype = {
445449
* @param {boolean} [options.disableTRR] - Disables TRR for resolving host names
446450
* @param {boolean} [options.forceAllowDataURI] - Allows for data: URI navigation
447451
* @param {any} [options.postData] - The POST data to submit with the returned URI (see nsISearchSubmission).
448-
* @param {string} [options.initialBrowsingContextGroupId] - The initial browsing context group ID to use for the browser.
452+
* @param {number} [options.initialBrowsingContextGroupId] - The initial browsing context group ID to use for the browser.
449453
*/
450454
createTab(options) {
451455
if (!options.triggeringPrincipal) {
@@ -928,6 +932,26 @@ BrowserTabs.prototype = {
928932
}
929933
},
930934

935+
/**
936+
* Obtains the tab to adopt
937+
* @returns {BrowserTab}
938+
*/
939+
getTabToAdopt() {
940+
const { tabToAdopt } = ProcessArguments.getArguments(this._win);
941+
942+
return tabToAdopt;
943+
},
944+
945+
/**
946+
* Obtains the URI or URIs to load
947+
* @returns {string | string[]}
948+
*/
949+
getURIToLoad() {
950+
const { uriToLoad } = ProcessArguments.getArguments(this._win);
951+
952+
return uriToLoad;
953+
},
954+
931955
/**
932956
* Creates a browser for the initial load
933957
*
@@ -950,7 +974,7 @@ BrowserTabs.prototype = {
950974
}
951975

952976
// If we are providing a tab for adoption, make sure this is used
953-
const adoptedTab = this._win.gDotInit.getTabToAdopt();
977+
const adoptedTab = this.getTabToAdopt();
954978

955979
// If the adopted tab has a userContextId, we can use that instead
956980
if (adoptedTab && adoptedTab.hasAttribute("usercontextid")) {
@@ -984,7 +1008,7 @@ BrowserTabs.prototype = {
9841008
remoteType = E10SUtils.NOT_REMOTE;
9851009
}
9861010
} else {
987-
let uriToLoad = this._win.gDotInit.uriToLoadPromise;
1011+
let uriToLoad = this.getURIToLoad();
9881012
// If we have a URI to load, we only need the first item
9891013
if (uriToLoad && Array.isArray(uriToLoad)) {
9901014
uriToLoad = uriToLoad[0];

0 commit comments

Comments
 (0)