From a114fabfc95f9bfcacdc60a6dbaf19a635fa2aed Mon Sep 17 00:00:00 2001 From: "YUKI \"Piro\" Hiroshi" Date: Wed, 11 Dec 2024 15:14:13 +0900 Subject: [PATCH] Output more debuggable logs --- webextensions/resources/module/tab-preview-frame.js | 10 +++++++--- webextensions/sidebar/tab-preview-tooltip.js | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/webextensions/resources/module/tab-preview-frame.js b/webextensions/resources/module/tab-preview-frame.js index fadea1c50..109604c06 100644 --- a/webextensions/resources/module/tab-preview-frame.js +++ b/webextensions/resources/module/tab-preview-frame.js @@ -314,9 +314,11 @@ try{ } if (message.timestamp < lastTimestamp) { if (message?.logging) - console.log(' => expired, give up to show/update preview'); + console.log(`show tab preview(${message.previewTabId}): expired, give up to show/update preview `, message.timestamp); return true; } + if (message?.logging) + console.log(`show tab preview(${message.previewTabId}): invoked, let's show/update preview `, message.timestamp); lastTimestamp = message.timestamp; preparePanel(); updatePanel(message); @@ -333,14 +335,16 @@ try{ (message.previewTabId && panel.dataset.tabId != message.previewTabId)) { if (message?.logging) - console.log(' => already hidden, nothing to do'); + console.log(`hide tab preview(${message.previewTabId}): already hidden, nothing to do `, message.timestamp); return; } if (message.timestamp < lastTimestamp) { if (message?.logging) - console.log(' => expired, give up to hide preview'); + console.log(`hide tab preview(${message.previewTabId}): expired, give up to hide preview `, message.timestamp); return true; } + if (message?.logging) + console.log(`hide tab preview(${message.previewTabId}): invoked, let's hide preview `, message.timestamp); lastTimestamp = message.timestamp; panel.classList.remove('open'); return true; diff --git a/webextensions/sidebar/tab-preview-tooltip.js b/webextensions/sidebar/tab-preview-tooltip.js index 740b13294..eedc46284 100644 --- a/webextensions/sidebar/tab-preview-tooltip.js +++ b/webextensions/sidebar/tab-preview-tooltip.js @@ -462,7 +462,7 @@ async function onTabSubstanceEnter(event) { if (!event.target.tab) return; - log(`onTabSubstanceEnter(${event.target.tab.id}}) start`); + log(`onTabSubstanceEnter(${event.target.tab.id}}) start `, startAt); hoveringTabIds.add(event.target.tab.id); const tooltipText = event.target.appliedTooltipText; @@ -548,7 +548,7 @@ async function onTabSubstanceLeave(event) { if (!event.target.tab) // the tab was closed while waiting return; - log(`onTabSubstanceLeave(${event.target.tab.id}}) hide tab preview in ${targetTabId || 'sidebar'}`); + log(`onTabSubstanceLeave(${event.target.tab.id}}) hide tab preview in ${targetTabId || 'sidebar'} `, startAt); sendTabPreviewMessage(targetTabId, { type: 'treestyletab:hide-tab-preview', previewTabId: event.target.tab.id,