correct promise resolution on scripts.js

This commit is contained in:
idk
2020-12-09 17:59:53 -05:00
parent bc88ca80fd
commit 40899889a0
2 changed files with 2 additions and 3 deletions

View File

@@ -5,15 +5,12 @@ browser.runtime.onMessage.addListener((request) => {
var tag = document.querySelector('meta[http-equiv="i2p-location"]');
console.log(tag);
if (tag) response = tag.content;
return response;
}
if (request.req === 'i2p-torrentlocation') {
const metas = document.getElementsByTagName('meta');
var tag = document.querySelector('meta[http-equiv="i2p-torrentlocation"]');
console.log(tag);
response = i2pTorrent(tag);
return response;
}
return Promise.resolve({ content: response });
});

View File

@@ -821,6 +821,7 @@ function getTabURL(tab) {
.sendMessage(tab.id, { req: "i2p-location" })
.then((response) => {
if (response != undefined) {
console.log("(scrub) i2p-location response object", response);
if (response.content.toUpperCase() != "NO-ALT-LOCATION") {
browser.pageAction.setPopup({
tabId: tab.id,
@@ -848,6 +849,7 @@ function getTabURL(tab) {
.sendMessage(tab.id, { req: "i2p-torrentlocation" })
.then((response) => {
if (response != undefined) {
console.log("(scrub) i2p-location response object", response);
if (response.content.toUpperCase() != "NO-ALT-LOCATION") {
browser.pageAction.setPopup({
tabId: tab.id,