fix merge artifacts. fix build
This commit is contained in:
@@ -619,7 +619,6 @@ function getTabByTargetId(targetId: string): { tabId: number; tab: TabInfo } | u
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
function emitChildDetachesForTab(tabId: number): void {
|
function emitChildDetachesForTab(tabId: number): void {
|
||||||
const childEntries = Array.from(childSessions.entries())
|
const childEntries = Array.from(childSessions.entries())
|
||||||
.filter(([_, parentTab]) => parentTab.tabId === tabId)
|
.filter(([_, parentTab]) => parentTab.tabId === tabId)
|
||||||
|
|||||||
@@ -222,6 +222,24 @@ export async function startPlayWriterCDPRelayServer({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ForwardCdpParams = {
|
||||||
|
method: string
|
||||||
|
sessionId?: string
|
||||||
|
params?: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
function getForwardCdpParams(value: unknown): ForwardCdpParams | undefined {
|
||||||
|
if (!value || typeof value !== 'object') {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
const record = value as { method?: unknown; sessionId?: unknown; params?: unknown }
|
||||||
|
if (typeof record.method !== 'string') {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
const sessionId = typeof record.sessionId === 'string' ? record.sessionId : undefined
|
||||||
|
return { method: record.method, sessionId, params: record.params }
|
||||||
|
}
|
||||||
|
|
||||||
async function sendToExtension({ method, params, timeout = 30000 }: { method: string; params?: unknown; timeout?: number }): Promise<unknown> {
|
async function sendToExtension({ method, params, timeout = 30000 }: { method: string; params?: unknown; timeout?: number }): Promise<unknown> {
|
||||||
if (!extensionWs) {
|
if (!extensionWs) {
|
||||||
throw new Error('Extension not connected')
|
throw new Error('Extension not connected')
|
||||||
@@ -230,14 +248,15 @@ export async function startPlayWriterCDPRelayServer({
|
|||||||
const id = ++extensionMessageId
|
const id = ++extensionMessageId
|
||||||
const message = { id, method, params }
|
const message = { id, method, params }
|
||||||
|
|
||||||
if (method === 'forwardCDPCommand' && params?.method) {
|
const forwardCdpParams = method === 'forwardCDPCommand' ? getForwardCdpParams(params) : undefined
|
||||||
|
if (forwardCdpParams) {
|
||||||
logCdpJson({
|
logCdpJson({
|
||||||
timestamp: new Date().toISOString(),
|
timestamp: new Date().toISOString(),
|
||||||
direction: 'to-extension',
|
direction: 'to-extension',
|
||||||
message: {
|
message: {
|
||||||
method: params.method,
|
method: forwardCdpParams.method,
|
||||||
sessionId: params.sessionId,
|
sessionId: forwardCdpParams.sessionId,
|
||||||
params: params.params,
|
params: forwardCdpParams.params,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user