From 53aad0bef68bf6930b684fda4a25e1a045cd800e Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 18 Aug 2019 20:51:19 -0400 Subject: Fix messaging issues when iframes are present in the document --- ext/bg/js/api.js | 5 +++++ ext/bg/js/backend.js | 4 ++++ ext/bg/js/search-frontend.js | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) (limited to 'ext/bg') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index 4b2bacd7..b8ef4362 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -205,3 +205,8 @@ function apiForward(action, params, sender) { chrome.tabs.sendMessage(tabId, {action, params}, (response) => resolve(response)); }); } + +function apiFrameInformationGet(sender) { + const frameId = sender.frameId; + return Promise.resolve({frameId}); +} diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 8f99c13a..39fd4288 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -127,6 +127,10 @@ class Backend { forward: ({action, params}) => { forward(apiForward(action, params, sender), callback); + }, + + frameInformationGet: () => { + forward(apiFrameInformationGet(sender), callback); } }; diff --git a/ext/bg/js/search-frontend.js b/ext/bg/js/search-frontend.js index 77aa4052..840a1ea8 100644 --- a/ext/bg/js/search-frontend.js +++ b/ext/bg/js/search-frontend.js @@ -25,8 +25,8 @@ async function searchFrontendSetup() { '/fg/js/api.js', '/fg/js/frontend-api-receiver.js', '/fg/js/popup.js', - '/fg/js/popup-proxy-host.js', '/fg/js/util.js', + '/fg/js/popup-proxy-host.js', '/fg/js/frontend.js' ]; for (const src of scriptSrcs) { -- cgit v1.2.3