Skip to content

Commit c4f4a31

Browse files
committed
fix: 简化 executeScript 结果的 Promise 处理
await 对非 Promise 值是 no-op,无需额外的 typeof then 守卫
1 parent 1e8b5f4 commit c4f4a31

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/background/detection.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ export const runActivePageDetection = async (tabId: number, options: { force?: b
124124
world: 'MAIN',
125125
files: ['injected/page-detector.iife.js']
126126
})
127-
const rawResult = injection?.[0]?.result
128-
// Firefox may return the raw Promise instead of awaiting it
129-
const page = rawResult && typeof rawResult.then === 'function' ? await rawResult : rawResult
127+
const page = await injection?.[0]?.result
130128
if (!page) return
131129

132130
const augmentedPage = await augmentPageWithWordPressThemeStyles(page)

0 commit comments

Comments
 (0)