chore(ext): debug logging
This commit is contained in:
@@ -92,10 +92,17 @@ async function queryShouldShowMask(getController: () => PageController): Promise
|
|||||||
tabId,
|
tabId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.debug(`${DEBUG_PREFIX} shouldShowMask query:`, {
|
||||||
|
tabId,
|
||||||
|
url: window.location.href,
|
||||||
|
queryId,
|
||||||
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Set up response listener
|
// Set up response listener
|
||||||
const responsePromise = new Promise<boolean>((resolve) => {
|
const responsePromise = new Promise<boolean>((resolve) => {
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
|
console.debug(`${DEBUG_PREFIX} shouldShowMask query timeout (3s)`)
|
||||||
chrome.runtime.onMessage.removeListener(listener)
|
chrome.runtime.onMessage.removeListener(listener)
|
||||||
resolve(false)
|
resolve(false)
|
||||||
}, 3000)
|
}, 3000)
|
||||||
@@ -118,11 +125,16 @@ async function queryShouldShowMask(getController: () => PageController): Promise
|
|||||||
|
|
||||||
// Wait for response
|
// Wait for response
|
||||||
const shouldShowMask = await responsePromise
|
const shouldShowMask = await responsePromise
|
||||||
console.debug(`${DEBUG_PREFIX} shouldShowMask result:`, shouldShowMask)
|
|
||||||
|
console.debug(`${DEBUG_PREFIX} shouldShowMask response:`, {
|
||||||
|
tabId,
|
||||||
|
shouldShowMask,
|
||||||
|
action: shouldShowMask ? 'showMask' : 'noAction',
|
||||||
|
})
|
||||||
|
|
||||||
if (shouldShowMask) {
|
if (shouldShowMask) {
|
||||||
console.debug(`${DEBUG_PREFIX} Restoring mask after page reload`)
|
|
||||||
await getController().showMask()
|
await getController().showMask()
|
||||||
|
console.debug(`${DEBUG_PREFIX} Mask shown after page load`)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.debug(`${DEBUG_PREFIX} shouldShowMask query failed:`, error)
|
console.debug(`${DEBUG_PREFIX} shouldShowMask query failed:`, error)
|
||||||
|
|||||||
@@ -212,12 +212,24 @@ export class AgentController extends EventTarget {
|
|||||||
*/
|
*/
|
||||||
shouldShowMaskForTab(tabId: number): boolean {
|
shouldShowMaskForTab(tabId: number): boolean {
|
||||||
const agentCurrentTabId = this.tabsManager?.getCurrentTabId()
|
const agentCurrentTabId = this.tabsManager?.getCurrentTabId()
|
||||||
return (
|
const isRunning = this.status === 'running'
|
||||||
this.status === 'running' &&
|
const isBrowserActiveTab = this.browserActiveTabId === tabId
|
||||||
this.windowHasFocus &&
|
const isAgentCurrentTab = agentCurrentTabId === tabId
|
||||||
this.browserActiveTabId === tabId &&
|
const shouldShow = isRunning && this.windowHasFocus && isBrowserActiveTab && isAgentCurrentTab
|
||||||
agentCurrentTabId === tabId
|
|
||||||
)
|
console.debug('[AgentController] shouldShowMaskForTab:', {
|
||||||
|
queryTabId: tabId,
|
||||||
|
agentStatus: this.status,
|
||||||
|
isRunning,
|
||||||
|
windowHasFocus: this.windowHasFocus,
|
||||||
|
browserActiveTabId: this.browserActiveTabId,
|
||||||
|
isBrowserActiveTab,
|
||||||
|
agentCurrentTabId,
|
||||||
|
isAgentCurrentTab,
|
||||||
|
shouldShow,
|
||||||
|
})
|
||||||
|
|
||||||
|
return shouldShow
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export default defineConfig({
|
|||||||
webExt: {
|
webExt: {
|
||||||
chromiumProfile: chromeProfile,
|
chromiumProfile: chromeProfile,
|
||||||
keepProfileChanges: true,
|
keepProfileChanges: true,
|
||||||
|
chromiumArgs: ['--hide-crash-restore-bubble'],
|
||||||
},
|
},
|
||||||
vite: () => ({
|
vite: () => ({
|
||||||
plugins: [tailwindcss()],
|
plugins: [tailwindcss()],
|
||||||
|
|||||||
Reference in New Issue
Block a user