I'm trying to create a Firefox extension that will open a popup and, when a button is clicked, change some text in the popup to include the author, title, and date of a an article (ie New York Times) by looking through the metadata.
Currently I have this in the popup.js in order to store the title of the article:
browser.tabs.query({currentWindow: true, active: true}).then((tabs) => {
var currentTab = tabs[0];
title = currentTab.window.document.querySelector("meta[property='og:title']");
});
But when I run the popup, it returns an error saying that currentTab.window cannot be defined.