Index: gc_lang/fr/webext/background.js ================================================================== --- gc_lang/fr/webext/background.js +++ gc_lang/fr/webext/background.js @@ -99,15 +99,17 @@ function handleConnexion (p) { var xPort = p; let iPortId = aConnx.length; // identifier for the port: each port can be found at aConnx[iPortId] aConnx.push(xPort); console.log("Port: " + p.name + ", id: " + iPortId); + console.log(xPort); xPort.onMessage.addListener(function (oRequest) { console.log("[background] message via connexion:"); console.log(oRequest); switch (oRequest.sCommand) { case "getCurrentTabId": + console.log(getCurrentTabId()); xPort.postMessage({sActionDone: "getCurrentTabId", result: "getCurrentTabId()", dInfo: null, bError: false}); break; case "parse": case "parseAndSpellcheck": case "parseAndSpellcheck1": @@ -124,10 +126,16 @@ xPort.postMessage({sActionDone: "newId", result: iPortId}); } browser.runtime.onConnect.addListener(handleConnexion); + +async function getCurrentTabId () { + let xTab = await browser.tabs.getCurrent(); + return xTab.id; +} + /* Context Menu */ browser.contextMenus.create({ @@ -189,23 +197,18 @@ }); xConjWindow.then(onCreated, onError); break; case "conjugueur_tab": xConjTab = browser.tabs.create({ - url: browser.extension.getURL("panel/conjugueur.html"), - pinned: true + url: browser.extension.getURL("panel/conjugueur.html") }); xConjTab.then(onCreated, onError); break; } }); -async function getCurrentTabId () { - let xTab = await browser.tabs.getCurrent(); - return xTab.id; -} /* TESTS ONLY */ async function newwin () {