Source code

Revision control

Copy as Markdown

Other Tools

browser.runtime.sendNativeMessage("badNativeApi", "errorerrorerror");
async function runTest() {
const response = await browser.runtime.sendNativeMessage(
"browser",
"testPopupMessage"
);
browser.runtime.sendNativeMessage("browser", `response: ${response}`);
const port = browser.runtime.connectNative("browser");
port.onMessage.addListener(response => {
if (response.action === "disconnect") {
port.disconnect();
return;
}
port.postMessage(`response: ${response.message}`);
});
port.postMessage("testPopupPortMessage");
}
runTest();