- const audioElement = document.createElement('audio');
- audioElement.src = source;
- audioElement.autoplay = 'autoplay';
- audioElement.type = type;
- document.querySelector('body').appendChild(audioElement);
+ internals.currentUrl = activeTabs[0].url;
+ if (!internals.injectedScript) {
+ const execution = await internals.getRoot().tabs.executeScript(
+ activeTabs[0].id,
+ {
+ file: "/build/content_script.js",
+ },
+ () => {
+ internals.injectedScript = true;
+ },
+ );
+
+ if (execution && !execution[0]) {
+ internals.onDisconnect();
+ }
+ } else {
+ internals.getRoot().tabs.connect(activeTabs[0].id);
+ }
+ },
+
+ hangUp() {
+ internals.getRoot().browserAction.disable();
+ internals.port.postMessage({
+ action: "hangUp",
+ });