Fix iframe marking

This commit is contained in:
Tamius Han 2019-04-13 03:09:29 +02:00
parent 7f349fe985
commit 598dd6cab5
3 changed files with 31 additions and 18 deletions

View File

@ -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') {

View File

@ -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() {

View File

@ -89,7 +89,7 @@
<!-- PANELS/CONTENT -->
<div id="tab-content" class="flex-grow" style="max-width: 480px !important;">
<b>This is some debug stuff. Please remove before release.</b> Site: {{site.host}}<br/>
<b>This is some debug stuff. Please remove before release.</b> Site: {{site && site.host}}<br/>
<small>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.</small>
@ -106,11 +106,11 @@
class=""
:settings="settings"
:scope="selectedTab"
:site="site.host"
:site="site && site.host"
/>
<PerformancePanel v-if="selectedTab === 'performance-metrics'"
:performance="performance" />
<AboutPanel />
<AboutPanel v-if="selectedTab === 'about'" />
</div>
</div>
</div>
@ -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,