aboutsummaryrefslogtreecommitdiff
path: root/ext/js/app/frontend.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-18 07:58:59 -0500
committerGitHub <noreply@github.com>2024-02-18 12:58:59 +0000
commit7e9f7e2616973418cc50f7706bd8f644cb9d5559 (patch)
tree8f8bec7a777a2df33a0a26ef53022c50d2327ef8 /ext/js/app/frontend.js
parent4aaa9f15d97668203741c1731f15e710ae8b8294 (diff)
Application data refactor (#699)
* Pass tabId and frameId to Application * Remove casts * Remove redundant frameInformationGet calls * Expose tabId and frameId * Remove unsed * Simplify * Update FrameAncestryHandler to not need a direct frameId * Remove frameId from FrameOffsetForwarder * Remove frameId from PopupFactory * Remove frameId from Frontend * Remove frameId from PopupPreviewFrame * Fix PopupFactory and Frontend constructor * Remove frameId from Display * Remove frameId from SearchDisplayController * Restore if check
Diffstat (limited to 'ext/js/app/frontend.js')
-rw-r--r--ext/js/app/frontend.js23
1 files changed, 10 insertions, 13 deletions
diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js
index 84a8f1e6..1a3fbbe1 100644
--- a/ext/js/app/frontend.js
+++ b/ext/js/app/frontend.js
@@ -39,8 +39,6 @@ export class Frontend {
pageType,
popupFactory,
depth,
- tabId,
- frameId,
parentPopupId,
parentFrameId,
useProxyPopup,
@@ -57,10 +55,6 @@ export class Frontend {
this._popupFactory = popupFactory;
/** @type {number} */
this._depth = depth;
- /** @type {number|undefined} */
- this._tabId = tabId;
- /** @type {number} */
- this._frameId = frameId;
/** @type {?string} */
this._parentPopupId = parentPopupId;
/** @type {?number} */
@@ -588,8 +582,13 @@ export class Frontend {
return null;
}
+ const {frameId} = this._application;
+ if (frameId === null) {
+ return null;
+ }
+
return await this._popupFactory.getOrCreatePopup({
- frameId: this._frameId,
+ frameId,
depth: this._depth,
childrenSupported: this._childrenSupported
});
@@ -703,12 +702,10 @@ export class Frontend {
};
if (sentence !== null) { detailsState.sentence = sentence; }
if (documentTitle !== null) { detailsState.documentTitle = documentTitle; }
+ const {tabId, frameId} = this._application;
/** @type {import('display').HistoryContent} */
const detailsContent = {
- contentOrigin: {
- tabId: this._tabId,
- frameId: this._frameId
- }
+ contentOrigin: {tabId, frameId}
};
if (dictionaryEntries !== null) {
detailsContent.dictionaryEntries = dictionaryEntries;
@@ -819,7 +816,7 @@ export class Frontend {
*/
_signalFrontendReady(targetFrameId) {
/** @type {import('application').ApiMessageNoFrameId<'frontendReady'>} */
- const message = {action: 'frontendReady', params: {frameId: this._frameId}};
+ const message = {action: 'frontendReady', params: {frameId: this._application.frameId}};
if (targetFrameId === null) {
this._application.api.broadcastTab(message);
} else {
@@ -867,7 +864,7 @@ export class Frontend {
}
chrome.runtime.onMessage.addListener(onMessage);
- this._application.api.broadcastTab({action: 'frontendRequestReadyBroadcast', params: {frameId: this._frameId}});
+ this._application.api.broadcastTab({action: 'frontendRequestReadyBroadcast', params: {frameId: this._application.frameId}});
});
}