Skip to content

Commit

Permalink
🧱 Add linkedBrowser getter to internal tabs to reduce webContents usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kierandrewett committed Nov 17, 2023
1 parent bc3084a commit 6f25fa9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions components/tabs/content/browser-internal-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ class BrowserTab extends MozElements.MozTab {
return parseInt(this.webContents.id);
}

/**
* The linked browser of this tab
*
* @returns {ChromeBrowser}
*/
get linkedBrowser() {
if (!gDot.tabs._isWebContentsBrowserElement(this.webContents)) {
return document.createXULElement("browser");
}

return /** @type {ChromeBrowser} */ (this.webContents);
}

_pinned = false;
get pinned() {
return this._pinned;
Expand Down

0 comments on commit 6f25fa9

Please sign in to comment.