From 962c2a381f3dace4d97fd0625504ec841e378354 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Fri, 13 Mar 2020 23:23:08 +0200 Subject: apply all options on profile change --- ext/fg/js/popup.js | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'ext/fg/js/popup.js') diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index d752812e..e6e93a76 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -210,11 +210,9 @@ class Popup { const parentFrameId = (typeof this._frameId === 'number' ? this._frameId : null); this._container.setAttribute('src', chrome.runtime.getURL('/fg/float.html')); this._container.addEventListener('load', () => { - const uniqueId = yomichan.generateId(32); - Popup._listenForDisplayPrepareCompleted(uniqueId, resolve); + this._listenForDisplayPrepareCompleted(resolve); this._invokeApi('prepare', { - options: this._options, popupInfo: { id: this._id, depth: this._depth, @@ -222,8 +220,7 @@ class Popup { }, url: this.url, childrenSupported: this._childrenSupported, - scale: this._contentScale, - uniqueId + scale: this._contentScale }); }); this._observeFullscreen(true); @@ -364,23 +361,12 @@ class Popup { contentWindow.postMessage({action, params, token}, this._targetOrigin); } - static _getFullscreenElement() { - return ( - document.fullscreenElement || - document.msFullscreenElement || - document.mozFullScreenElement || - document.webkitFullscreenElement || - null - ); - } - - static _listenForDisplayPrepareCompleted(uniqueId, resolve) { + _listenForDisplayPrepareCompleted(resolve) { const runtimeMessageCallback = ({action, params}, sender, callback) => { if ( action === 'popupPrepareCompleted' && - typeof params === 'object' && - params !== null && - params.uniqueId === uniqueId + isObject(params) && + params.targetPopupId === this._id ) { chrome.runtime.onMessage.removeListener(runtimeMessageCallback); callback(); @@ -391,6 +377,16 @@ class Popup { chrome.runtime.onMessage.addListener(runtimeMessageCallback); } + static _getFullscreenElement() { + return ( + document.fullscreenElement || + document.msFullscreenElement || + document.mozFullScreenElement || + document.webkitFullscreenElement || + null + ); + } + static _getPositionForHorizontalText(elementRect, width, height, viewport, offsetScale, optionsGeneral) { const preferBelow = (optionsGeneral.popupHorizontalTextPosition === 'below'); const horizontalOffset = optionsGeneral.popupHorizontalOffset * offsetScale; -- cgit v1.2.3 From 6806e7055f312ad1ff382118255ffe1004b7eace Mon Sep 17 00:00:00 2001 From: siikamiika Date: Thu, 19 Mar 2020 00:00:42 +0200 Subject: show iframe popups in root frame --- ext/fg/js/frontend-initialize.js | 21 ++++++++++++++++++++- ext/fg/js/frontend.js | 3 ++- ext/fg/js/popup.js | 19 +++++++++++++++++++ ext/manifest.json | 2 ++ 4 files changed, 43 insertions(+), 2 deletions(-) (limited to 'ext/fg/js/popup.js') diff --git a/ext/fg/js/frontend-initialize.js b/ext/fg/js/frontend-initialize.js index 3a191247..7f70d9c4 100644 --- a/ext/fg/js/frontend-initialize.js +++ b/ext/fg/js/frontend-initialize.js @@ -20,6 +20,7 @@ * Frontend * PopupProxy * PopupProxyHost + * apiForward */ async function main() { @@ -29,7 +30,25 @@ async function main() { const {id, depth=0, parentFrameId, url, proxy=false} = data; let popup; - if (proxy) { + if (!proxy && (window !== window.parent)) { + let rootPopupInformationResolve; + const rootPopupInformationPromise = new Promise((resolve) => (rootPopupInformationResolve = resolve)); + + const runtimeMessageCallback = ({action, params}, sender, callback) => { + if (action === 'rootPopupInformation') { + chrome.runtime.onMessage.removeListener(runtimeMessageCallback); + callback(); + rootPopupInformationResolve(params); + return false; + } + }; + chrome.runtime.onMessage.addListener(runtimeMessageCallback); + apiForward('rootPopupInformationGet'); + + const {popupId, frameId} = await rootPopupInformationPromise; + + popup = new PopupProxy(popupId, 0, null, frameId, url); + } else if (proxy) { popup = new PopupProxy(null, depth + 1, id, parentFrameId, url); } else { const popupHost = new PopupProxyHost(); diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index d6c5eac6..af5341c4 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -52,7 +52,8 @@ class Frontend extends TextScanner { ]); this._runtimeMessageHandlers = new Map([ - ['popupSetVisibleOverride', ({visible}) => { this.popup.setVisibleOverride(visible); }] + ['popupSetVisibleOverride', ({visible}) => { this.popup.setVisibleOverride(visible); }], + ['rootPopupInformationGet', () => { this.popup.broadcastRootPopupInformation(); }] ]); } diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index e6e93a76..e6596a1a 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -17,6 +17,7 @@ */ /* global + * apiForward * apiGetMessageToken * apiInjectStylesheet */ @@ -79,6 +80,20 @@ class Popup { return false; } + async broadcastRootPopupInformation() { + if (this._depth === 0) { + try { + const {frameId} = await this._frameIdPromise; + if (typeof frameId === 'number') { + this._frameId = frameId; + } + } catch (e) { + // NOP + } + apiForward('rootPopupInformation', {popupId: this._id, frameId: this._frameId}); + } + } + async setOptions(options) { this._options = options; this.updateTheme(); @@ -202,6 +217,10 @@ class Popup { // NOP } + if (this._depth === 0) { + apiForward('rootPopupInformation', {popupId: this._id, frameId: this._frameId}); + } + if (this._messageToken === null) { this._messageToken = await apiGetMessageToken(); } diff --git a/ext/manifest.json b/ext/manifest.json index 3cea8647..97d59e49 100644 --- a/ext/manifest.json +++ b/ext/manifest.json @@ -23,9 +23,11 @@ "mixed/js/api.js", "mixed/js/text-scanner.js", "fg/js/document.js", + "fg/js/frontend-api-sender.js", "fg/js/frontend-api-receiver.js", "fg/js/popup.js", "fg/js/source.js", + "fg/js/popup-proxy.js", "fg/js/popup-proxy-host.js", "fg/js/frontend.js", "fg/js/frontend-initialize.js" -- cgit v1.2.3 From b6c4914b79d96b06760093be8957fbb1730eff3b Mon Sep 17 00:00:00 2001 From: siikamiika Date: Thu, 19 Mar 2020 00:24:14 +0200 Subject: simplify popup prepare --- ext/fg/js/popup-proxy-host.js | 10 +++++----- ext/fg/js/popup.js | 28 ++++------------------------ 2 files changed, 9 insertions(+), 29 deletions(-) (limited to 'ext/fg/js/popup.js') diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js index 6f1c13c6..4dc79943 100644 --- a/ext/fg/js/popup-proxy-host.js +++ b/ext/fg/js/popup-proxy-host.js @@ -26,17 +26,17 @@ class PopupProxyHost { constructor() { this._popups = new Map(); this._apiReceiver = null; - this._frameIdPromise = null; + this._frameId = null; } // Public functions async prepare() { - this._frameIdPromise = apiFrameInformationGet(); - const {frameId} = await this._frameIdPromise; + const {frameId} = await apiFrameInformationGet(); if (typeof frameId !== 'number') { return; } + this._frameId = frameId; - this._apiReceiver = new FrontendApiReceiver(`popup-proxy-host#${frameId}`, new Map([ + this._apiReceiver = new FrontendApiReceiver(`popup-proxy-host#${this._frameId}`, new Map([ ['getOrCreatePopup', this._onApiGetOrCreatePopup.bind(this)], ['setOptions', this._onApiSetOptions.bind(this)], ['hide', this._onApiHide.bind(this)], @@ -87,7 +87,7 @@ class PopupProxyHost { } else if (depth === null) { depth = 0; } - const popup = new Popup(id, depth, this._frameIdPromise); + const popup = new Popup(id, depth, this._frameId); if (parent !== null) { popup.setParent(parent); } diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index e6596a1a..5b8724ae 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -23,11 +23,10 @@ */ class Popup { - constructor(id, depth, frameIdPromise) { + constructor(id, depth, frameId) { this._id = id; this._depth = depth; - this._frameIdPromise = frameIdPromise; - this._frameId = null; + this._frameId = frameId; this._parent = null; this._child = null; this._childrenSupported = true; @@ -80,16 +79,8 @@ class Popup { return false; } - async broadcastRootPopupInformation() { + broadcastRootPopupInformation() { if (this._depth === 0) { - try { - const {frameId} = await this._frameIdPromise; - if (typeof frameId === 'number') { - this._frameId = frameId; - } - } catch (e) { - // NOP - } apiForward('rootPopupInformation', {popupId: this._id, frameId: this._frameId}); } } @@ -208,18 +199,7 @@ class Popup { } async _createInjectPromise() { - try { - const {frameId} = await this._frameIdPromise; - if (typeof frameId === 'number') { - this._frameId = frameId; - } - } catch (e) { - // NOP - } - - if (this._depth === 0) { - apiForward('rootPopupInformation', {popupId: this._id, frameId: this._frameId}); - } + this.broadcastRootPopupInformation(); if (this._messageToken === null) { this._messageToken = await apiGetMessageToken(); -- cgit v1.2.3 From b996d0b1e0838673001db0580430ed4ad6d102f2 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Thu, 19 Mar 2020 15:29:49 +0200 Subject: fix and simplify --- ext/fg/js/frontend.js | 1 + ext/fg/js/popup-proxy.js | 17 ++++++----------- ext/fg/js/popup.js | 2 -- 3 files changed, 7 insertions(+), 13 deletions(-) (limited to 'ext/fg/js/popup.js') diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index af5341c4..d6fe7af4 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -77,6 +77,7 @@ class Frontend extends TextScanner { chrome.runtime.onMessage.addListener(this.onRuntimeMessage.bind(this)); this._updateContentScale(); + this.popup.broadcastRootPopupInformation(); } catch (e) { this.onError(e); } diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js index c1ee76ce..242da04c 100644 --- a/ext/fg/js/popup-proxy.js +++ b/ext/fg/js/popup-proxy.js @@ -61,6 +61,10 @@ class PopupProxy { return true; } + broadcastRootPopupInformation() { + // NOP + } + async setOptions(options) { const id = await this._getPopupId(); return await this._invokeHostApi('setOptions', {id, options}); @@ -97,11 +101,11 @@ class PopupProxy { async showContent(elementRect, writingMode, type=null, details=null) { const id = await this._getPopupId(); - let {x, y, width, height} = PopupProxy._convertDOMRectToJson(elementRect); + let {x, y, width, height} = elementRect; if (this._depth === 0) { [x, y] = await PopupProxy._convertIframePointToRootPagePoint(x, y); - elementRect = {x, y, width, height}; } + elementRect = {x, y, width, height}; return await this._invokeHostApi('showContent', {id, elementRect, writingMode, type, details}); } @@ -197,13 +201,4 @@ class PopupProxy { return offset; } - - static _convertDOMRectToJson(domRect) { - return { - x: domRect.x, - y: domRect.y, - width: domRect.width, - height: domRect.height - }; - } } diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 5b8724ae..4c979911 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -199,8 +199,6 @@ class Popup { } async _createInjectPromise() { - this.broadcastRootPopupInformation(); - if (this._messageToken === null) { this._messageToken = await apiGetMessageToken(); } -- cgit v1.2.3 From 9fe1e38afb056164dbcc4369160bb9fd4790a2c0 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sun, 22 Mar 2020 03:29:09 +0200 Subject: refactor --- ext/fg/js/frame-offset-forwarder.js | 15 +++++++++++---- ext/fg/js/frontend-initialize.js | 13 ++++++++----- ext/fg/js/frontend.js | 2 +- ext/fg/js/popup-proxy.js | 6 +++--- ext/fg/js/popup.js | 1 - 5 files changed, 23 insertions(+), 14 deletions(-) (limited to 'ext/fg/js/popup.js') diff --git a/ext/fg/js/frame-offset-forwarder.js b/ext/fg/js/frame-offset-forwarder.js index b3715c2a..09eb89a6 100644 --- a/ext/fg/js/frame-offset-forwarder.js +++ b/ext/fg/js/frame-offset-forwarder.js @@ -22,15 +22,23 @@ class FrameOffsetForwarder { constructor() { - this._forwardFrameOffset = window !== window.parent ? + this._started = false; + + this._forwardFrameOffset = ( + window !== window.parent ? this._forwardFrameOffsetParent.bind(this) : - this._forwardFrameOffsetOrigin.bind(this); + this._forwardFrameOffsetOrigin.bind(this) + ); this._windowMessageHandlers = new Map([ - ['getFrameOffset', ({offset, uniqueId}, e) => { return this._onGetFrameOffset(offset, uniqueId, e); }] + ['getFrameOffset', ({offset, uniqueId}, e) => this._onGetFrameOffset(offset, uniqueId, e)] ]); + } + start() { + if (this._started) { return; } window.addEventListener('message', this.onMessage.bind(this), false); + this._started = true; } async applyOffset(x, y) { @@ -44,7 +52,6 @@ class FrameOffsetForwarder { chrome.runtime.onMessage.removeListener(runtimeMessageCallback); callback(); frameOffsetResolve(params); - return false; } }; chrome.runtime.onMessage.addListener(runtimeMessageCallback); diff --git a/ext/fg/js/frontend-initialize.js b/ext/fg/js/frontend-initialize.js index 777291fe..51fa8d7a 100644 --- a/ext/fg/js/frontend-initialize.js +++ b/ext/fg/js/frontend-initialize.js @@ -40,23 +40,26 @@ async function main() { chrome.runtime.onMessage.removeListener(runtimeMessageCallback); callback(); rootPopupInformationResolve(params); - return false; } }; chrome.runtime.onMessage.addListener(runtimeMessageCallback); - apiForward('rootPopupInformationGet'); + apiForward('rootPopupRequestInformationBroadcast'); const {popupId, frameId} = await rootPopupInformationPromise; - window._frameOffsetForwarder = new FrameOffsetForwarder(); - const applyFrameOffset = window._frameOffsetForwarder.applyOffset.bind(window._frameOffsetForwarder); + const frameOffsetForwarder = new FrameOffsetForwarder(); + frameOffsetForwarder.start(); + const applyFrameOffset = frameOffsetForwarder.applyOffset.bind(frameOffsetForwarder); + popup = new PopupProxy(popupId, 0, null, frameId, url, applyFrameOffset); await popup.prepare(); } else if (proxy) { popup = new PopupProxy(null, depth + 1, id, parentFrameId, url); await popup.prepare(); } else { - window._frameOffsetForwarder = new FrameOffsetForwarder(); + const frameOffsetForwarder = new FrameOffsetForwarder(); + frameOffsetForwarder.start(); + const popupHost = new PopupProxyHost(); await popupHost.prepare(); diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index d6fe7af4..c160b9e3 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -53,7 +53,7 @@ class Frontend extends TextScanner { this._runtimeMessageHandlers = new Map([ ['popupSetVisibleOverride', ({visible}) => { this.popup.setVisibleOverride(visible); }], - ['rootPopupInformationGet', () => { this.popup.broadcastRootPopupInformation(); }] + ['rootPopupRequestInformationBroadcast', () => { this.popup.broadcastRootPopupInformation(); }] ]); } diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js index 73148eee..a25f9183 100644 --- a/ext/fg/js/popup-proxy.js +++ b/ext/fg/js/popup-proxy.js @@ -21,7 +21,7 @@ */ class PopupProxy { - constructor(id, depth, parentId, parentFrameId, url, applyFrameOffset=async (x, y) => [x, y]) { + constructor(id, depth, parentId, parentFrameId, url, applyFrameOffset=null) { this._parentId = parentId; this._parentFrameId = parentFrameId; this._id = id; @@ -81,7 +81,7 @@ class PopupProxy { } async containsPoint(x, y) { - if (this._depth === 0) { + if (this._applyFrameOffset !== null) { [x, y] = await this._applyFrameOffset(x, y); } return await this._invokeHostApi('containsPoint', {id: this._id, x, y}); @@ -89,7 +89,7 @@ class PopupProxy { async showContent(elementRect, writingMode, type=null, details=null) { let {x, y, width, height} = elementRect; - if (this._depth === 0) { + if (this._applyFrameOffset !== null) { [x, y] = await this._applyFrameOffset(x, y); } elementRect = {x, y, width, height}; diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 4c979911..47e32963 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -368,7 +368,6 @@ class Popup { chrome.runtime.onMessage.removeListener(runtimeMessageCallback); callback(); resolve(); - return false; } }; chrome.runtime.onMessage.addListener(runtimeMessageCallback); -- cgit v1.2.3 From c171503d77bbae21ddfa2eb49c6a571440f41763 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Wed, 25 Mar 2020 04:17:17 +0200 Subject: use getTemporaryListenerResult in other places --- ext/fg/js/popup.js | 64 ++++++++++++++++++++++++---------------------------- ext/mixed/js/core.js | 15 ++++++------ 2 files changed, 38 insertions(+), 41 deletions(-) (limited to 'ext/fg/js/popup.js') diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 47e32963..fb3e56b4 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -203,27 +203,38 @@ class Popup { this._messageToken = await apiGetMessageToken(); } - return new Promise((resolve) => { - const parentFrameId = (typeof this._frameId === 'number' ? this._frameId : null); - this._container.setAttribute('src', chrome.runtime.getURL('/fg/float.html')); - this._container.addEventListener('load', () => { - this._listenForDisplayPrepareCompleted(resolve); - - this._invokeApi('prepare', { - popupInfo: { - id: this._id, - depth: this._depth, - parentFrameId - }, - url: this.url, - childrenSupported: this._childrenSupported, - scale: this._contentScale - }); + const popupPreparedPromise = yomichan.getTemporaryListenerResult( + chrome.runtime.onMessage, + ({action, params}, {resolve}) => { + if ( + action === 'popupPrepareCompleted' && + isObject(params) && + params.targetPopupId === this._id + ) { + resolve(); + } + } + ); + + const parentFrameId = (typeof this._frameId === 'number' ? this._frameId : null); + this._container.setAttribute('src', chrome.runtime.getURL('/fg/float.html')); + this._container.addEventListener('load', () => { + this._invokeApi('prepare', { + popupInfo: { + id: this._id, + depth: this._depth, + parentFrameId + }, + url: this.url, + childrenSupported: this._childrenSupported, + scale: this._contentScale }); - this._observeFullscreen(true); - this._onFullscreenChanged(); - this._injectStyles(); }); + this._observeFullscreen(true); + this._onFullscreenChanged(); + this._injectStyles(); + + return popupPreparedPromise; } async _injectStyles() { @@ -358,21 +369,6 @@ class Popup { contentWindow.postMessage({action, params, token}, this._targetOrigin); } - _listenForDisplayPrepareCompleted(resolve) { - const runtimeMessageCallback = ({action, params}, sender, callback) => { - if ( - action === 'popupPrepareCompleted' && - isObject(params) && - params.targetPopupId === this._id - ) { - chrome.runtime.onMessage.removeListener(runtimeMessageCallback); - callback(); - resolve(); - } - }; - chrome.runtime.onMessage.addListener(runtimeMessageCallback); - } - static _getFullscreenElement() { return ( document.fullscreenElement || diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js index 616f48b8..ca37a26a 100644 --- a/ext/mixed/js/core.js +++ b/ext/mixed/js/core.js @@ -278,11 +278,16 @@ const yomichan = (() => { constructor() { super(); - this._isBackendPreparedResolve = null; - this._isBackendPreparedPromise = new Promise((resolve) => (this._isBackendPreparedResolve = resolve)); + this._isBackendPreparedPromise = this.getTemporaryListenerResult( + chrome.runtime.onMessage, + ({action}, {resolve}) => { + if (action === 'backendPrepared') { + resolve(); + } + } + ); this._messageHandlers = new Map([ - ['backendPrepared', this._onBackendPrepared.bind(this)], ['getUrl', this._onMessageGetUrl.bind(this)], ['optionsUpdated', this._onMessageOptionsUpdated.bind(this)], ['zoomChanged', this._onMessageZoomChanged.bind(this)] @@ -362,10 +367,6 @@ const yomichan = (() => { return false; } - _onBackendPrepared() { - this._isBackendPreparedResolve(); - } - _onMessageGetUrl() { return {url: window.location.href}; } -- cgit v1.2.3 From e4fc53480f36b56abba0ab1cb20f6aad7bf4a004 Mon Sep 17 00:00:00 2001 From: siikamiika Date: Sat, 4 Apr 2020 17:32:58 +0300 Subject: move broadcastRootPopupInformation to Frontend --- ext/fg/js/frontend.js | 11 +++++++++-- ext/fg/js/popup-proxy.js | 4 ---- ext/fg/js/popup.js | 11 ++++------- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'ext/fg/js/popup.js') diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index c160b9e3..4e9d474c 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -18,6 +18,7 @@ /* global * TextScanner + * apiForward * apiGetZoom * apiKanjiFind * apiOptionsGet @@ -53,7 +54,7 @@ class Frontend extends TextScanner { this._runtimeMessageHandlers = new Map([ ['popupSetVisibleOverride', ({visible}) => { this.popup.setVisibleOverride(visible); }], - ['rootPopupRequestInformationBroadcast', () => { this.popup.broadcastRootPopupInformation(); }] + ['rootPopupRequestInformationBroadcast', () => { this._broadcastRootPopupInformation(); }] ]); } @@ -77,7 +78,7 @@ class Frontend extends TextScanner { chrome.runtime.onMessage.addListener(this.onRuntimeMessage.bind(this)); this._updateContentScale(); - this.popup.broadcastRootPopupInformation(); + this._broadcastRootPopupInformation(); } catch (e) { this.onError(e); } @@ -257,6 +258,12 @@ class Frontend extends TextScanner { this._updatePopupPosition(); } + _broadcastRootPopupInformation() { + if (!this.popup.isProxy() && this.popup.depth === 0) { + apiForward('rootPopupInformation', {popupId: this.popup.id, frameId: this.popup.frameId}); + } + } + async _updatePopupPosition() { const textSource = this.getCurrentTextSource(); if (textSource !== null && await this.popup.isVisible()) { diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js index 67b0b2c6..cb264af2 100644 --- a/ext/fg/js/popup-proxy.js +++ b/ext/fg/js/popup-proxy.js @@ -64,10 +64,6 @@ class PopupProxy { return true; } - broadcastRootPopupInformation() { - // NOP - } - async setOptions(options) { return await this._invokeHostApi('setOptions', {id: this._id, options}); } diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index fb3e56b4..60dc16dd 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -17,7 +17,6 @@ */ /* global - * apiForward * apiGetMessageToken * apiInjectStylesheet */ @@ -69,6 +68,10 @@ class Popup { return this._depth; } + get frameId() { + return this._frameId; + } + get url() { return window.location.href; } @@ -79,12 +82,6 @@ class Popup { return false; } - broadcastRootPopupInformation() { - if (this._depth === 0) { - apiForward('rootPopupInformation', {popupId: this._id, frameId: this._frameId}); - } - } - async setOptions(options) { this._options = options; this.updateTheme(); -- cgit v1.2.3