File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ import type {
3434 Viewport ,
3535 Target ,
3636 Extension ,
37+ Root ,
3738} from './third_party/index.js' ;
38- import type { DevTools } from './third_party/index.js' ;
3939import { Locator } from './third_party/index.js' ;
4040import { PredefinedNetworkConditions } from './third_party/index.js' ;
4141import { listPages } from './tools/pages.js' ;
Original file line number Diff line number Diff line change @@ -77,6 +77,10 @@ export const listConsoleMessages = definePageTool(cliArgs => {
7777 . describe (
7878 'Set to true to return the preserved messages over the last 3 navigations.' ,
7979 ) ,
80+ serviceWorkerId : zod
81+ . string ( )
82+ . optional ( )
83+ . describe ( 'Filter messages to only return messages of the specified service worker.' ) ,
8084 } ,
8185 blockedByDialog : false ,
8286 handler : async ( request , response ) => {
@@ -85,6 +89,7 @@ export const listConsoleMessages = definePageTool(cliArgs => {
8589 pageIdx : request . params . pageIdx ,
8690 types : request . params . types ,
8791 includePreservedMessages : request . params . includePreservedMessages ,
92+ serviceWorkerId : request . params . serviceWorkerId ,
8893 } ) ;
8994 } ,
9095 } ;
Original file line number Diff line number Diff line change @@ -25,8 +25,14 @@ import {
2525 getTextContent ,
2626 withMcpContext ,
2727 stabilizeStructuredContent ,
28+ extractExtensionId ,
2829} from '../utils.js' ;
2930
31+ const EXTENSION_LOGGING_PATH = path . join (
32+ import . meta. dirname ,
33+ '../../../tests/tools/fixtures/extension-logging' ,
34+ ) ;
35+
3036describe ( 'console' , ( ) => {
3137 before ( async ( ) => {
3238 await loadIssueDescriptions ( ) ;
@@ -60,6 +66,16 @@ describe('console', () => {
6066 await context . triggerExtensionAction ( extensionId ) ;
6167 const worker = await swTarget . worker ( ) ;
6268
69+ // On Windows, the service worker context might not be fully initialized
70+ // with all global APIs yet.
71+ await worker ?. evaluate ( `
72+ (async () => {
73+ while (typeof globalThis.setTimeout !== 'function') {
74+ await new Promise(resolve => Promise.resolve().then(resolve));
75+ }
76+ })()
77+ ` ) ;
78+
6379 await worker ?. evaluate (
6480 `
6581 console.log('Service Worker starting...');
You can’t perform that action at this time.
0 commit comments