X-Git-Url: https://git.r.bdr.sh/rbdr/junction/blobdiff_plain/4757c4616d5d7106cd023f06e5e5ba04d01bbb07..refs/heads/rbdr-peer-abstraction:/extension/junction.js diff --git a/extension/junction.js b/extension/junction.js index 16bc9f3..2c32053 100644 --- a/extension/junction.js +++ b/extension/junction.js @@ -2,6 +2,7 @@ const internals = { promisesSupported: !!(window.browser), port: null, + currentUrl: null, icons: { call: { @@ -31,6 +32,7 @@ const internals = { port.postMessage({ action: 'joinAudioCall', data: { + currentUrl: internals.currentUrl, tada: internals.getRoot().runtime.getURL('sounds/tada.wav') } }); @@ -48,6 +50,7 @@ const internals = { onDisconnect() { internals.getRoot().browserAction.setBadgeText({ text: '' }, () => {}); internals.setIcon('call'); + internals.currentUrl = null; internals.port = null; internals.getRoot().browserAction.enable(); }, @@ -56,14 +59,22 @@ const internals = { internals.getRoot().browserAction.disable(); const activeTabs = await internals.getActiveTabs(); + + internals.currentUrl = activeTabs[0].url; const execution = await internals.getRoot().tabs.executeScript(activeTabs[0].id, { - file: '/content_script.js' + file: '/build/content_script.js' + }, () => { + + if (internals.getRoot().runtime.lastError) { + internals.onDisconnect(); + } }); - if (!execution[0]) { + if (execution && !execution[0]) { internals.onDisconnect(); } - }, + } + , hangUp() {