aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-03-19 15:29:49 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2020-04-05 19:57:37 +0300
commitb996d0b1e0838673001db0580430ed4ad6d102f2 (patch)
treea7b044394e9ce5793eab28e05a9163bbced6d7a9
parent4814db8df12598c167b1e97096511f43e32c5e36 (diff)
fix and simplify
-rw-r--r--ext/fg/js/frontend.js1
-rw-r--r--ext/fg/js/popup-proxy.js17
-rw-r--r--ext/fg/js/popup.js2
3 files changed, 7 insertions, 13 deletions
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();
}