aboutsummaryrefslogtreecommitdiff
path: root/extension/junction.js
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2020-09-27 22:36:52 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2020-09-27 22:36:52 +0200
commit02071d8e6e45dd253298d2e450ecfffacccaec19 (patch)
treeac0e8bdc0f3a8e326d6e0fc24c7e8656dc00ad24 /extension/junction.js
parent93fe1aee43a79a23d4c418c230fde0e451259279 (diff)
Fix rooms and force ws protocol
Diffstat (limited to 'extension/junction.js')
-rw-r--r--extension/junction.js17
1 files changed, 13 insertions, 4 deletions
diff --git a/extension/junction.js b/extension/junction.js
index f3e1fb4..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();
},
@@ -57,13 +60,19 @@ const internals = {
internals.getRoot().browserAction.disable();
const activeTabs = await internals.getActiveTabs();
- const execution = await internals.getRoot().tabs.executeScript(activeTabs[0].id, {
- file: '/build/content_script.js'
- });
+ internals.currentUrl = activeTabs[0].url;
+ const execution = await internals.getRoot().tabs.executeScript(activeTabs[0].id, {
+ file: '/build/content_script.js'
+ }, () => {
- if (!execution || !execution[0]) {
+ if (internals.getRoot().runtime.lastError) {
internals.onDisconnect();
}
+ });
+
+ if (execution && !execution[0]) {
+ internals.onDisconnect();
+ }
}
,