diff --git a/src/ext/lib/comms/CommsServer.js b/src/ext/lib/comms/CommsServer.js index 51ef6bc..7112987 100644 --- a/src/ext/lib/comms/CommsServer.js +++ b/src/ext/lib/comms/CommsServer.js @@ -160,7 +160,19 @@ class CommsServer { console.log("[CommsServer.js::processReceivedMessage] Message has 'forward to content script' flag set. Forwarding message as is. Message:", message); } - this.sendToFrame(message, message.targetFrame); + this.sendToFrame(message, message.targetTab, message.targetFrame); + } + if (message.forwardToAll) { + if (Debug.debug && Debug.comms) { + console.log("[CommsServer.js::processReceivedMessage] Message has 'forward to all' flag set. Forwarding message as is. Message:", message); + } + this.sendToAll(message); + } + if (message.forwardToActive) { + if (Debug.debug && Debug.comms) { + console.log("[CommsServer.js::processReceivedMessage] Message has 'forward to active' flag set. Forwarding message as is. Message:", message); + } + this.sendToActive(message) } if (message.cmd === 'announce-zoom') { @@ -175,19 +187,14 @@ class CommsServer { } if (message.cmd === 'get-current-site') { - console.log("CCCCC - ss"); - console.log("[find server] set-current-site — getting site", this.server.getVideoTab(), this.toObject(this.server.getVideoTab())) port.postMessage({ cmd: 'set-current-site', site: this.server.getVideoTab(), tabHostname: await this.getCurrentTabHostname() }); - console.log("CCCCC -s as") } if (message.cmd === 'popup-set-selected-tab') { - console.log("CCCCaa") this.server.setSelectedTab(message.selectedMenu, message.selectedSubitem); - console.log("CCCCbb") } if (message.cmd === 'get-config') { diff --git a/src/ext/uw-bg.js b/src/ext/uw-bg.js index b43f6e1..2649734 100644 --- a/src/ext/uw-bg.js +++ b/src/ext/uw-bg.js @@ -209,13 +209,10 @@ class UWServer { } setSelectedTab(menu, subitem) { - console.log("CCCC1") if (Debug.debug && Debug.comms) { console.log("[uw-bg::setSelectedTab] saving selected tab for", menu, ":", subitem) } - console.log("CCCC2") this.selectedSubitem[menu] = subitem; - console.log("CCCC3") } getVideoTab() { diff --git a/src/popup/App.vue b/src/popup/App.vue index ded03bc..969fe39 100644 --- a/src/popup/App.vue +++ b/src/popup/App.vue @@ -89,7 +89,7 @@
- This is some debug stuff. Please remove before release. Site: {{site.host}}
+ This is some debug stuff. Please remove before release. Site: {{site && site.host}}
NOTE: in case you're using nightly builds, this extension could be completely broken. It's also possible that everything is getting logged excessively, which may result in degraded performance. If settings don't persist, check whether Debug.flushStorageSettings is set to true. @@ -106,11 +106,11 @@ class="" :settings="settings" :scope="selectedTab" - :site="site.host" + :site="site && site.host" /> - +
@@ -146,20 +146,28 @@ export default { }, async created() { await this.settings.init(); + console.log("\n\n\n\n\n\n\nset init") this.port.onMessage.addListener( (m,p) => this.processReceivedMessage(m,p)); this.execAction.setSettings(this.settings); - // get info about current site from background script - while (true) { - this.getSite(); - await this.sleep(5000); - } // ensure we'll clean player markings on popup close window.addEventListener("unload", () => { - port.postMessage({ + console.log("UNLOAD!!das!!") + this.port.postMessage({ cmd: 'unmark-player', + forwardToAll: true, }); }); + + // get info about current site from background script + while (true) { + try { + this.getSite(); + } catch (e) { + + } + await this.sleep(5000); + } }, components: { VideoPanel, @@ -252,6 +260,7 @@ export default { this.port.postMessage({ cmd: 'mark-player', + forwardToContentScript: true, targetTab: videoTab.id, targetFrame: frame, name: fs.name,