chrome-devtools-frontend 1.0.1650100 → 1.0.1650677
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/version-control/SKILL.md +5 -1
- package/config/typescript/tsconfig.base.json +1 -0
- package/front_end/core/host/InspectorFrontendHostAPI.ts +0 -1
- package/front_end/core/host/UserMetrics.ts +0 -26
- package/front_end/core/sdk/CSSMetadata.ts +72 -0
- package/front_end/devtools_compatibility.js +1 -2
- package/front_end/foundation/Universe.ts +7 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +11 -1
- package/front_end/models/ai_assistance/README.md +4 -0
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +2 -0
- package/front_end/models/ai_assistance/agents/AiAgent.ts +3 -0
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +13 -4
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +3 -7
- package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
- package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
- package/front_end/models/ai_assistance/skills/accessibility.md +13 -0
- package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +54 -0
- package/front_end/models/ai_assistance/tools/ResolveLighthousePath.ts +124 -0
- package/front_end/models/ai_assistance/tools/Tool.ts +12 -2
- package/front_end/models/ai_assistance/tools/ToolRegistry.ts +4 -0
- package/front_end/models/persistence/NetworkPersistenceManager.ts +9 -1
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +3 -11
- package/front_end/panels/common/ExtensionServer.ts +70 -50
- package/front_end/panels/elements/ElementsPanel.ts +1 -1
- package/front_end/panels/js_timeline/js_timeline-meta.ts +1 -2
- package/front_end/panels/network/RequestConditionsDrawer.ts +236 -198
- package/front_end/panels/network/RequestHeadersView.ts +2 -2
- package/front_end/panels/network/components/RequestHeadersView.css +1 -0
- package/front_end/panels/network/components/ResponseHeaderSection.css +5 -1
- package/front_end/panels/network/requestConditionsDrawer.css +3 -0
- package/front_end/panels/recorder/testing/RecorderHelpers.ts +2 -0
- package/front_end/panels/timeline/timeline-meta.ts +1 -1
- package/front_end/panels/whats_new/ReleaseNoteText.ts +12 -6
- package/front_end/panels/whats_new/resources/WNDT.md +8 -7
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/README.md +14 -0
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +60 -24
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +271 -164
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +2 -6
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.js +11 -7
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.js +3 -10
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +9 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +4 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/WebWorker.d.ts +13 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/WebWorker.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/WebWorker.js +14 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/WebWorker.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js +5 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserConnector.js +5 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserContext.js +6 -6
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Deserializer.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Deserializer.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ExposedFunction.js +6 -6
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ExposedFunction.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Frame.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Realm.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Realm.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js +11 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Accessibility.js +4 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Binding.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Binding.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +13 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/BrowserConnector.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ElementHandle.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/EmulationManager.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/EmulationManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/EmulationManager.js +25 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/EmulationManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ExecutionContext.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ExecutionContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Extension.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Extension.js +9 -11
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Extension.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js +7 -7
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/JSHandle.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/JSHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts +3 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js +18 -10
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js +17 -11
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/TargetManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/TargetManager.js +28 -10
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/TargetManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.js +10 -6
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebWorker.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebWorker.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebWorker.js +20 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebWorker.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js +11 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/CallbackRegistry.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/CallbackRegistry.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Configuration.d.ts +4 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Configuration.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts +26 -13
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts +1 -6
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js +24 -33
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts +8 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js +8 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/environment.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/environment.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/environment.js +4 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/environment.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/TextContent.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/TextContent.js +15 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/TextContent.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts +5 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +17 -16
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js +14 -9
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/FirefoxLauncher.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/FirefoxLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/PipeTransport.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/PipeTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts +20 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js +38 -9
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node-env-setup.d.ts +7 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node-env-setup.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node-env-setup.js +16 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node-env-setup.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/puppeteer-core.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/puppeteer-core.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/puppeteer-core.js +3 -8
- package/front_end/third_party/puppeteer/package/lib/puppeteer/puppeteer-core.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +60 -24
- package/front_end/third_party/puppeteer/package/package.json +4 -4
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +4 -8
- package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/api/HTTPRequest.ts +10 -10
- package/front_end/third_party/puppeteer/package/src/api/JSHandle.ts +3 -10
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +14 -8
- package/front_end/third_party/puppeteer/package/src/api/WebWorker.ts +30 -0
- package/front_end/third_party/puppeteer/package/src/api/locators/locators.ts +5 -5
- package/front_end/third_party/puppeteer/package/src/bidi/BidiOverCdp.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/bidi/BrowserConnector.ts +5 -3
- package/front_end/third_party/puppeteer/package/src/bidi/BrowserContext.ts +6 -6
- package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +4 -4
- package/front_end/third_party/puppeteer/package/src/bidi/Deserializer.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/bidi/ExposedFunction.ts +6 -6
- package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +4 -0
- package/front_end/third_party/puppeteer/package/src/bidi/Realm.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +11 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +6 -4
- package/front_end/third_party/puppeteer/package/src/cdp/Binding.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +14 -2
- package/front_end/third_party/puppeteer/package/src/cdp/BrowserConnector.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/cdp/Connection.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/cdp/Coverage.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/cdp/ElementHandle.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/EmulationManager.ts +36 -4
- package/front_end/third_party/puppeteer/package/src/cdp/ExecutionContext.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/cdp/Extension.ts +16 -17
- package/front_end/third_party/puppeteer/package/src/cdp/Frame.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +12 -7
- package/front_end/third_party/puppeteer/package/src/cdp/HTTPRequest.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/JSHandle.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +22 -11
- package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +18 -10
- package/front_end/third_party/puppeteer/package/src/cdp/Target.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/cdp/TargetManager.ts +37 -12
- package/front_end/third_party/puppeteer/package/src/cdp/WebMCP.ts +11 -9
- package/front_end/third_party/puppeteer/package/src/cdp/WebWorker.ts +33 -5
- package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +11 -0
- package/front_end/third_party/puppeteer/package/src/common/BrowserWebSocketTransport.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/common/CallbackRegistry.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/common/Configuration.ts +4 -2
- package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +26 -13
- package/front_end/third_party/puppeteer/package/src/common/Debug.ts +30 -40
- package/front_end/third_party/puppeteer/package/src/common/EventEmitter.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/common/util.ts +9 -1
- package/front_end/third_party/puppeteer/package/src/environment.ts +7 -3
- package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/injected/TextContent.ts +15 -5
- package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +23 -23
- package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +19 -13
- package/front_end/third_party/puppeteer/package/src/node/FirefoxLauncher.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/node/NodeWebSocketTransport.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/node/PipeTransport.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/node/ScreenRecorder.ts +44 -9
- package/front_end/third_party/puppeteer/package/src/node-env-setup.ts +18 -0
- package/front_end/third_party/puppeteer/package/src/puppeteer-core.ts +5 -9
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +1 -0
- package/front_end/third_party/third-party-web/lib/nostats-subset.js +21 -15
- package/front_end/third_party/third-party-web/package/README.md +619 -582
- package/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +1 -1
- package/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +1 -1
- package/front_end/third_party/third-party-web/package/dist/entities-nostats.json +1 -1
- package/front_end/third_party/third-party-web/package/dist/entities.json +1 -1
- package/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +27 -15
- package/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +14 -0
- package/front_end/third_party/third-party-web/package/lib/entities.test.js +10 -0
- package/front_end/third_party/third-party-web/package/lib/index.test.js +6 -6
- package/front_end/third_party/third-party-web/package/lib/markdown/template.md +1 -3
- package/front_end/third_party/third-party-web/package/package.json +7 -3
- package/front_end/third_party/third-party-web/package.json +1 -1
- package/front_end/tsconfig.json +1 -2
- package/front_end/ui/components/buttons/floatingButton.css +3 -3
- package/front_end/ui/components/lists/list.css +2 -0
- package/front_end/ui/legacy/ListWidget.ts +8 -5
- package/front_end/ui/legacy/TextPrompt.ts +5 -2
- package/front_end/ui/legacy/textPrompt.css +1 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
- package/inspector_overlay/tsconfig.json +3 -10
- package/mcp/tsconfig.json +1 -5
- package/package.json +1 -2
|
@@ -11,11 +11,10 @@ import type {ElementHandle} from '../api/ElementHandle.js';
|
|
|
11
11
|
import type {Frame} from '../api/Frame.js';
|
|
12
12
|
import type {ConsoleMessageLocation} from '../common/ConsoleMessage.js';
|
|
13
13
|
import {EventEmitter} from '../common/EventEmitter.js';
|
|
14
|
-
import {debugError} from '../common/util.js';
|
|
14
|
+
import {debugError, debugCatchError} from '../common/util.js';
|
|
15
15
|
|
|
16
16
|
import type {CdpFrame} from './Frame.js';
|
|
17
17
|
import type {FrameManager} from './FrameManager.js';
|
|
18
|
-
import {FrameManagerEvent} from './FrameManagerEvents.js';
|
|
19
18
|
import {MAIN_WORLD} from './IsolatedWorlds.js';
|
|
20
19
|
|
|
21
20
|
/**
|
|
@@ -235,7 +234,7 @@ export class WebMCPToolCall {
|
|
|
235
234
|
this.input = JSON.parse(input);
|
|
236
235
|
} catch (error) {
|
|
237
236
|
this.input = {};
|
|
238
|
-
debugError(error);
|
|
237
|
+
debugError?.(error);
|
|
239
238
|
}
|
|
240
239
|
}
|
|
241
240
|
}
|
|
@@ -317,6 +316,7 @@ export class WebMCP extends EventEmitter<{
|
|
|
317
316
|
const frameTools = this.#tools.get(tool.frameId) ?? new Map();
|
|
318
317
|
if (!this.#tools.has(tool.frameId)) {
|
|
319
318
|
this.#tools.set(tool.frameId, frameTools);
|
|
319
|
+
this.#listenToContextDestroyed(frame as CdpFrame);
|
|
320
320
|
}
|
|
321
321
|
|
|
322
322
|
const addedTool = new WebMCPTool(this, tool, frame);
|
|
@@ -366,7 +366,7 @@ export class WebMCP extends EventEmitter<{
|
|
|
366
366
|
this.emit('toolresponded', response);
|
|
367
367
|
};
|
|
368
368
|
|
|
369
|
-
#
|
|
369
|
+
#onContextDisposed = (frame: CdpFrame) => {
|
|
370
370
|
this.#pendingCalls.clear();
|
|
371
371
|
const frameTools = this.#tools.get(frame._id);
|
|
372
372
|
if (!frameTools) {
|
|
@@ -379,6 +379,12 @@ export class WebMCP extends EventEmitter<{
|
|
|
379
379
|
}
|
|
380
380
|
};
|
|
381
381
|
|
|
382
|
+
#listenToContextDestroyed(frame: CdpFrame): void {
|
|
383
|
+
frame.mainRealm().context?.once('disposed', () => {
|
|
384
|
+
this.#onContextDisposed(frame);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
|
|
382
388
|
/**
|
|
383
389
|
* @internal
|
|
384
390
|
*/
|
|
@@ -386,10 +392,6 @@ export class WebMCP extends EventEmitter<{
|
|
|
386
392
|
super();
|
|
387
393
|
this.#client = client;
|
|
388
394
|
this.#frameManager = frameManager;
|
|
389
|
-
this.#frameManager.on(
|
|
390
|
-
FrameManagerEvent.FrameNavigated,
|
|
391
|
-
this.#onFrameNavigated,
|
|
392
|
-
);
|
|
393
395
|
this.#bindListeners();
|
|
394
396
|
}
|
|
395
397
|
|
|
@@ -397,7 +399,7 @@ export class WebMCP extends EventEmitter<{
|
|
|
397
399
|
* @internal
|
|
398
400
|
*/
|
|
399
401
|
async initialize(): Promise<void> {
|
|
400
|
-
return await this.#client.send('WebMCP.enable').catch(
|
|
402
|
+
return await this.#client.send('WebMCP.enable').catch(debugCatchError);
|
|
401
403
|
}
|
|
402
404
|
|
|
403
405
|
/**
|
|
@@ -15,7 +15,9 @@ import {
|
|
|
15
15
|
} from '../api/WebWorker.js';
|
|
16
16
|
import {EventEmitter} from '../common/EventEmitter.js';
|
|
17
17
|
import {TimeoutSettings} from '../common/TimeoutSettings.js';
|
|
18
|
-
import {debugError} from '../common/util.js';
|
|
18
|
+
import {debugError, debugCatchError} from '../common/util.js';
|
|
19
|
+
import type {EvaluateFunc, HandleFor} from '../index-browser.js';
|
|
20
|
+
import {Deferred} from '../util/Deferred.js';
|
|
19
21
|
|
|
20
22
|
import {ExecutionContext} from './ExecutionContext.js';
|
|
21
23
|
import {IsolatedWorld} from './IsolatedWorld.js';
|
|
@@ -39,6 +41,7 @@ export class CdpWebWorker extends WebWorker {
|
|
|
39
41
|
readonly #id: string;
|
|
40
42
|
readonly #targetType: TargetType;
|
|
41
43
|
readonly #emitter: EventEmitter<WebWorkerEvents>;
|
|
44
|
+
#workerLoaded = new Deferred<void>();
|
|
42
45
|
|
|
43
46
|
get internalEmitter(): EventEmitter<WebWorkerEvents> {
|
|
44
47
|
return this.#emitter;
|
|
@@ -64,6 +67,10 @@ export class CdpWebWorker extends WebWorker {
|
|
|
64
67
|
new ExecutionContext(client, event.context, this.#world),
|
|
65
68
|
);
|
|
66
69
|
});
|
|
70
|
+
this.#client.once('Inspector.workerScriptLoaded', () => {
|
|
71
|
+
this.#workerLoaded.resolve();
|
|
72
|
+
});
|
|
73
|
+
|
|
67
74
|
this.#world.emitter.on('consoleapicalled', async event => {
|
|
68
75
|
try {
|
|
69
76
|
const values = event.args.map(arg => {
|
|
@@ -79,7 +86,7 @@ export class CdpWebWorker extends WebWorker {
|
|
|
79
86
|
// eslint-disable-next-line max-len -- The comment is long.
|
|
80
87
|
// eslint-disable-next-line @puppeteer/use-using -- These are not owned by this function.
|
|
81
88
|
for (const value of values) {
|
|
82
|
-
void value.dispose().catch(
|
|
89
|
+
void value.dispose().catch(debugCatchError);
|
|
83
90
|
}
|
|
84
91
|
return;
|
|
85
92
|
}
|
|
@@ -90,7 +97,7 @@ export class CdpWebWorker extends WebWorker {
|
|
|
90
97
|
this.emit(WebWorkerEvent.Console, consoleMessages);
|
|
91
98
|
}
|
|
92
99
|
} catch (err) {
|
|
93
|
-
debugError(err);
|
|
100
|
+
debugError?.(err);
|
|
94
101
|
}
|
|
95
102
|
});
|
|
96
103
|
this.#client.on('Runtime.exceptionThrown', exceptionThrown);
|
|
@@ -99,8 +106,10 @@ export class CdpWebWorker extends WebWorker {
|
|
|
99
106
|
});
|
|
100
107
|
|
|
101
108
|
// This might fail if the target is closed before we receive all execution contexts.
|
|
102
|
-
networkManager
|
|
103
|
-
|
|
109
|
+
networkManager
|
|
110
|
+
?.addClient(this.#client)
|
|
111
|
+
.catch(debugCatchError ?? (() => {}));
|
|
112
|
+
this.#client.send('Runtime.enable').catch(debugCatchError ?? (() => {}));
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
mainRealm(): Realm {
|
|
@@ -136,4 +145,23 @@ export class CdpWebWorker extends WebWorker {
|
|
|
136
145
|
});
|
|
137
146
|
}
|
|
138
147
|
}
|
|
148
|
+
|
|
149
|
+
override async evaluate<
|
|
150
|
+
Params extends unknown[],
|
|
151
|
+
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
|
152
|
+
>(func: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>> {
|
|
153
|
+
await this.#workerLoaded.valueOrThrow();
|
|
154
|
+
return await super.evaluate(func, ...args);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
override async evaluateHandle<
|
|
158
|
+
Params extends unknown[],
|
|
159
|
+
Func extends EvaluateFunc<Params> = EvaluateFunc<Params>,
|
|
160
|
+
>(
|
|
161
|
+
func: Func | string,
|
|
162
|
+
...args: Params
|
|
163
|
+
): Promise<HandleFor<Awaited<ReturnType<Func>>>> {
|
|
164
|
+
await this.#workerLoaded.valueOrThrow();
|
|
165
|
+
return await super.evaluateHandle(func, ...args);
|
|
166
|
+
}
|
|
139
167
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import {URLPattern} from '../../third_party/urlpattern-polyfill/urlpattern-polyfill.js';
|
|
7
8
|
import type {Browser} from '../api/Browser.js';
|
|
8
9
|
import {_connectToBiDiBrowser} from '../bidi/BrowserConnector.js';
|
|
9
10
|
import {_connectToCdpBrowser} from '../cdp/BrowserConnector.js';
|
|
@@ -43,6 +44,16 @@ export function assertSupportedUrlRestrictions(options: {
|
|
|
43
44
|
'blocklist and allowlist are only supported with the CDP protocol',
|
|
44
45
|
);
|
|
45
46
|
}
|
|
47
|
+
if (options.blocklist) {
|
|
48
|
+
for (const rule of options.blocklist) {
|
|
49
|
+
new URLPattern(rule);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (options.allowlist) {
|
|
53
|
+
for (const rule of options.allowlist) {
|
|
54
|
+
new URLPattern(rule);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
46
57
|
}
|
|
47
58
|
|
|
48
59
|
export async function _connectToBrowser(
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type {ConnectionTransport} from './ConnectionTransport.js';
|
|
7
|
-
import {
|
|
7
|
+
import {debugCatchError} from './util.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @internal
|
|
@@ -38,7 +38,7 @@ export class BrowserWebSocketTransport implements ConnectionTransport {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
// Silently log all errors - we don't know what to do with them.
|
|
41
|
-
this.#ws.addEventListener('error',
|
|
41
|
+
this.#ws.addEventListener('error', debugCatchError);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
send(message: string): void {
|
|
@@ -9,7 +9,7 @@ import {rewriteError} from '../util/ErrorLike.js';
|
|
|
9
9
|
import type {GetIdFn} from '../util/incremental-id-generator.js';
|
|
10
10
|
|
|
11
11
|
import {ProtocolError, TargetCloseError} from './Errors.js';
|
|
12
|
-
import {
|
|
12
|
+
import {debugCatchError} from './util.js';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Manages callbacks and their IDs for the protocol request/response communication.
|
|
@@ -40,7 +40,7 @@ export class CallbackRegistry {
|
|
|
40
40
|
} catch (error) {
|
|
41
41
|
// We still throw sync errors synchronously and clean up the scheduled
|
|
42
42
|
// callback.
|
|
43
|
-
callback.promise.catch(
|
|
43
|
+
void callback.promise.catch(debugCatchError).finally(() => {
|
|
44
44
|
this.#callbacks.delete(callback.id);
|
|
45
45
|
});
|
|
46
46
|
callback.reject(error as Error);
|
|
@@ -58,9 +58,11 @@ export interface Configuration {
|
|
|
58
58
|
*/
|
|
59
59
|
temporaryDirectory?: string;
|
|
60
60
|
/**
|
|
61
|
-
* Tells Puppeteer to not download during installation.
|
|
61
|
+
* Tells Puppeteer to not download any of the browsers during installation.
|
|
62
62
|
*
|
|
63
|
-
* Can be overridden by `PUPPETEER_SKIP_DOWNLOAD
|
|
63
|
+
* Can be overridden by `PUPPETEER_SKIP_DOWNLOAD` or by specifying either
|
|
64
|
+
* `skipDownload` property in each browser specific config or by providing
|
|
65
|
+
* `PUPPETEER_FIREFOX_SKIP_DOWNLOAD` and `PUPPETEER_CHROME_SKIP_DOWNLOAD`.
|
|
64
66
|
*/
|
|
65
67
|
skipDownload?: boolean;
|
|
66
68
|
/**
|
|
@@ -165,26 +165,32 @@ export interface ConnectOptions {
|
|
|
165
165
|
/**
|
|
166
166
|
* A list of URL patterns to block.
|
|
167
167
|
*
|
|
168
|
-
* This option allows you to restrict the browser from accessing specific
|
|
169
|
-
*
|
|
168
|
+
* This option allows you to restrict the browser from accessing specific URLs
|
|
169
|
+
* or origins. It uses the standard
|
|
170
|
+
* [URLPattern](https://urlpattern.spec.whatwg.org/) API to match URLs.
|
|
170
171
|
*
|
|
171
|
-
* When connecting to an existing browser, Puppeteer will silently detach from
|
|
172
|
-
* already open targets that violate the patterns.
|
|
172
|
+
* When connecting to an existing browser, Puppeteer will silently detach from
|
|
173
|
+
* any already open targets that violate the patterns.
|
|
173
174
|
*
|
|
174
175
|
* For any network requests made by the browser (including navigations and
|
|
175
176
|
* subresources like images or scripts), the request will fail with an error
|
|
176
177
|
* if the URL matches a blocked pattern.
|
|
177
178
|
*
|
|
178
|
-
* @example Pattern to block a specific domain:
|
|
179
|
-
* `*://example.com/*`
|
|
179
|
+
* @example Pattern to block a specific domain: `*://example.com/*`
|
|
180
180
|
*
|
|
181
|
-
* @example Pattern to block all subdomains:
|
|
182
|
-
* `*://*.evil.com/*`
|
|
181
|
+
* @example Pattern to block all subdomains: `*://*.evil.com/*`
|
|
183
182
|
*
|
|
184
183
|
* @remarks
|
|
185
|
-
* Currently only supported for
|
|
184
|
+
* Currently only supported for Chrome.
|
|
186
185
|
*
|
|
187
|
-
*
|
|
186
|
+
* The feature works while Puppeteer is attached to the CDP targets.
|
|
187
|
+
* It intercepts requests in the network service in Chrome.
|
|
188
|
+
* Chrome may perform some network access in other ways or
|
|
189
|
+
* some web features may omit the network service.
|
|
190
|
+
* The feature is meant as an additional guardrails to LLM-based
|
|
191
|
+
* usage under Puppeteer control and not a complete network sandbox.
|
|
192
|
+
* For complete network sandboxing, we recommend using
|
|
193
|
+
* container/OS-level sandbox mechanism.
|
|
188
194
|
*
|
|
189
195
|
* Cannot be used along with {@link ConnectOptions.allowlist}.
|
|
190
196
|
*
|
|
@@ -214,9 +220,16 @@ export interface ConnectOptions {
|
|
|
214
220
|
* `*://*.example.com/*`
|
|
215
221
|
*
|
|
216
222
|
* @remarks
|
|
217
|
-
* Currently only supported for
|
|
218
|
-
*
|
|
219
|
-
*
|
|
223
|
+
* Currently only supported for Chrome.
|
|
224
|
+
*
|
|
225
|
+
* The feature works while Puppeteer is attached to the CDP targets.
|
|
226
|
+
* It intercepts requests in the network service in Chrome.
|
|
227
|
+
* Chrome may perform some network access in other ways or
|
|
228
|
+
* some web features may omit the network service.
|
|
229
|
+
* The feature is meant as an additional guardrails to LLM-based
|
|
230
|
+
* usage under Puppeteer control and not a complete network sandbox.
|
|
231
|
+
* For complete network sandboxing, we recommend using
|
|
232
|
+
* container/OS-level sandbox mechanism.
|
|
220
233
|
*
|
|
221
234
|
* Cannot be used along with {@link ConnectOptions.blocklist}.
|
|
222
235
|
*
|
|
@@ -4,28 +4,11 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import {isNode} from '../environment.js';
|
|
7
|
+
import {isNode, environment} from '../environment.js';
|
|
10
8
|
|
|
11
9
|
declare global {
|
|
12
10
|
const __PUPPETEER_DEBUG: string;
|
|
13
11
|
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
let debugModule: typeof debuglog | null = null;
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export async function importDebug(): Promise<typeof debuglog> {
|
|
23
|
-
if (!debugModule) {
|
|
24
|
-
debugModule = (await import('node:util')).debuglog;
|
|
25
|
-
}
|
|
26
|
-
return debugModule;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
12
|
/**
|
|
30
13
|
* A debug function that can be used in any environment.
|
|
31
14
|
*
|
|
@@ -64,39 +47,46 @@ export async function importDebug(): Promise<typeof debuglog> {
|
|
|
64
47
|
*
|
|
65
48
|
* @internal
|
|
66
49
|
*/
|
|
67
|
-
export const debug = (
|
|
50
|
+
export const debug = (
|
|
51
|
+
prefix: string,
|
|
52
|
+
): ((...args: unknown[]) => void) | undefined => {
|
|
68
53
|
if (isNode) {
|
|
69
|
-
|
|
54
|
+
const nodeDebug = environment.value.debuglog?.(prefix);
|
|
55
|
+
if (!nodeDebug || !nodeDebug.enabled) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (...logArgs: unknown[]) => {
|
|
70
60
|
if (captureLogs) {
|
|
71
61
|
capturedLogs.push(prefix + logArgs);
|
|
72
62
|
}
|
|
73
|
-
(
|
|
63
|
+
(nodeDebug as (...args: any[]) => void)(...logArgs);
|
|
74
64
|
};
|
|
75
65
|
}
|
|
76
66
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
67
|
+
const debugLevel = (globalThis as any).__PUPPETEER_DEBUG;
|
|
68
|
+
if (!debugLevel) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
82
71
|
|
|
83
|
-
|
|
72
|
+
const everythingShouldBeLogged = debugLevel === '*';
|
|
84
73
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
74
|
+
const prefixMatchesDebugLevel =
|
|
75
|
+
everythingShouldBeLogged ||
|
|
76
|
+
/**
|
|
77
|
+
* If the debug level is `foo*`, that means we match any prefix that
|
|
78
|
+
* starts with `foo`. If the level is `foo`, we match only the prefix
|
|
79
|
+
* `foo`.
|
|
80
|
+
*/
|
|
81
|
+
(debugLevel.endsWith('*')
|
|
82
|
+
? prefix.startsWith(debugLevel.slice(0, -1))
|
|
83
|
+
: prefix === debugLevel);
|
|
95
84
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
85
|
+
if (!prefixMatchesDebugLevel) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
99
88
|
|
|
89
|
+
return (...logArgs: unknown[]): void => {
|
|
100
90
|
console.log(`${prefix}:`, ...logArgs);
|
|
101
91
|
};
|
|
102
92
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import mitt, {type Emitter} from '../../third_party/mitt/mitt.js';
|
|
8
8
|
import {asyncDisposeSymbol, disposeSymbol} from '../util/disposable.js';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import {debugCatchError} from './util.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @public
|
|
@@ -185,7 +185,7 @@ export class EventEmitter<
|
|
|
185
185
|
* @internal
|
|
186
186
|
*/
|
|
187
187
|
[disposeSymbol](): void {
|
|
188
|
-
return void this[asyncDisposeSymbol]().catch(
|
|
188
|
+
return void this[asyncDisposeSymbol]().catch(debugCatchError);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
/**
|
|
@@ -36,6 +36,14 @@ import {paperFormats} from './PDFOptions.js';
|
|
|
36
36
|
*/
|
|
37
37
|
export const debugError = debug('puppeteer:error');
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
*
|
|
42
|
+
* Use this instead of debugError so the catch functions
|
|
43
|
+
* don't re-throw the error.
|
|
44
|
+
*/
|
|
45
|
+
export const debugCatchError = debugError ?? (() => {});
|
|
46
|
+
|
|
39
47
|
/**
|
|
40
48
|
* @internal
|
|
41
49
|
*/
|
|
@@ -230,7 +238,7 @@ export async function getReadableAsTypedArray(
|
|
|
230
238
|
}
|
|
231
239
|
return concat;
|
|
232
240
|
} catch (error) {
|
|
233
|
-
debugError(error);
|
|
241
|
+
debugError?.(error);
|
|
234
242
|
return null;
|
|
235
243
|
}
|
|
236
244
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import type FS from 'node:fs';
|
|
8
8
|
import type Path from 'node:path';
|
|
9
|
+
import type {debuglog} from 'node:util';
|
|
9
10
|
|
|
10
11
|
import type {ScreenRecorder} from './node/ScreenRecorder.js';
|
|
11
12
|
|
|
@@ -18,6 +19,7 @@ export interface EnvironmentDependencies {
|
|
|
18
19
|
fs: typeof FS;
|
|
19
20
|
path?: typeof Path;
|
|
20
21
|
ScreenRecorder: typeof ScreenRecorder;
|
|
22
|
+
debuglog?: typeof debuglog;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
/**
|
|
@@ -31,8 +33,10 @@ export const environment: {
|
|
|
31
33
|
get fs(): typeof FS {
|
|
32
34
|
throw new Error('fs is not available in this environment');
|
|
33
35
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
ScreenRecorder: class {
|
|
37
|
+
constructor() {
|
|
38
|
+
throw new Error('ScreenRecorder is not available in this environment');
|
|
39
|
+
}
|
|
40
|
+
} as unknown as typeof ScreenRecorder,
|
|
37
41
|
},
|
|
38
42
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
|
-
export const source = "\"use strict\";var N=Object.defineProperty;var
|
|
8
|
+
export const source = "\"use strict\";var N=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var G=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var r in e)N(t,r,{get:e[r],enumerable:!0})},J=(t,e,r,o)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(let n of Y(e))!G.call(t,n)&&n!==r&&N(t,n,{get:()=>e[n],enumerable:!(o=B(e,n))||o.enumerable});return t};var z=t=>J(N({},\"__esModule\",{value:!0}),t);var ye={};l(ye,{default:()=>pe});module.exports=z(ye);var b=class extends Error{constructor(e,r){super(e,r),this.name=this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}},p=class extends b{};var c=class t{static create(e){return new t(e)}static async race(e){let r=new Set;try{let o=e.map(n=>n instanceof t?(n.#n&&r.add(n),n.valueOrThrow()):n);return await Promise.race(o)}finally{for(let o of r)o.reject(new Error(\"Timeout cleared\"))}}#e=!1;#r=!1;#o;#t;#a=new Promise(e=>{this.#t=e});#n;#i;constructor(e){e&&e.timeout>0&&(this.#i=new p(e.message),this.#n=setTimeout(()=>{this.reject(this.#i)},e.timeout))}#l(e){clearTimeout(this.#n),this.#o=e,this.#t()}resolve(e){this.#r||this.#e||(this.#e=!0,this.#l(e))}reject(e){this.#r||this.#e||(this.#r=!0,this.#l(e))}resolved(){return this.#e}finished(){return this.#e||this.#r}value(){return this.#o}#s;valueOrThrow(){return this.#s||(this.#s=(async()=>{if(await this.#a,this.#r)throw this.#o;return this.#o})()),this.#s}};var W=new Map,j=t=>{let e=W.get(t);return e||(e=new Function(`return ${t}`)(),W.set(t,e),e)};var v={};l(v,{ariaQuerySelector:()=>K,ariaQuerySelectorAll:()=>x});var K=(t,e)=>globalThis.__ariaQuerySelector(t,e),x=async function*(t,e){yield*await globalThis.__ariaQuerySelectorAll(t,e)};var E={};l(E,{cssQuerySelector:()=>Z,cssQuerySelectorAll:()=>ee});var Z=(t,e)=>t.querySelector(e),ee=function(t,e){return t.querySelectorAll(e)};var A={};l(A,{CustomQuerySelectorRegistry:()=>y,customQuerySelectors:()=>P});var y=class{#e=new Map;register(e,r){if(!r.queryOne&&r.queryAll){let o=r.queryAll;r.queryOne=(n,i)=>{for(let s of o(n,i))return s;return null}}else if(r.queryOne&&!r.queryAll){let o=r.queryOne;r.queryAll=(n,i)=>{let s=o(n,i);return s?[s]:[]}}else if(!r.queryOne||!r.queryAll)throw new Error(\"At least one query method must be defined.\");this.#e.set(e,{querySelector:r.queryOne,querySelectorAll:r.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},P=new y;var R={};l(R,{pierceQuerySelector:()=>te,pierceQuerySelectorAll:()=>re});var te=(t,e)=>{let r=null,o=n=>{let i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&o(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==n&&!r&&s.matches(e)&&(r=s)}while(!r&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),o(t),r},re=(t,e)=>{let r=[],o=n=>{let i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&o(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==n&&s.matches(e)&&r.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),o(t),r};var u=(t,e)=>{if(!t)throw new Error(e)};var w=class{#e;#r;#o;#t;constructor(e,r){this.#e=e,this.#r=r}async start(){let e=this.#t=c.create(),r=await this.#e();if(r){e.resolve(r);return}this.#o=new MutationObserver(async()=>{let o=await this.#e();o&&(e.resolve(o),await this.stop())}),this.#o.observe(this.#r,{childList:!0,subtree:!0,attributes:!0})}async stop(){u(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\")),this.#o&&(this.#o.disconnect(),this.#o=void 0)}result(){return u(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}},T=class{#e;#r;constructor(e){this.#e=e}async start(){let e=this.#r=c.create(),r=await this.#e();if(r){e.resolve(r);return}let o=async()=>{if(e.finished())return;let n=await this.#e();if(!n){window.requestAnimationFrame(o);return}e.resolve(n),await this.stop()};window.requestAnimationFrame(o)}async stop(){u(this.#r,\"Polling never started.\"),this.#r.finished()||this.#r.reject(new Error(\"Polling stopped\"))}result(){return u(this.#r,\"Polling never started.\"),this.#r.valueOrThrow()}},S=class{#e;#r;#o;#t;constructor(e,r){this.#e=e,this.#r=r}async start(){let e=this.#t=c.create(),r=await this.#e();if(r){e.resolve(r);return}this.#o=setInterval(async()=>{let o=await this.#e();o&&(e.resolve(o),await this.stop())},this.#r)}async stop(){u(this.#t,\"Polling never started.\"),this.#t.finished()||this.#t.reject(new Error(\"Polling stopped\")),this.#o&&(clearInterval(this.#o),this.#o=void 0)}result(){return u(this.#t,\"Polling never started.\"),this.#t.valueOrThrow()}};var L={};l(L,{PCombinator:()=>U,pQuerySelector:()=>me,pQuerySelectorAll:()=>X});var a=class{static async*map(e,r){for await(let o of e)yield await r(o)}static async*flatMap(e,r){for await(let o of e)yield*r(o)}static async collect(e){let r=[];for await(let o of e)r.push(o);return r}static async first(e){for await(let r of e)return r}};var O={};l(O,{textQuerySelectorAll:()=>m});var oe=new Set([\"checkbox\",\"image\",\"radio\"]),ne=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!oe.has(t.type),se=new Set([\"SCRIPT\",\"STYLE\"]),f=t=>!se.has(t.nodeName)&&!document.head?.contains(t),C=new WeakMap,V=t=>{for(;t;)C.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},F=new WeakSet,I,ie=()=>{let t=globalThis.MutationObserver;if(!t)throw new Error(\"MutationObserver is not available in this environment.\");return I||(I=new t(e=>{for(let r of e)V(r.target)})),I},d=t=>{let e=C.get(t);if(e||(e={full:\"\",immediate:[]},!f(t)))return e;let r=\"\";if(ne(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener(\"input\",o=>{V(o.target)},{once:!0,capture:!0});else{for(let o=t.firstChild;o;o=o.nextSibling){if(o.nodeType===Node.TEXT_NODE){e.full+=o.nodeValue??\"\",r+=o.nodeValue??\"\";continue}r&&e.immediate.push(r),r=\"\",o.nodeType===Node.ELEMENT_NODE&&(e.full+=d(o).full)}r&&e.immediate.push(r),t instanceof Element&&t.shadowRoot&&(e.full+=d(t.shadowRoot).full),F.has(t)||(ie().observe(t,{childList:!0,characterData:!0,subtree:!0}),F.add(t))}return C.set(t,e),e};var m=function*(t,e){let r=!1;for(let o of t.childNodes)if(o instanceof Element&&f(o)){let n;o.shadowRoot?n=m(o.shadowRoot,e):n=m(o,e);for(let i of n)yield i,r=!0}r||t instanceof Element&&f(t)&&d(t).full.includes(e)&&(yield t)};var M={};l(M,{checkVisibility:()=>ae,pierce:()=>g,pierceAll:()=>k});var le=[\"hidden\",\"collapse\"],ae=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t,o=window.getComputedStyle(r),n=o&&!le.includes(o.visibility)&&!ce(r);return e===n?t:!1};function ce(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var ue=t=>\"shadowRoot\"in t&&t.shadowRoot instanceof ShadowRoot;function*g(t){ue(t)?yield t.shadowRoot:yield t}function*k(t){t=g(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let r of e){let o;for(;o=r.nextNode();)o.shadowRoot&&(yield o.shadowRoot,e.push(document.createTreeWalker(o.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var D={};l(D,{xpathQuerySelectorAll:()=>q});var q=function*(t,e,r=-1){let n=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),i=[],s;for(;(s=n.iterateNext())&&(i.push(s),!(r&&i.length===r)););for(let h=0;h<i.length;h++)s=i[h],yield s,i[h]=null};var de=/[-\\w\\P{ASCII}*]/u,U=(r=>(r.Descendent=\">>>\",r.Child=\">>>>\",r))(U||{}),H=t=>\"querySelectorAll\"in t,Q=class{#e;#r=[];#o=void 0;elements;constructor(e,r){this.elements=[e],this.#e=r,this.#t()}async run(){for(typeof this.#o==\"string\"&&this.#o.trimStart()===\":scope\"&&this.#t();this.#o!==void 0;this.#t()){let e=this.#o;typeof e==\"string\"?e[0]&&de.test(e[0])?this.elements=a.flatMap(this.elements,async function*(r){H(r)&&(yield*r.querySelectorAll(e))}):this.elements=a.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!H(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let n of r.parentElement.children)if(++o,n===r)break;yield*r.parentElement.querySelectorAll(`:scope>:nth-child(${o})${e}`)}):this.elements=a.flatMap(this.elements,async function*(r){switch(e.name){case\"text\":yield*m(r,e.value);break;case\"xpath\":yield*q(r,e.value);break;case\"aria\":yield*x(r,e.value);break;default:let o=P.get(e.name);if(!o)throw new Error(`Unknown selector type: ${e.name}`);yield*o.querySelectorAll(r,e.value)}})}}#t(){if(this.#r.length!==0){this.#o=this.#r.shift();return}if(this.#e.length===0){this.#o=void 0;return}let e=this.#e.shift();switch(e){case\">>>>\":{this.elements=a.flatMap(this.elements,g),this.#t();break}case\">>>\":{this.elements=a.flatMap(this.elements,k),this.#t();break}default:this.#r=e,this.#t();break}}},_=class{#e=new WeakMap;calculate(e,r=[]){if(e===null)return r;e instanceof ShadowRoot&&(e=e.host);let o=this.#e.get(e);if(o)return[...o,...r];let n=0;for(let s=e.previousSibling;s;s=s.previousSibling)++n;let i=this.calculate(e.parentNode,[n]);return this.#e.set(e,i),[...i,...r]}},$=(t,e)=>{if(t.length+e.length===0)return 0;let[r=-1,...o]=t,[n=-1,...i]=e;return r===n?$(o,i):r<n?-1:1},fe=async function*(t){let e=new Set;for await(let o of t)e.add(o);let r=new _;yield*[...e.values()].map(o=>[o,r.calculate(o)]).sort(([,o],[,n])=>$(o,n)).map(([o])=>o)},X=function(t,e){let r=JSON.parse(e);if(r.some(o=>{let n=0;return o.some(i=>(typeof i==\"string\"?++n:n=0,n>1))}))throw new Error(\"Multiple deep combinators found in sequence.\");return fe(a.flatMap(r,o=>{let n=new Q(t,o);return n.run(),n.elements}))},me=async function(t,e){for await(let r of X(t,e))return r;return null};var he=Object.freeze({...v,...A,...R,...L,...O,...M,...D,...E,Deferred:c,createFunction:j,createTextContent:d,IntervalPoller:S,isSuitableNodeForTextMatching:f,MutationPoller:w,RAFPoller:T}),pe=he;\n";
|
|
@@ -73,11 +73,21 @@ const eraseFromCache = (node: Node | null) => {
|
|
|
73
73
|
* Erases the cache when the tree has mutated text.
|
|
74
74
|
*/
|
|
75
75
|
const observedNodes = new WeakSet<Node>();
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
let textChangeObserver: MutationObserver;
|
|
77
|
+
const getTextChangeObserver = () => {
|
|
78
|
+
const MutationObserverImpl = globalThis.MutationObserver;
|
|
79
|
+
if (!MutationObserverImpl) {
|
|
80
|
+
throw new Error('MutationObserver is not available in this environment.');
|
|
79
81
|
}
|
|
80
|
-
|
|
82
|
+
if (!textChangeObserver) {
|
|
83
|
+
textChangeObserver = new MutationObserverImpl(mutations => {
|
|
84
|
+
for (const mutation of mutations) {
|
|
85
|
+
eraseFromCache(mutation.target);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return textChangeObserver;
|
|
90
|
+
};
|
|
81
91
|
|
|
82
92
|
/**
|
|
83
93
|
* Builds the text content of a node using some custom logic.
|
|
@@ -133,7 +143,7 @@ export const createTextContent = (root: Node): TextContent => {
|
|
|
133
143
|
}
|
|
134
144
|
|
|
135
145
|
if (!observedNodes.has(root)) {
|
|
136
|
-
|
|
146
|
+
getTextChangeObserver().observe(root, {
|
|
137
147
|
childList: true,
|
|
138
148
|
characterData: true,
|
|
139
149
|
subtree: true,
|
|
@@ -51,6 +51,21 @@ export interface ResolvedLaunchArgs {
|
|
|
51
51
|
args: string[];
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
export function getBrowserTypeDisplayName(
|
|
58
|
+
browserType: InstalledBrowser,
|
|
59
|
+
): string {
|
|
60
|
+
switch (browserType) {
|
|
61
|
+
case InstalledBrowser.FIREFOX:
|
|
62
|
+
case InstalledBrowser.CHROME:
|
|
63
|
+
return browserType.charAt(0).toUpperCase() + browserType.slice(1);
|
|
64
|
+
default:
|
|
65
|
+
return browserType;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
/**
|
|
55
70
|
* Describes a launcher - a class that is able to create and launch a browser instance.
|
|
56
71
|
*
|
|
@@ -262,12 +277,6 @@ export abstract class BrowserLauncher {
|
|
|
262
277
|
}
|
|
263
278
|
|
|
264
279
|
if (Array.isArray(enableExtensions)) {
|
|
265
|
-
if (this.#browser === 'chrome' && !usePipe) {
|
|
266
|
-
throw new Error(
|
|
267
|
-
'To use `enableExtensions` with a list of paths in Chrome, you must be connected with `--remote-debugging-pipe` (`pipe: true`).',
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
280
|
await Promise.all([
|
|
272
281
|
enableExtensions.map(path => {
|
|
273
282
|
return browser.installExtension(path);
|
|
@@ -317,7 +326,7 @@ export abstract class BrowserLauncher {
|
|
|
317
326
|
await cdpConnection.closeBrowser();
|
|
318
327
|
await browserProcess.hasClosed();
|
|
319
328
|
} catch (error) {
|
|
320
|
-
debugError(error);
|
|
329
|
+
debugError?.(error);
|
|
321
330
|
await browserProcess.close();
|
|
322
331
|
}
|
|
323
332
|
} else {
|
|
@@ -550,22 +559,13 @@ export abstract class BrowserLauncher {
|
|
|
550
559
|
`Tried to find the browser at the configured path (${executablePath}) for version ${configVersion}, but no executable was found.`,
|
|
551
560
|
);
|
|
552
561
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
);
|
|
561
|
-
case 'firefox':
|
|
562
|
-
throw new Error(
|
|
563
|
-
`Could not find Firefox (rev. ${browserVersion}). This can occur if either\n` +
|
|
564
|
-
' 1. you did not perform an installation for Firefox before running the script (e.g. `npx puppeteer browsers install firefox`) or\n' +
|
|
565
|
-
` 2. your cache path is incorrectly configured (which is: ${config.cacheDirectory}).\n` +
|
|
566
|
-
'For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.',
|
|
567
|
-
);
|
|
568
|
-
}
|
|
562
|
+
|
|
563
|
+
throw new Error(
|
|
564
|
+
`Could not find ${getBrowserTypeDisplayName(browserType)} (ver. ${browserVersion}). This can occur if either\n` +
|
|
565
|
+
` 1. you did not perform an installation before running the script (e.g. \`npx puppeteer browsers install ${browserType}\`) or\n` +
|
|
566
|
+
` 2. your cache path is incorrectly configured (which is: ${config.cacheDirectory}).\n` +
|
|
567
|
+
'For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.',
|
|
568
|
+
);
|
|
569
569
|
}
|
|
570
570
|
return executablePath;
|
|
571
571
|
}
|