Solution "Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist"
They recommended that I uninstall my extensions but it didn't work until I tried delaying the content script call with async await.
chrome.runtime.onConnect.addListener( (port) => {
port.onMessage.addListener(async ({ cmd }) => {
if (cmd === "start") {
const [tab] = await chrome.tabs.query({
active: true,
currentWindow: true,
});
//Here called script to the content
let port = **await** chrome.tabs.connect(tab.id, { name: "bg-content_script" });
port.postMessage({ cmd: "scrap" });
}
});
});
........................................
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2tQZWUK
Comments
Post a Comment