@roxybrowser/playwright 2.0.2-beta.0
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/README.md +115 -0
- package/dist/apiRequestContext.d.ts +52 -0
- package/dist/apiRequestContext.d.ts.map +1 -0
- package/dist/apiRequestContext.js +632 -0
- package/dist/apiRequestContext.js.map +1 -0
- package/dist/ariaSnapshot.d.ts +38 -0
- package/dist/ariaSnapshot.d.ts.map +1 -0
- package/dist/ariaSnapshot.js +1137 -0
- package/dist/ariaSnapshot.js.map +1 -0
- package/dist/assertions.d.ts +2 -0
- package/dist/assertions.d.ts.map +1 -0
- package/dist/assertions.js +6 -0
- package/dist/assertions.js.map +1 -0
- package/dist/bin/roxybrowser-mcp.d.ts +3 -0
- package/dist/bin/roxybrowser-mcp.d.ts.map +1 -0
- package/dist/bin/roxybrowser-mcp.js +7 -0
- package/dist/bin/roxybrowser-mcp.js.map +1 -0
- package/dist/browser.d.ts +15 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +67 -0
- package/dist/browser.js.map +1 -0
- package/dist/browserContext.d.ts +156 -0
- package/dist/browserContext.d.ts.map +1 -0
- package/dist/browserContext.js +1129 -0
- package/dist/browserContext.js.map +1 -0
- package/dist/browserContextClock.d.ts +54 -0
- package/dist/browserContextClock.d.ts.map +1 -0
- package/dist/browserContextClock.js +147 -0
- package/dist/browserContextClock.js.map +1 -0
- package/dist/browserType.d.ts +16 -0
- package/dist/browserType.d.ts.map +1 -0
- package/dist/browserType.js +68 -0
- package/dist/browserType.js.map +1 -0
- package/dist/bundle.d.ts +20 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +20 -0
- package/dist/bundle.js.map +1 -0
- package/dist/clock.d.ts +43 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +70 -0
- package/dist/clock.js.map +1 -0
- package/dist/elementHandle.d.ts +100 -0
- package/dist/elementHandle.d.ts.map +1 -0
- package/dist/elementHandle.js +423 -0
- package/dist/elementHandle.js.map +1 -0
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +19 -0
- package/dist/errors.js.map +1 -0
- package/dist/evaluation.d.ts +4 -0
- package/dist/evaluation.d.ts.map +1 -0
- package/dist/evaluation.js +9 -0
- package/dist/evaluation.js.map +1 -0
- package/dist/frame.d.ts +139 -0
- package/dist/frame.d.ts.map +1 -0
- package/dist/frame.js +451 -0
- package/dist/frame.js.map +1 -0
- package/dist/httpHeaders.d.ts +6 -0
- package/dist/httpHeaders.d.ts.map +1 -0
- package/dist/httpHeaders.js +23 -0
- package/dist/httpHeaders.js.map +1 -0
- package/dist/human/controller.d.ts +15 -0
- package/dist/human/controller.d.ts.map +1 -0
- package/dist/human/controller.js +67 -0
- package/dist/human/controller.js.map +1 -0
- package/dist/human/profile.d.ts +5 -0
- package/dist/human/profile.d.ts.map +1 -0
- package/dist/human/profile.js +50 -0
- package/dist/human/profile.js.map +1 -0
- package/dist/human/types.d.ts +28 -0
- package/dist/human/types.d.ts.map +1 -0
- package/dist/human/types.js +2 -0
- package/dist/human/types.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/inputFiles.d.ts +18 -0
- package/dist/inputFiles.d.ts.map +1 -0
- package/dist/inputFiles.js +192 -0
- package/dist/inputFiles.js.map +1 -0
- package/dist/jsHandle.d.ts +32 -0
- package/dist/jsHandle.d.ts.map +1 -0
- package/dist/jsHandle.js +148 -0
- package/dist/jsHandle.js.map +1 -0
- package/dist/locator.d.ts +190 -0
- package/dist/locator.d.ts.map +1 -0
- package/dist/locator.js +883 -0
- package/dist/locator.js.map +1 -0
- package/dist/locatorSelectors.d.ts +11 -0
- package/dist/locatorSelectors.d.ts.map +1 -0
- package/dist/locatorSelectors.js +50 -0
- package/dist/locatorSelectors.js.map +1 -0
- package/dist/mcp/backend/common.d.ts +4 -0
- package/dist/mcp/backend/common.d.ts.map +1 -0
- package/dist/mcp/backend/common.js +40 -0
- package/dist/mcp/backend/common.js.map +1 -0
- package/dist/mcp/backend/connect.d.ts +10 -0
- package/dist/mcp/backend/connect.d.ts.map +1 -0
- package/dist/mcp/backend/connect.js +30 -0
- package/dist/mcp/backend/connect.js.map +1 -0
- package/dist/mcp/backend/console.d.ts +13 -0
- package/dist/mcp/backend/console.d.ts.map +1 -0
- package/dist/mcp/backend/console.js +36 -0
- package/dist/mcp/backend/console.js.map +1 -0
- package/dist/mcp/backend/context.d.ts +27 -0
- package/dist/mcp/backend/context.d.ts.map +1 -0
- package/dist/mcp/backend/context.js +33 -0
- package/dist/mcp/backend/context.js.map +1 -0
- package/dist/mcp/backend/dialogs.d.ts +7 -0
- package/dist/mcp/backend/dialogs.d.ts.map +1 -0
- package/dist/mcp/backend/dialogs.js +24 -0
- package/dist/mcp/backend/dialogs.js.map +1 -0
- package/dist/mcp/backend/evaluate.d.ts +9 -0
- package/dist/mcp/backend/evaluate.d.ts.map +1 -0
- package/dist/mcp/backend/evaluate.js +31 -0
- package/dist/mcp/backend/evaluate.js.map +1 -0
- package/dist/mcp/backend/files.d.ts +9 -0
- package/dist/mcp/backend/files.d.ts.map +1 -0
- package/dist/mcp/backend/files.js +39 -0
- package/dist/mcp/backend/files.js.map +1 -0
- package/dist/mcp/backend/keyboard.d.ts +22 -0
- package/dist/mcp/backend/keyboard.d.ts.map +1 -0
- package/dist/mcp/backend/keyboard.js +67 -0
- package/dist/mcp/backend/keyboard.js.map +1 -0
- package/dist/mcp/backend/navigate.d.ts +4 -0
- package/dist/mcp/backend/navigate.d.ts.map +1 -0
- package/dist/mcp/backend/navigate.js +82 -0
- package/dist/mcp/backend/navigate.js.map +1 -0
- package/dist/mcp/backend/network.d.ts +17 -0
- package/dist/mcp/backend/network.d.ts.map +1 -0
- package/dist/mcp/backend/network.js +144 -0
- package/dist/mcp/backend/network.js.map +1 -0
- package/dist/mcp/backend/response.d.ts +26 -0
- package/dist/mcp/backend/response.d.ts.map +1 -0
- package/dist/mcp/backend/response.js +109 -0
- package/dist/mcp/backend/response.js.map +1 -0
- package/dist/mcp/backend/runCode.d.ts +6 -0
- package/dist/mcp/backend/runCode.d.ts.map +1 -0
- package/dist/mcp/backend/runCode.js +20 -0
- package/dist/mcp/backend/runCode.js.map +1 -0
- package/dist/mcp/backend/screenshot.d.ts +13 -0
- package/dist/mcp/backend/screenshot.d.ts.map +1 -0
- package/dist/mcp/backend/screenshot.js +37 -0
- package/dist/mcp/backend/screenshot.js.map +1 -0
- package/dist/mcp/backend/snapshot.d.ts +70 -0
- package/dist/mcp/backend/snapshot.d.ts.map +1 -0
- package/dist/mcp/backend/snapshot.js +185 -0
- package/dist/mcp/backend/snapshot.js.map +1 -0
- package/dist/mcp/backend/tab.d.ts +72 -0
- package/dist/mcp/backend/tab.d.ts.map +1 -0
- package/dist/mcp/backend/tab.js +99 -0
- package/dist/mcp/backend/tab.js.map +1 -0
- package/dist/mcp/backend/tabs.d.ts +13 -0
- package/dist/mcp/backend/tabs.d.ts.map +1 -0
- package/dist/mcp/backend/tabs.js +44 -0
- package/dist/mcp/backend/tabs.js.map +1 -0
- package/dist/mcp/backend/tool.d.ts +52 -0
- package/dist/mcp/backend/tool.d.ts.map +1 -0
- package/dist/mcp/backend/tool.js +28 -0
- package/dist/mcp/backend/tool.js.map +1 -0
- package/dist/mcp/backend/tools.d.ts +4 -0
- package/dist/mcp/backend/tools.d.ts.map +1 -0
- package/dist/mcp/backend/tools.js +30 -0
- package/dist/mcp/backend/tools.js.map +1 -0
- package/dist/mcp/connectedBrowser.d.ts +3 -0
- package/dist/mcp/connectedBrowser.d.ts.map +1 -0
- package/dist/mcp/connectedBrowser.js +2153 -0
- package/dist/mcp/connectedBrowser.js.map +1 -0
- package/dist/mcp/errors.d.ts +6 -0
- package/dist/mcp/errors.d.ts.map +1 -0
- package/dist/mcp/errors.js +12 -0
- package/dist/mcp/errors.js.map +1 -0
- package/dist/mcp/format.d.ts +12 -0
- package/dist/mcp/format.d.ts.map +1 -0
- package/dist/mcp/format.js +48 -0
- package/dist/mcp/format.js.map +1 -0
- package/dist/mcp/index.d.ts +6 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/output.d.ts +7 -0
- package/dist/mcp/output.d.ts.map +1 -0
- package/dist/mcp/output.js +39 -0
- package/dist/mcp/output.js.map +1 -0
- package/dist/mcp/runtime.d.ts +122 -0
- package/dist/mcp/runtime.d.ts.map +1 -0
- package/dist/mcp/runtime.js +524 -0
- package/dist/mcp/runtime.js.map +1 -0
- package/dist/mcp/schemas.d.ts +61 -0
- package/dist/mcp/schemas.d.ts.map +1 -0
- package/dist/mcp/schemas.js +41 -0
- package/dist/mcp/schemas.js.map +1 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +117 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/snapshot.d.ts +3 -0
- package/dist/mcp/snapshot.d.ts.map +1 -0
- package/dist/mcp/snapshot.js +3 -0
- package/dist/mcp/snapshot.js.map +1 -0
- package/dist/mcp/tool.d.ts +19 -0
- package/dist/mcp/tool.d.ts.map +1 -0
- package/dist/mcp/tool.js +10 -0
- package/dist/mcp/tool.js.map +1 -0
- package/dist/mcp/tools/common.d.ts +6 -0
- package/dist/mcp/tools/common.d.ts.map +1 -0
- package/dist/mcp/tools/common.js +34 -0
- package/dist/mcp/tools/common.js.map +1 -0
- package/dist/mcp/tools/connect.d.ts +6 -0
- package/dist/mcp/tools/connect.d.ts.map +1 -0
- package/dist/mcp/tools/connect.js +28 -0
- package/dist/mcp/tools/connect.js.map +1 -0
- package/dist/mcp/tools/console.d.ts +6 -0
- package/dist/mcp/tools/console.d.ts.map +1 -0
- package/dist/mcp/tools/console.js +36 -0
- package/dist/mcp/tools/console.js.map +1 -0
- package/dist/mcp/tools/dialog.d.ts +6 -0
- package/dist/mcp/tools/dialog.d.ts.map +1 -0
- package/dist/mcp/tools/dialog.js +22 -0
- package/dist/mcp/tools/dialog.js.map +1 -0
- package/dist/mcp/tools/evaluate.d.ts +6 -0
- package/dist/mcp/tools/evaluate.d.ts.map +1 -0
- package/dist/mcp/tools/evaluate.js +31 -0
- package/dist/mcp/tools/evaluate.js.map +1 -0
- package/dist/mcp/tools/form.d.ts +6 -0
- package/dist/mcp/tools/form.d.ts.map +1 -0
- package/dist/mcp/tools/form.js +129 -0
- package/dist/mcp/tools/form.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +3 -0
- package/dist/mcp/tools/index.d.ts.map +1 -0
- package/dist/mcp/tools/index.js +7 -0
- package/dist/mcp/tools/index.js.map +1 -0
- package/dist/mcp/tools/keyboard.d.ts +3 -0
- package/dist/mcp/tools/keyboard.d.ts.map +1 -0
- package/dist/mcp/tools/keyboard.js +44 -0
- package/dist/mcp/tools/keyboard.js.map +1 -0
- package/dist/mcp/tools/mouse.d.ts +3 -0
- package/dist/mcp/tools/mouse.d.ts.map +1 -0
- package/dist/mcp/tools/mouse.js +89 -0
- package/dist/mcp/tools/mouse.js.map +1 -0
- package/dist/mcp/tools/navigate.d.ts +6 -0
- package/dist/mcp/tools/navigate.d.ts.map +1 -0
- package/dist/mcp/tools/navigate.js +74 -0
- package/dist/mcp/tools/navigate.js.map +1 -0
- package/dist/mcp/tools/network.d.ts +6 -0
- package/dist/mcp/tools/network.d.ts.map +1 -0
- package/dist/mcp/tools/network.js +142 -0
- package/dist/mcp/tools/network.js.map +1 -0
- package/dist/mcp/tools/runCode.d.ts +6 -0
- package/dist/mcp/tools/runCode.d.ts.map +1 -0
- package/dist/mcp/tools/runCode.js +24 -0
- package/dist/mcp/tools/runCode.js.map +1 -0
- package/dist/mcp/tools/screenshot.d.ts +6 -0
- package/dist/mcp/tools/screenshot.d.ts.map +1 -0
- package/dist/mcp/tools/screenshot.js +46 -0
- package/dist/mcp/tools/screenshot.js.map +1 -0
- package/dist/mcp/tools/snapshot.d.ts +6 -0
- package/dist/mcp/tools/snapshot.d.ts.map +1 -0
- package/dist/mcp/tools/snapshot.js +56 -0
- package/dist/mcp/tools/snapshot.js.map +1 -0
- package/dist/mcp/tools/tabs.d.ts +6 -0
- package/dist/mcp/tools/tabs.d.ts.map +1 -0
- package/dist/mcp/tools/tabs.js +34 -0
- package/dist/mcp/tools/tabs.js.map +1 -0
- package/dist/mcp/transports/http.d.ts +3 -0
- package/dist/mcp/transports/http.d.ts.map +1 -0
- package/dist/mcp/transports/http.js +134 -0
- package/dist/mcp/transports/http.js.map +1 -0
- package/dist/mcp/transports/inMemory.d.ts +3 -0
- package/dist/mcp/transports/inMemory.d.ts.map +1 -0
- package/dist/mcp/transports/inMemory.js +18 -0
- package/dist/mcp/transports/inMemory.js.map +1 -0
- package/dist/mcp/transports/stdio.d.ts +3 -0
- package/dist/mcp/transports/stdio.d.ts.map +1 -0
- package/dist/mcp/transports/stdio.js +16 -0
- package/dist/mcp/transports/stdio.js.map +1 -0
- package/dist/mcp/types.d.ts +193 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +2 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/navigationResult.d.ts +10 -0
- package/dist/navigationResult.d.ts.map +1 -0
- package/dist/navigationResult.js +15 -0
- package/dist/navigationResult.js.map +1 -0
- package/dist/page.d.ts +907 -0
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +6385 -0
- package/dist/page.js.map +1 -0
- package/dist/pageApiReport.d.ts +31 -0
- package/dist/pageApiReport.d.ts.map +1 -0
- package/dist/pageApiReport.js +218 -0
- package/dist/pageApiReport.js.map +1 -0
- package/dist/pageResponse.d.ts +18 -0
- package/dist/pageResponse.d.ts.map +1 -0
- package/dist/pageResponse.js +23 -0
- package/dist/pageResponse.js.map +1 -0
- package/dist/processCleanup.d.ts +8 -0
- package/dist/processCleanup.d.ts.map +1 -0
- package/dist/processCleanup.js +413 -0
- package/dist/processCleanup.js.map +1 -0
- package/dist/protocol/adapter.d.ts +406 -0
- package/dist/protocol/adapter.d.ts.map +1 -0
- package/dist/protocol/adapter.js +8 -0
- package/dist/protocol/adapter.js.map +1 -0
- package/dist/protocol/bidi/backend.d.ts +8 -0
- package/dist/protocol/bidi/backend.d.ts.map +1 -0
- package/dist/protocol/bidi/backend.js +3616 -0
- package/dist/protocol/bidi/backend.js.map +1 -0
- package/dist/protocol/bidi/client.d.ts +104 -0
- package/dist/protocol/bidi/client.d.ts.map +1 -0
- package/dist/protocol/bidi/client.js +228 -0
- package/dist/protocol/bidi/client.js.map +1 -0
- package/dist/protocol/capabilities.d.ts +11 -0
- package/dist/protocol/capabilities.d.ts.map +1 -0
- package/dist/protocol/capabilities.js +2 -0
- package/dist/protocol/capabilities.js.map +1 -0
- package/dist/protocol/cdp/backend.d.ts +24 -0
- package/dist/protocol/cdp/backend.d.ts.map +1 -0
- package/dist/protocol/cdp/backend.js +8428 -0
- package/dist/protocol/cdp/backend.js.map +1 -0
- package/dist/protocol/evaluate.d.ts +2 -0
- package/dist/protocol/evaluate.d.ts.map +1 -0
- package/dist/protocol/evaluate.js +14 -0
- package/dist/protocol/evaluate.js.map +1 -0
- package/dist/protocol/evaluationSerializer.d.ts +6 -0
- package/dist/protocol/evaluationSerializer.d.ts.map +1 -0
- package/dist/protocol/evaluationSerializer.js +234 -0
- package/dist/protocol/evaluationSerializer.js.map +1 -0
- package/dist/protocol/keyboardInput.d.ts +34 -0
- package/dist/protocol/keyboardInput.d.ts.map +1 -0
- package/dist/protocol/keyboardInput.js +246 -0
- package/dist/protocol/keyboardInput.js.map +1 -0
- package/dist/protocol/routing.d.ts +40 -0
- package/dist/protocol/routing.d.ts.map +1 -0
- package/dist/protocol/routing.js +2 -0
- package/dist/protocol/routing.js.map +1 -0
- package/dist/protocol/selectorRuntime.d.ts +30 -0
- package/dist/protocol/selectorRuntime.d.ts.map +1 -0
- package/dist/protocol/selectorRuntime.js +1814 -0
- package/dist/protocol/selectorRuntime.js.map +1 -0
- package/dist/protocol/webdriver-classic/backend.d.ts +6 -0
- package/dist/protocol/webdriver-classic/backend.d.ts.map +1 -0
- package/dist/protocol/webdriver-classic/backend.js +158 -0
- package/dist/protocol/webdriver-classic/backend.js.map +1 -0
- package/dist/routeHandler.d.ts +15 -0
- package/dist/routeHandler.d.ts.map +1 -0
- package/dist/routeHandler.js +2 -0
- package/dist/routeHandler.js.map +1 -0
- package/dist/roxybrowser.bundle.js +78236 -0
- package/dist/roxybrowser.bundle.js.map +1 -0
- package/dist/screencast.d.ts +57 -0
- package/dist/screencast.d.ts.map +1 -0
- package/dist/screencast.js +155 -0
- package/dist/screencast.js.map +1 -0
- package/dist/screencastActions.d.ts +2 -0
- package/dist/screencastActions.d.ts.map +1 -0
- package/dist/screencastActions.js +183 -0
- package/dist/screencastActions.js.map +1 -0
- package/dist/screencastOverlay.d.ts +3 -0
- package/dist/screencastOverlay.d.ts.map +1 -0
- package/dist/screencastOverlay.js +119 -0
- package/dist/screencastOverlay.js.map +1 -0
- package/dist/screenshotOptions.d.ts +26 -0
- package/dist/screenshotOptions.d.ts.map +1 -0
- package/dist/screenshotOptions.js +171 -0
- package/dist/screenshotOptions.js.map +1 -0
- package/dist/screenshotPreparation.d.ts +21 -0
- package/dist/screenshotPreparation.d.ts.map +1 -0
- package/dist/screenshotPreparation.js +199 -0
- package/dist/screenshotPreparation.js.map +1 -0
- package/dist/selectOptionValues.d.ts +10 -0
- package/dist/selectOptionValues.d.ts.map +1 -0
- package/dist/selectOptionValues.js +60 -0
- package/dist/selectOptionValues.js.map +1 -0
- package/dist/selectors.d.ts +3 -0
- package/dist/selectors.d.ts.map +1 -0
- package/dist/selectors.js +287 -0
- package/dist/selectors.js.map +1 -0
- package/dist/types/api.d.ts +2164 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +2 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/events.d.ts +158 -0
- package/dist/types/events.d.ts.map +1 -0
- package/dist/types/events.js +2 -0
- package/dist/types/events.js.map +1 -0
- package/dist/types/options.d.ts +263 -0
- package/dist/types/options.d.ts.map +1 -0
- package/dist/types/options.js +2 -0
- package/dist/types/options.js.map +1 -0
- package/dist/urlMatch.d.ts +19 -0
- package/dist/urlMatch.d.ts.map +1 -0
- package/dist/urlMatch.js +183 -0
- package/dist/urlMatch.js.map +1 -0
- package/dist/utilityScriptSerializers.d.ts +61 -0
- package/dist/utilityScriptSerializers.d.ts.map +1 -0
- package/dist/utilityScriptSerializers.js +297 -0
- package/dist/utilityScriptSerializers.js.map +1 -0
- package/dist/vendor/playwright/ariaSnapshotEvaluate.d.ts +2 -0
- package/dist/vendor/playwright/ariaSnapshotEvaluate.d.ts.map +1 -0
- package/dist/vendor/playwright/ariaSnapshotEvaluate.js +207 -0
- package/dist/vendor/playwright/ariaSnapshotEvaluate.js.map +1 -0
- package/dist/vendor/playwright/generated/clockSource.d.ts +9 -0
- package/dist/vendor/playwright/generated/clockSource.d.ts.map +1 -0
- package/dist/vendor/playwright/generated/clockSource.js +9 -0
- package/dist/vendor/playwright/generated/clockSource.js.map +1 -0
- package/dist/vendor/playwright/generated/injectedScriptSource.d.ts +9 -0
- package/dist/vendor/playwright/generated/injectedScriptSource.d.ts.map +1 -0
- package/dist/vendor/playwright/generated/injectedScriptSource.js +9 -0
- package/dist/vendor/playwright/generated/injectedScriptSource.js.map +1 -0
- package/dist/video.d.ts +39 -0
- package/dist/video.d.ts.map +1 -0
- package/dist/video.js +235 -0
- package/dist/video.js.map +1 -0
- package/dist/waitForSelector.d.ts +7 -0
- package/dist/waitForSelector.d.ts.map +1 -0
- package/dist/waitForSelector.js +23 -0
- package/dist/waitForSelector.js.map +1 -0
- package/dist/worker.d.ts +45 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +192 -0
- package/dist/worker.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*/
|
|
9
|
+
function isRegExp(obj) {
|
|
10
|
+
try {
|
|
11
|
+
return obj instanceof RegExp || Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function isDate(obj) {
|
|
18
|
+
try {
|
|
19
|
+
return obj instanceof Date || Object.prototype.toString.call(obj) === "[object Date]";
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function isURL(obj) {
|
|
26
|
+
try {
|
|
27
|
+
return obj instanceof URL || Object.prototype.toString.call(obj) === "[object URL]";
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function isError(obj) {
|
|
34
|
+
try {
|
|
35
|
+
return obj instanceof Error || (obj && Object.getPrototypeOf(obj)?.name === "Error");
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function isTypedArray(obj, constructor) {
|
|
42
|
+
try {
|
|
43
|
+
return obj instanceof constructor || Object.prototype.toString.call(obj) === `[object ${constructor.name}]`;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function isArrayBuffer(obj) {
|
|
50
|
+
try {
|
|
51
|
+
return obj instanceof ArrayBuffer || Object.prototype.toString.call(obj) === "[object ArrayBuffer]";
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const typedArrayConstructors = {
|
|
58
|
+
i8: Int8Array,
|
|
59
|
+
ui8: Uint8Array,
|
|
60
|
+
ui8c: Uint8ClampedArray,
|
|
61
|
+
i16: Int16Array,
|
|
62
|
+
ui16: Uint16Array,
|
|
63
|
+
i32: Int32Array,
|
|
64
|
+
ui32: Uint32Array,
|
|
65
|
+
f32: Float32Array,
|
|
66
|
+
f64: Float64Array,
|
|
67
|
+
bi64: BigInt64Array,
|
|
68
|
+
bui64: BigUint64Array
|
|
69
|
+
};
|
|
70
|
+
function typedArrayToBase64(array) {
|
|
71
|
+
if ("toBase64" in array) {
|
|
72
|
+
return array.toBase64();
|
|
73
|
+
}
|
|
74
|
+
const bytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
75
|
+
let binary = "";
|
|
76
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
77
|
+
binary += String.fromCharCode(bytes[index]);
|
|
78
|
+
}
|
|
79
|
+
return btoa(binary);
|
|
80
|
+
}
|
|
81
|
+
function base64ToTypedArray(base64, TypedArrayConstructor) {
|
|
82
|
+
const binary = atob(base64);
|
|
83
|
+
const bytes = new Uint8Array(binary.length);
|
|
84
|
+
for (let i = 0; i < binary.length; i += 1) {
|
|
85
|
+
bytes[i] = binary.charCodeAt(i);
|
|
86
|
+
}
|
|
87
|
+
return new TypedArrayConstructor(bytes.buffer);
|
|
88
|
+
}
|
|
89
|
+
export function parseEvaluationResultValue(value, handles = [], refs = new Map()) {
|
|
90
|
+
if (Object.is(value, undefined)) {
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
if (typeof value === "object" && value) {
|
|
94
|
+
if ("ref" in value) {
|
|
95
|
+
return refs.get(value.ref);
|
|
96
|
+
}
|
|
97
|
+
if ("v" in value) {
|
|
98
|
+
if (value.v === "undefined") {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
if (value.v === "null") {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
if (value.v === "NaN") {
|
|
105
|
+
return NaN;
|
|
106
|
+
}
|
|
107
|
+
if (value.v === "Infinity") {
|
|
108
|
+
return Infinity;
|
|
109
|
+
}
|
|
110
|
+
if (value.v === "-Infinity") {
|
|
111
|
+
return -Infinity;
|
|
112
|
+
}
|
|
113
|
+
if (value.v === "-0") {
|
|
114
|
+
return -0;
|
|
115
|
+
}
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
if ("d" in value) {
|
|
119
|
+
return new Date(value.d);
|
|
120
|
+
}
|
|
121
|
+
if ("u" in value) {
|
|
122
|
+
return new URL(value.u);
|
|
123
|
+
}
|
|
124
|
+
if ("bi" in value) {
|
|
125
|
+
return BigInt(value.bi);
|
|
126
|
+
}
|
|
127
|
+
if ("e" in value) {
|
|
128
|
+
const error = new Error(value.e.m);
|
|
129
|
+
error.name = value.e.n;
|
|
130
|
+
error.stack = value.e.s;
|
|
131
|
+
return error;
|
|
132
|
+
}
|
|
133
|
+
if ("r" in value) {
|
|
134
|
+
return new RegExp(value.r.p, value.r.f);
|
|
135
|
+
}
|
|
136
|
+
if ("a" in value) {
|
|
137
|
+
const result = [];
|
|
138
|
+
refs.set(value.id, result);
|
|
139
|
+
for (let index = 0; index < value.a.length; index += 1) {
|
|
140
|
+
result[index] = parseEvaluationResultValue(value.a[index], handles, refs);
|
|
141
|
+
}
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
if ("o" in value) {
|
|
145
|
+
const result = {};
|
|
146
|
+
refs.set(value.id, result);
|
|
147
|
+
for (const { k, v } of value.o) {
|
|
148
|
+
if (k === "__proto__") {
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
result[k] = parseEvaluationResultValue(v, handles, refs);
|
|
152
|
+
}
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
if ("h" in value) {
|
|
156
|
+
return handles[value.h];
|
|
157
|
+
}
|
|
158
|
+
if ("ta" in value) {
|
|
159
|
+
return base64ToTypedArray(value.ta.b, typedArrayConstructors[value.ta.k]);
|
|
160
|
+
}
|
|
161
|
+
if ("ab" in value) {
|
|
162
|
+
return base64ToTypedArray(value.ab.b, Uint8Array).buffer;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return value;
|
|
166
|
+
}
|
|
167
|
+
export function serializeAsCallArgument(value, handleSerializer) {
|
|
168
|
+
return serialize(value, handleSerializer, { visited: new Map(), lastId: 0 });
|
|
169
|
+
}
|
|
170
|
+
export function serializeAsCallArgumentNoHandles(value) {
|
|
171
|
+
return serializeAsCallArgument(value, (fallThrough) => ({ fallThrough }));
|
|
172
|
+
}
|
|
173
|
+
function serialize(value, handleSerializer, visitorInfo) {
|
|
174
|
+
if (value && typeof value === "object") {
|
|
175
|
+
if (typeof globalThis.Window === "function" && value instanceof globalThis.Window) {
|
|
176
|
+
return "ref: <Window>";
|
|
177
|
+
}
|
|
178
|
+
if (typeof globalThis.Document === "function" && value instanceof globalThis.Document) {
|
|
179
|
+
return "ref: <Document>";
|
|
180
|
+
}
|
|
181
|
+
if (typeof globalThis.Node === "function" && value instanceof globalThis.Node) {
|
|
182
|
+
return "ref: <Node>";
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return innerSerialize(value, handleSerializer, visitorInfo);
|
|
186
|
+
}
|
|
187
|
+
function innerSerialize(value, handleSerializer, visitorInfo) {
|
|
188
|
+
const result = handleSerializer(value);
|
|
189
|
+
if ("fallThrough" in result) {
|
|
190
|
+
value = result.fallThrough;
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
return result;
|
|
194
|
+
}
|
|
195
|
+
if (typeof value === "symbol") {
|
|
196
|
+
return { v: "undefined" };
|
|
197
|
+
}
|
|
198
|
+
if (Object.is(value, undefined)) {
|
|
199
|
+
return { v: "undefined" };
|
|
200
|
+
}
|
|
201
|
+
if (Object.is(value, null)) {
|
|
202
|
+
return { v: "null" };
|
|
203
|
+
}
|
|
204
|
+
if (Object.is(value, NaN)) {
|
|
205
|
+
return { v: "NaN" };
|
|
206
|
+
}
|
|
207
|
+
if (Object.is(value, Infinity)) {
|
|
208
|
+
return { v: "Infinity" };
|
|
209
|
+
}
|
|
210
|
+
if (Object.is(value, -Infinity)) {
|
|
211
|
+
return { v: "-Infinity" };
|
|
212
|
+
}
|
|
213
|
+
if (Object.is(value, -0)) {
|
|
214
|
+
return { v: "-0" };
|
|
215
|
+
}
|
|
216
|
+
if (typeof value === "boolean") {
|
|
217
|
+
return value;
|
|
218
|
+
}
|
|
219
|
+
if (typeof value === "number") {
|
|
220
|
+
return value;
|
|
221
|
+
}
|
|
222
|
+
if (typeof value === "string") {
|
|
223
|
+
return value;
|
|
224
|
+
}
|
|
225
|
+
if (typeof value === "bigint") {
|
|
226
|
+
return { bi: value.toString() };
|
|
227
|
+
}
|
|
228
|
+
if (isError(value)) {
|
|
229
|
+
const stack = value.stack?.startsWith(value.name + ": " + value.message)
|
|
230
|
+
? value.stack
|
|
231
|
+
: `${value.name}: ${value.message}\n${value.stack}`;
|
|
232
|
+
return { e: { n: value.name, m: value.message, s: stack } };
|
|
233
|
+
}
|
|
234
|
+
if (isDate(value)) {
|
|
235
|
+
return { d: value.toJSON() };
|
|
236
|
+
}
|
|
237
|
+
if (isURL(value)) {
|
|
238
|
+
return { u: value.toJSON() };
|
|
239
|
+
}
|
|
240
|
+
if (isRegExp(value)) {
|
|
241
|
+
return { r: { p: value.source, f: value.flags } };
|
|
242
|
+
}
|
|
243
|
+
for (const [k, ctor] of Object.entries(typedArrayConstructors)) {
|
|
244
|
+
if (isTypedArray(value, ctor)) {
|
|
245
|
+
return { ta: { b: typedArrayToBase64(value), k } };
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (isArrayBuffer(value)) {
|
|
249
|
+
return { ab: { b: typedArrayToBase64(new Uint8Array(value)) } };
|
|
250
|
+
}
|
|
251
|
+
const id = visitorInfo.visited.get(value);
|
|
252
|
+
if (id) {
|
|
253
|
+
return { ref: id };
|
|
254
|
+
}
|
|
255
|
+
if (Array.isArray(value)) {
|
|
256
|
+
const a = [];
|
|
257
|
+
const id = ++visitorInfo.lastId;
|
|
258
|
+
visitorInfo.visited.set(value, id);
|
|
259
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
260
|
+
a[i] = serialize(value[i], handleSerializer, visitorInfo);
|
|
261
|
+
}
|
|
262
|
+
return { a, id };
|
|
263
|
+
}
|
|
264
|
+
if (typeof value === "object") {
|
|
265
|
+
const o = [];
|
|
266
|
+
const id = ++visitorInfo.lastId;
|
|
267
|
+
visitorInfo.visited.set(value, id);
|
|
268
|
+
let objectIndex = 0;
|
|
269
|
+
for (const name of Object.keys(value)) {
|
|
270
|
+
let item;
|
|
271
|
+
try {
|
|
272
|
+
item = value[name];
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
if (name === "toJSON" && typeof item === "function") {
|
|
278
|
+
o[objectIndex++] = { k: name, v: { o: [], id: 0 } };
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
o[objectIndex++] = { k: name, v: serialize(item, handleSerializer, visitorInfo) };
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
let jsonWrapper;
|
|
285
|
+
try {
|
|
286
|
+
if (o.length === 0 && value.toJSON && typeof value.toJSON === "function") {
|
|
287
|
+
jsonWrapper = { value: value.toJSON() };
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
catch { }
|
|
291
|
+
if (jsonWrapper) {
|
|
292
|
+
return innerSerialize(jsonWrapper.value, handleSerializer, visitorInfo);
|
|
293
|
+
}
|
|
294
|
+
return { o, id };
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
//# sourceMappingURL=utilityScriptSerializers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilityScriptSerializers.js","sourceRoot":"","sources":["../src/utilityScriptSerializers.ts"],"names":[],"mappings":"AAAA;;;;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,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YACtD,CAAC;iBAAM,CAAC;gBACN,CAAC,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,SAAS,CAAC,IAAI,EAAE,gBAAgB,EAAE,WAAW,CAAC,EAAE,CAAC;YACpF,CAAC;QACH,CAAC;QAED,IAAI,WAAW,CAAC;QAChB,IAAI,CAAC;YACH,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBACzE,WAAW,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YAC1C,CAAC;QACH,CAAC;QAAC,MAAM,CAAC,CAAA,CAAC;QACV,IAAI,WAAW,EAAE,CAAC;YAChB,OAAO,cAAc,CAAC,WAAW,CAAC,KAAK,EAAE,gBAAgB,EAAE,WAAW,CAAC,CAAC;QAC1E,CAAC;QAED,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ariaSnapshotEvaluate.d.ts","sourceRoot":"","sources":["../../../src/vendor/playwright/ariaSnapshotEvaluate.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,wCAAwC,QAqMnD,CAAC"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Playwright browser_snapshot evaluate wrapper.
|
|
3
|
+
*
|
|
4
|
+
* The injected snapshot implementation is vendored from Microsoft Playwright
|
|
5
|
+
* at commit e8e8d69569de6ad8885b50664bdfd0dc3e8315ed (Apache-2.0).
|
|
6
|
+
* This wrapper intentionally does not import Playwright at runtime.
|
|
7
|
+
*/
|
|
8
|
+
import { PLAYWRIGHT_INJECTED_SCRIPT_SOURCE } from "./generated/injectedScriptSource.js";
|
|
9
|
+
export const PLAYWRIGHT_ARIA_SNAPSHOT_EVALUATE_SOURCE = `(payload) => {
|
|
10
|
+
const options = payload && payload.options ? payload.options : {};
|
|
11
|
+
const target = payload && payload.target ? payload.target : undefined;
|
|
12
|
+
const rootDocument = document;
|
|
13
|
+
if (!rootDocument.body || rootDocument.readyState === "loading") {
|
|
14
|
+
return {
|
|
15
|
+
notReady: true,
|
|
16
|
+
refs: {},
|
|
17
|
+
text: "",
|
|
18
|
+
title: String(rootDocument.title || ""),
|
|
19
|
+
url: String(globalThis.location && globalThis.location.href || "")
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const previousState = globalThis.__roxyMcpState && globalThis.__roxyMcpState.elements
|
|
24
|
+
? globalThis.__roxyMcpState
|
|
25
|
+
: { elements: new Map(), refs: new Map(), nextFrameSeq: 1 };
|
|
26
|
+
|
|
27
|
+
function resolveRootNode() {
|
|
28
|
+
if (!target) {
|
|
29
|
+
return { ok: true, node: rootDocument.body };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (target.nodeToken) {
|
|
33
|
+
const element = previousState.elements.get(target.nodeToken);
|
|
34
|
+
if (!element || !element.isConnected) {
|
|
35
|
+
return { ok: false, error: { code: "stale" } };
|
|
36
|
+
}
|
|
37
|
+
return { ok: true, node: element };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const selector = target.selector || target.raw;
|
|
41
|
+
if (!selector) {
|
|
42
|
+
return { ok: false, error: { code: "not_found" } };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let element = null;
|
|
46
|
+
try {
|
|
47
|
+
element = rootDocument.querySelector(selector);
|
|
48
|
+
} catch (error) {
|
|
49
|
+
return {
|
|
50
|
+
ok: false,
|
|
51
|
+
error: {
|
|
52
|
+
code: "invalid_selector",
|
|
53
|
+
message: error && error.message ? String(error.message) : undefined
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!element) {
|
|
59
|
+
return { ok: false, error: { code: "not_found" } };
|
|
60
|
+
}
|
|
61
|
+
return { ok: true, node: element };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const resolvedRoot = resolveRootNode();
|
|
65
|
+
if (!resolvedRoot.ok) {
|
|
66
|
+
return {
|
|
67
|
+
refs: {},
|
|
68
|
+
text: "",
|
|
69
|
+
title: String(rootDocument.title || ""),
|
|
70
|
+
url: String(globalThis.location && globalThis.location.href || ""),
|
|
71
|
+
error: resolvedRoot.error
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!globalThis.__roxyPlaywrightSnapshotBundle) {
|
|
76
|
+
${PLAYWRIGHT_INJECTED_SCRIPT_SOURCE
|
|
77
|
+
.split("\n")
|
|
78
|
+
.map((line) => ` ${line}`)
|
|
79
|
+
.join("\n")}
|
|
80
|
+
}
|
|
81
|
+
const snapshotBundle = globalThis.__roxyPlaywrightSnapshotBundle;
|
|
82
|
+
if (!snapshotBundle || !snapshotBundle.InjectedScript) {
|
|
83
|
+
throw new Error("Playwright snapshot injected bundle did not expose InjectedScript.");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const injected = globalThis.__roxyPlaywrightInjectedScript || new snapshotBundle.InjectedScript(globalThis, {
|
|
87
|
+
isUnderTest: false,
|
|
88
|
+
sdkLanguage: "javascript",
|
|
89
|
+
testIdAttributeName: "data-testid",
|
|
90
|
+
stableRafCount: 1,
|
|
91
|
+
browserName: "chromium",
|
|
92
|
+
shouldPrependErrorPrefix: false,
|
|
93
|
+
isUtilityWorld: true,
|
|
94
|
+
customEngines: []
|
|
95
|
+
});
|
|
96
|
+
globalThis.__roxyPlaywrightInjectedScript = injected;
|
|
97
|
+
|
|
98
|
+
const mcpState = {
|
|
99
|
+
refs: new Map(),
|
|
100
|
+
elements: new Map(),
|
|
101
|
+
nextFrameSeq: typeof previousState.nextFrameSeq === "number" ? previousState.nextFrameSeq : 1
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
function rememberSnapshotElements(snapshotElements) {
|
|
105
|
+
for (const entry of snapshotElements.entries()) {
|
|
106
|
+
const ref = entry[0];
|
|
107
|
+
const element = entry[1];
|
|
108
|
+
mcpState.refs.set(ref, ref);
|
|
109
|
+
mcpState.elements.set(ref, element);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function captureSnapshot(node, snapshotOptions) {
|
|
114
|
+
const snapshot = injected.incrementalAriaSnapshot(node, snapshotOptions);
|
|
115
|
+
const snapshotElements = injected._lastAriaSnapshotForQuery && injected._lastAriaSnapshotForQuery.elements
|
|
116
|
+
? new Map(injected._lastAriaSnapshotForQuery.elements.entries())
|
|
117
|
+
: new Map();
|
|
118
|
+
rememberSnapshotElements(snapshotElements);
|
|
119
|
+
return { elements: snapshotElements, snapshot };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function ensureFrameSeq(iframeElement) {
|
|
123
|
+
if (typeof iframeElement.__roxyFrameSeq !== "number") {
|
|
124
|
+
iframeElement.__roxyFrameSeq = mcpState.nextFrameSeq++;
|
|
125
|
+
}
|
|
126
|
+
return iframeElement.__roxyFrameSeq;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function stitchCapture(capture, snapshotOptions) {
|
|
130
|
+
const renderedIframeRefs = (capture.snapshot.iframeRefs || []).filter(
|
|
131
|
+
(ref) => ref in (capture.snapshot.iframeDepths || {})
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const childSnapshots = renderedIframeRefs.map((ref) => {
|
|
135
|
+
const iframeElement = capture.elements.get(ref);
|
|
136
|
+
if (!iframeElement) {
|
|
137
|
+
return { full: [] };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
let frameRoot = null;
|
|
141
|
+
try {
|
|
142
|
+
const frameDocument = iframeElement.contentDocument;
|
|
143
|
+
frameRoot = frameDocument && (frameDocument.body || frameDocument.documentElement);
|
|
144
|
+
} catch {}
|
|
145
|
+
|
|
146
|
+
if (!frameRoot) {
|
|
147
|
+
return { full: [] };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const iframeDepth = capture.snapshot.iframeDepths[ref];
|
|
151
|
+
const childDepth =
|
|
152
|
+
typeof snapshotOptions.depth === "number"
|
|
153
|
+
? snapshotOptions.depth - iframeDepth - 1
|
|
154
|
+
: undefined;
|
|
155
|
+
const frameSeq = ensureFrameSeq(iframeElement);
|
|
156
|
+
const childCapture = captureSnapshot(frameRoot, {
|
|
157
|
+
...snapshotOptions,
|
|
158
|
+
depth: childDepth,
|
|
159
|
+
refPrefix: "f" + frameSeq
|
|
160
|
+
});
|
|
161
|
+
return stitchCapture(childCapture, {
|
|
162
|
+
...snapshotOptions,
|
|
163
|
+
depth: childDepth
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const full = [];
|
|
168
|
+
const lines = String(capture.snapshot.full || "").split("\\n");
|
|
169
|
+
for (const line of lines) {
|
|
170
|
+
const match = line.match(/^(\\s*)- iframe (?:\\[active\\] )?\\[ref=([^\\]]*)\\]/);
|
|
171
|
+
if (!match) {
|
|
172
|
+
if (line) {
|
|
173
|
+
full.push(line);
|
|
174
|
+
}
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const leadingSpace = match[1];
|
|
179
|
+
const ref = match[2];
|
|
180
|
+
const childSnapshot = childSnapshots[renderedIframeRefs.indexOf(ref)] || { full: [] };
|
|
181
|
+
full.push(childSnapshot.full.length ? line + ":" : line);
|
|
182
|
+
full.push(...childSnapshot.full.map((entry) => leadingSpace + " " + entry));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return { full };
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const baseSnapshotOptions = {
|
|
189
|
+
mode: options.mode || "default",
|
|
190
|
+
refPrefix: "",
|
|
191
|
+
doNotRenderActive: options.doNotRenderActive,
|
|
192
|
+
depth: options.depth,
|
|
193
|
+
boxes: options.boxes
|
|
194
|
+
};
|
|
195
|
+
const rootCapture = captureSnapshot(resolvedRoot.node, baseSnapshotOptions);
|
|
196
|
+
const stitched = stitchCapture(rootCapture, baseSnapshotOptions);
|
|
197
|
+
|
|
198
|
+
globalThis.__roxyMcpState = mcpState;
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
refs: Object.fromEntries(mcpState.refs.entries()),
|
|
202
|
+
text: stitched.full.join("\\n"),
|
|
203
|
+
title: String(rootDocument.title || ""),
|
|
204
|
+
url: String(globalThis.location && globalThis.location.href || "")
|
|
205
|
+
};
|
|
206
|
+
}`;
|
|
207
|
+
//# sourceMappingURL=ariaSnapshotEvaluate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ariaSnapshotEvaluate.js","sourceRoot":"","sources":["../../../src/vendor/playwright/ariaSnapshotEvaluate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAExF,MAAM,CAAC,MAAM,wCAAwC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEtD,iCAAiC;KAChC,KAAK,CAAC,IAAI,CAAC;KACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC;KAC5B,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+HX,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/generate-playwright-clock-source.mjs.
|
|
3
|
+
*
|
|
4
|
+
* Source entry: library/playwright/packages/injected/src/clock.ts
|
|
5
|
+
* Do not edit this file directly; edit the upstream readable source and
|
|
6
|
+
* re-run this generator.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PLAYWRIGHT_CLOCK_SOURCE = "var __roxyPlaywrightClockSource = (function(exports) {\n\tObject.defineProperty(exports, Symbol.toStringTag, { value: \"Module\" });\n\t//#region library/playwright/packages/injected/src/clock.ts\n\tvar ClockController = class {\n\t\tconstructor(embedder) {\n\t\t\tthis._duringTick = false;\n\t\t\tthis._uniqueTimerId = idCounterStart;\n\t\t\tthis.disposables = [];\n\t\t\tthis._log = [];\n\t\t\tthis._timers = /* @__PURE__ */ new Map();\n\t\t\tthis._now = {\n\t\t\t\ttime: asWallTime(0),\n\t\t\t\tisFixedTime: false,\n\t\t\t\tticks: 0,\n\t\t\t\torigin: asWallTime(-1)\n\t\t\t};\n\t\t\tthis._embedder = embedder;\n\t\t}\n\t\tuninstall() {\n\t\t\tthis.disposables.forEach((dispose) => dispose());\n\t\t\tthis.disposables.length = 0;\n\t\t}\n\t\tnow() {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._syncRealTime();\n\t\t\treturn this._now.time;\n\t\t}\n\t\tinstall(time) {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._innerInstall(asWallTime(time));\n\t\t}\n\t\tsetSystemTime(time) {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._innerSetTime(asWallTime(time));\n\t\t}\n\t\tsetFixedTime(time) {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._innerSetFixedTime(asWallTime(time));\n\t\t}\n\t\tperformanceNow() {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._syncRealTime();\n\t\t\treturn this._now.ticks;\n\t\t}\n\t\t_syncRealTime() {\n\t\t\tif (!this._realTime) return;\n\t\t\tconst now = this._embedder.performanceNow();\n\t\t\tconst sinceLastSync = now - this._realTime.lastSyncTicks;\n\t\t\tif (sinceLastSync > 0) {\n\t\t\t\tthis._advanceNow(shiftTicks(this._now.ticks, sinceLastSync));\n\t\t\t\tthis._realTime.lastSyncTicks = now;\n\t\t\t}\n\t\t}\n\t\t_innerSetTime(time) {\n\t\t\tthis._now.time = time;\n\t\t\tthis._now.isFixedTime = false;\n\t\t\tif (this._now.origin < 0) this._now.origin = this._now.time;\n\t\t}\n\t\t_innerInstall(time) {\n\t\t\tif (this._now.origin < 0) this._now.ticks = 0;\n\t\t\tthis._innerSetTime(time);\n\t\t}\n\t\t_innerSetFixedTime(time) {\n\t\t\tthis._innerSetTime(time);\n\t\t\tthis._now.isFixedTime = true;\n\t\t}\n\t\t_advanceNow(to) {\n\t\t\tif (this._now.ticks > to) return;\n\t\t\tif (!this._now.isFixedTime) this._now.time = asWallTime(this._now.time + to - this._now.ticks);\n\t\t\tthis._now.ticks = to;\n\t\t}\n\t\tasync log(type, time, param) {\n\t\t\tthis._log.push({\n\t\t\t\ttype,\n\t\t\t\ttime,\n\t\t\t\tparam\n\t\t\t});\n\t\t}\n\t\tasync runFor(ticks) {\n\t\t\tthis._replayLogOnce();\n\t\t\tif (ticks < 0) throw new TypeError(\"Negative ticks are not supported\");\n\t\t\tawait this._runWithDisabledRealTimeSync(async () => {\n\t\t\t\tawait this._runTo(shiftTicks(this._now.ticks, ticks));\n\t\t\t});\n\t\t}\n\t\tasync _runTo(to) {\n\t\t\tto = Math.ceil(to);\n\t\t\tif (this._now.ticks > to) return;\n\t\t\tlet firstException;\n\t\t\twhile (true) {\n\t\t\t\tconst result = await this._callFirstTimer(to);\n\t\t\t\tif (!result.timerFound) break;\n\t\t\t\tfirstException = firstException || result.error;\n\t\t\t}\n\t\t\tthis._advanceNow(to);\n\t\t\tif (firstException) throw firstException;\n\t\t}\n\t\tasync pauseAt(time) {\n\t\t\tthis._replayLogOnce();\n\t\t\tawait this._innerPause();\n\t\t\tconst toConsume = time - this._now.time;\n\t\t\tawait this._innerFastForwardTo(shiftTicks(this._now.ticks, toConsume));\n\t\t\treturn toConsume;\n\t\t}\n\t\tasync _innerPause() {\n\t\t\tthis._realTime = void 0;\n\t\t\tawait this._currentRealTimeTimer?.dispose();\n\t\t\tthis._currentRealTimeTimer = void 0;\n\t\t}\n\t\tresume() {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._innerResume();\n\t\t}\n\t\t_innerResume() {\n\t\t\tconst now = this._embedder.performanceNow();\n\t\t\tthis._realTime = {\n\t\t\t\tstartTicks: now,\n\t\t\t\tlastSyncTicks: now\n\t\t\t};\n\t\t\tthis._updateRealTimeTimer();\n\t\t}\n\t\t_updateRealTimeTimer() {\n\t\t\tif (this._currentRealTimeTimer?.promise) return;\n\t\t\tconst firstTimer = this._firstTimer();\n\t\t\tconst nextTick = Math.min(firstTimer ? firstTimer.callAt : this._now.ticks + maxTimeout, this._now.ticks + 100);\n\t\t\tconst callAt = this._currentRealTimeTimer ? Math.min(this._currentRealTimeTimer.callAt, nextTick) : nextTick;\n\t\t\tif (this._currentRealTimeTimer) {\n\t\t\t\tthis._currentRealTimeTimer.cancel();\n\t\t\t\tthis._currentRealTimeTimer = void 0;\n\t\t\t}\n\t\t\tconst realTimeTimer = {\n\t\t\t\tcallAt,\n\t\t\t\tpromise: void 0,\n\t\t\t\tcancel: this._embedder.setTimeout(() => {\n\t\t\t\t\tthis._syncRealTime();\n\t\t\t\t\trealTimeTimer.promise = this._runTo(this._now.ticks).catch((e) => console.error(e));\n\t\t\t\t\trealTimeTimer.promise.then(() => {\n\t\t\t\t\t\tthis._currentRealTimeTimer = void 0;\n\t\t\t\t\t\tif (this._realTime) this._updateRealTimeTimer();\n\t\t\t\t\t});\n\t\t\t\t}, callAt - this._now.ticks),\n\t\t\t\tdispose: async () => {\n\t\t\t\t\trealTimeTimer.cancel();\n\t\t\t\t\tawait realTimeTimer.promise;\n\t\t\t\t}\n\t\t\t};\n\t\t\tthis._currentRealTimeTimer = realTimeTimer;\n\t\t}\n\t\tasync _runWithDisabledRealTimeSync(fn) {\n\t\t\tif (!this._realTime) {\n\t\t\t\tawait fn();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait this._innerPause();\n\t\t\ttry {\n\t\t\t\tawait fn();\n\t\t\t} finally {\n\t\t\t\tthis._innerResume();\n\t\t\t}\n\t\t}\n\t\tasync fastForward(ticks) {\n\t\t\tthis._replayLogOnce();\n\t\t\tawait this._runWithDisabledRealTimeSync(async () => {\n\t\t\t\tawait this._innerFastForwardTo(shiftTicks(this._now.ticks, ticks | 0));\n\t\t\t});\n\t\t}\n\t\tasync _innerFastForwardTo(to) {\n\t\t\tif (to < this._now.ticks) throw new Error(\"Cannot fast-forward to the past\");\n\t\t\tfor (const timer of this._timers.values()) if (to > timer.callAt) timer.callAt = to;\n\t\t\tawait this._runTo(to);\n\t\t}\n\t\taddTimer(options) {\n\t\t\tthis._replayLogOnce();\n\t\t\tif (options.type === \"AnimationFrame\" && !options.func) throw new Error(\"Callback must be provided to requestAnimationFrame calls\");\n\t\t\tif (options.type === \"IdleCallback\" && !options.func) throw new Error(\"Callback must be provided to requestIdleCallback calls\");\n\t\t\tif ([\"Timeout\", \"Interval\"].includes(options.type) && !options.func && options.delay === void 0) throw new Error(\"Callback must be provided to timer calls\");\n\t\t\tlet delay = options.delay ? +options.delay : 0;\n\t\t\tif (!Number.isFinite(delay)) delay = 0;\n\t\t\tdelay = delay > maxTimeout ? 1 : delay;\n\t\t\tdelay = Math.max(0, delay);\n\t\t\tconst timer = {\n\t\t\t\ttype: options.type,\n\t\t\t\tfunc: options.func,\n\t\t\t\targs: options.args || [],\n\t\t\t\tdelay,\n\t\t\t\tcallAt: shiftTicks(this._now.ticks, delay || (this._duringTick ? 1 : 0)),\n\t\t\t\tcreatedAt: this._now.ticks,\n\t\t\t\tid: this._uniqueTimerId++,\n\t\t\t\terror: /* @__PURE__ */ new Error()\n\t\t\t};\n\t\t\tthis._timers.set(timer.id, timer);\n\t\t\tif (this._realTime) this._updateRealTimeTimer();\n\t\t\treturn timer.id;\n\t\t}\n\t\tcountTimers() {\n\t\t\treturn this._timers.size;\n\t\t}\n\t\t_firstTimer(beforeTick) {\n\t\t\tlet firstTimer = null;\n\t\t\tfor (const timer of this._timers.values()) if ((beforeTick === void 0 || timer.callAt <= beforeTick) && (!firstTimer || compareTimers(firstTimer, timer) === 1)) firstTimer = timer;\n\t\t\treturn firstTimer;\n\t\t}\n\t\t_takeFirstTimer(beforeTick) {\n\t\t\tconst timer = this._firstTimer(beforeTick);\n\t\t\tif (!timer) return null;\n\t\t\tthis._advanceNow(timer.callAt);\n\t\t\tif (timer.type === \"Interval\") timer.callAt = shiftTicks(timer.callAt, timer.delay);\n\t\t\telse this._timers.delete(timer.id);\n\t\t\treturn timer;\n\t\t}\n\t\tasync _callFirstTimer(beforeTick) {\n\t\t\tconst timer = this._takeFirstTimer(beforeTick);\n\t\t\tif (!timer) return { timerFound: false };\n\t\t\tthis._duringTick = true;\n\t\t\ttry {\n\t\t\t\tif (typeof timer.func !== \"function\") {\n\t\t\t\t\tlet error;\n\t\t\t\t\ttry {\n\t\t\t\t\t\t(() => {\n\t\t\t\t\t\t\tglobalThis.eval(timer.func);\n\t\t\t\t\t\t})();\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\terror = e;\n\t\t\t\t\t}\n\t\t\t\t\tawait new Promise((f) => this._embedder.setTimeout(f));\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttimerFound: true,\n\t\t\t\t\t\terror\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tlet args = timer.args;\n\t\t\t\tif (timer.type === \"AnimationFrame\") args = [this._now.ticks];\n\t\t\t\telse if (timer.type === \"IdleCallback\") args = [{\n\t\t\t\t\tdidTimeout: false,\n\t\t\t\t\ttimeRemaining: () => 0\n\t\t\t\t}];\n\t\t\t\tlet error;\n\t\t\t\ttry {\n\t\t\t\t\ttimer.func.apply(null, args);\n\t\t\t\t} catch (e) {\n\t\t\t\t\terror = e;\n\t\t\t\t}\n\t\t\t\tawait new Promise((f) => this._embedder.setTimeout(f));\n\t\t\t\treturn {\n\t\t\t\t\ttimerFound: true,\n\t\t\t\t\terror\n\t\t\t\t};\n\t\t\t} finally {\n\t\t\t\tthis._duringTick = false;\n\t\t\t}\n\t\t}\n\t\tgetTimeToNextFrame() {\n\t\t\tthis._replayLogOnce();\n\t\t\treturn 16 - this._now.ticks % 16;\n\t\t}\n\t\tclearTimer(timerId, type) {\n\t\t\tthis._replayLogOnce();\n\t\t\tif (!timerId) return;\n\t\t\tconst id = Number(timerId);\n\t\t\tif (Number.isNaN(id) || id < idCounterStart) `${getClearHandler(type)}`;\n\t\t\tconst timer = this._timers.get(id);\n\t\t\tif (timer) if (timer.type === type || timer.type === \"Timeout\" && type === \"Interval\" || timer.type === \"Interval\" && type === \"Timeout\") this._timers.delete(id);\n\t\t\telse {\n\t\t\t\tconst clear = getClearHandler(type);\n\t\t\t\tconst schedule = getScheduleHandler(timer.type);\n\t\t\t\tthrow new Error(`Cannot clear timer: timer created with ${schedule}() but cleared with ${clear}()`);\n\t\t\t}\n\t\t}\n\t\t_replayLogOnce() {\n\t\t\tif (!this._log.length) return;\n\t\t\tlet lastLogTime = -1;\n\t\t\tlet isPaused = false;\n\t\t\tfor (const { type, time, param } of this._log) {\n\t\t\t\tif (!isPaused && lastLogTime !== -1) this._advanceNow(shiftTicks(this._now.ticks, time - lastLogTime));\n\t\t\t\tlastLogTime = time;\n\t\t\t\tif (type === \"install\") this._innerInstall(asWallTime(param));\n\t\t\t\telse if (type === \"fastForward\" || type === \"runFor\") this._advanceNow(shiftTicks(this._now.ticks, param));\n\t\t\t\telse if (type === \"pauseAt\") {\n\t\t\t\t\tisPaused = true;\n\t\t\t\t\tthis._innerSetTime(asWallTime(param));\n\t\t\t\t} else if (type === \"resume\") isPaused = false;\n\t\t\t\telse if (type === \"setFixedTime\") this._innerSetFixedTime(asWallTime(param));\n\t\t\t\telse if (type === \"setSystemTime\") this._innerSetTime(asWallTime(param));\n\t\t\t}\n\t\t\tif (!isPaused) {\n\t\t\t\tif (lastLogTime > 0) this._advanceNow(shiftTicks(this._now.ticks, this._embedder.dateNow() - lastLogTime));\n\t\t\t\tthis._innerResume();\n\t\t\t} else this._realTime = void 0;\n\t\t\tthis._log.length = 0;\n\t\t}\n\t};\n\tfunction mirrorDateProperties(target, source) {\n\t\tfor (const prop in source) if (source.hasOwnProperty(prop)) target[prop] = source[prop];\n\t\ttarget.toString = () => source.toString();\n\t\ttarget.prototype = source.prototype;\n\t\ttarget.parse = source.parse;\n\t\ttarget.UTC = source.UTC;\n\t\ttarget.prototype.toUTCString = source.prototype.toUTCString;\n\t\ttarget.isFake = true;\n\t\treturn target;\n\t}\n\tfunction createDate(clock, NativeDate) {\n\t\tfunction ClockDate(year, month, date, hour, minute, second, ms) {\n\t\t\tif (!(this instanceof ClockDate)) return new NativeDate(clock.now()).toString();\n\t\t\tswitch (arguments.length) {\n\t\t\t\tcase 0: return new NativeDate(clock.now());\n\t\t\t\tcase 1: return new NativeDate(year);\n\t\t\t\tcase 2: return new NativeDate(year, month);\n\t\t\t\tcase 3: return new NativeDate(year, month, date);\n\t\t\t\tcase 4: return new NativeDate(year, month, date, hour);\n\t\t\t\tcase 5: return new NativeDate(year, month, date, hour, minute);\n\t\t\t\tcase 6: return new NativeDate(year, month, date, hour, minute, second);\n\t\t\t\tdefault: return new NativeDate(year, month, date, hour, minute, second, ms);\n\t\t\t}\n\t\t}\n\t\tClockDate.now = () => clock.now();\n\t\treturn mirrorDateProperties(ClockDate, NativeDate);\n\t}\n\t/**\n\t* Mirror Intl by default on our fake implementation\n\t*\n\t* Most of the properties are the original native ones,\n\t* but we need to take control of those that have a\n\t* dependency on the current clock.\n\t*/\n\tfunction createIntl(clock, NativeIntl) {\n\t\tconst ClockIntl = {};\n\t\tfor (const key of Object.getOwnPropertyNames(NativeIntl)) ClockIntl[key] = NativeIntl[key];\n\t\tClockIntl.DateTimeFormat = function(...args) {\n\t\t\tconst realFormatter = new NativeIntl.DateTimeFormat(...args);\n\t\t\treturn {\n\t\t\t\tformatRange: realFormatter.formatRange.bind(realFormatter),\n\t\t\t\tformatRangeToParts: realFormatter.formatRangeToParts.bind(realFormatter),\n\t\t\t\tresolvedOptions: realFormatter.resolvedOptions.bind(realFormatter),\n\t\t\t\tformat: (date) => realFormatter.format(date || clock.now()),\n\t\t\t\tformatToParts: (date) => realFormatter.formatToParts(date || clock.now())\n\t\t\t};\n\t\t};\n\t\tClockIntl.DateTimeFormat.prototype = Object.create(NativeIntl.DateTimeFormat.prototype);\n\t\tClockIntl.DateTimeFormat.supportedLocalesOf = NativeIntl.DateTimeFormat.supportedLocalesOf;\n\t\treturn ClockIntl;\n\t}\n\tfunction compareTimers(a, b) {\n\t\tif (a.callAt < b.callAt) return -1;\n\t\tif (a.callAt > b.callAt) return 1;\n\t\tif (a.type === \"Immediate\" && b.type !== \"Immediate\") return -1;\n\t\tif (a.type !== \"Immediate\" && b.type === \"Immediate\") return 1;\n\t\tif (a.createdAt < b.createdAt) return -1;\n\t\tif (a.createdAt > b.createdAt) return 1;\n\t\tif (a.id < b.id) return -1;\n\t\tif (a.id > b.id) return 1;\n\t}\n\tvar maxTimeout = Math.pow(2, 31) - 1;\n\tvar idCounterStart = 0xe8d4a51000;\n\tfunction platformOriginals(globalObject) {\n\t\tconst raw = {\n\t\t\tsetTimeout: globalObject.setTimeout,\n\t\t\tclearTimeout: globalObject.clearTimeout,\n\t\t\tsetInterval: globalObject.setInterval,\n\t\t\tclearInterval: globalObject.clearInterval,\n\t\t\trequestAnimationFrame: globalObject.requestAnimationFrame ? globalObject.requestAnimationFrame : void 0,\n\t\t\tcancelAnimationFrame: globalObject.cancelAnimationFrame ? globalObject.cancelAnimationFrame : void 0,\n\t\t\trequestIdleCallback: globalObject.requestIdleCallback ? globalObject.requestIdleCallback : void 0,\n\t\t\tcancelIdleCallback: globalObject.cancelIdleCallback ? globalObject.cancelIdleCallback : void 0,\n\t\t\tDate: globalObject.Date,\n\t\t\tperformance: globalObject.performance,\n\t\t\tIntl: globalObject.Intl,\n\t\t\tAbortSignal: globalObject.AbortSignal\n\t\t};\n\t\tconst bound = { ...raw };\n\t\tfor (const key of Object.keys(bound)) if (key !== \"Date\" && key !== \"AbortSignal\" && typeof bound[key] === \"function\") bound[key] = bound[key].bind(globalObject);\n\t\treturn {\n\t\t\traw,\n\t\t\tbound\n\t\t};\n\t}\n\t/**\n\t* Gets schedule handler name for a given timer type\n\t*/\n\tfunction getScheduleHandler(type) {\n\t\tif (type === \"IdleCallback\" || type === \"AnimationFrame\") return `request${type}`;\n\t\treturn `set${type}`;\n\t}\n\tfunction createApi(clock, originals, browserName) {\n\t\treturn {\n\t\t\tsetTimeout: (func, timeout, ...args) => {\n\t\t\t\tconst delay = timeout ? +timeout : timeout;\n\t\t\t\treturn clock.addTimer({\n\t\t\t\t\ttype: \"Timeout\",\n\t\t\t\t\tfunc,\n\t\t\t\t\targs,\n\t\t\t\t\tdelay\n\t\t\t\t});\n\t\t\t},\n\t\t\tclearTimeout: (timerId) => {\n\t\t\t\tif (timerId) clock.clearTimer(timerId, \"Timeout\");\n\t\t\t},\n\t\t\tsetInterval: (func, timeout, ...args) => {\n\t\t\t\tconst delay = timeout ? +timeout : timeout;\n\t\t\t\treturn clock.addTimer({\n\t\t\t\t\ttype: \"Interval\",\n\t\t\t\t\tfunc,\n\t\t\t\t\targs,\n\t\t\t\t\tdelay\n\t\t\t\t});\n\t\t\t},\n\t\t\tclearInterval: (timerId) => {\n\t\t\t\tif (timerId) return clock.clearTimer(timerId, \"Interval\");\n\t\t\t},\n\t\t\trequestAnimationFrame: (callback) => {\n\t\t\t\treturn clock.addTimer({\n\t\t\t\t\ttype: \"AnimationFrame\",\n\t\t\t\t\tfunc: callback,\n\t\t\t\t\tdelay: clock.getTimeToNextFrame()\n\t\t\t\t});\n\t\t\t},\n\t\t\tcancelAnimationFrame: (timerId) => {\n\t\t\t\tif (timerId) return clock.clearTimer(timerId, \"AnimationFrame\");\n\t\t\t},\n\t\t\trequestIdleCallback: (callback, options) => {\n\t\t\t\tlet timeToNextIdlePeriod = 0;\n\t\t\t\tif (clock.countTimers() > 0) timeToNextIdlePeriod = 50;\n\t\t\t\treturn clock.addTimer({\n\t\t\t\t\ttype: \"IdleCallback\",\n\t\t\t\t\tfunc: callback,\n\t\t\t\t\tdelay: options?.timeout ? Math.min(options?.timeout, timeToNextIdlePeriod) : timeToNextIdlePeriod\n\t\t\t\t});\n\t\t\t},\n\t\t\tcancelIdleCallback: (timerId) => {\n\t\t\t\tif (timerId) return clock.clearTimer(timerId, \"IdleCallback\");\n\t\t\t},\n\t\t\tIntl: originals.Intl ? createIntl(clock, originals.Intl) : void 0,\n\t\t\tDate: createDate(clock, originals.Date),\n\t\t\tperformance: originals.performance ? fakePerformance(clock, originals.performance) : void 0,\n\t\t\tAbortSignal: originals.AbortSignal ? fakeAbortSignal(clock, originals.AbortSignal, browserName) : void 0\n\t\t};\n\t}\n\tfunction getClearHandler(type) {\n\t\tif (type === \"IdleCallback\" || type === \"AnimationFrame\") return `cancel${type}`;\n\t\treturn `clear${type}`;\n\t}\n\tvar FakePerformanceEntry = class {\n\t\tconstructor(name, entryType, startTime, duration) {\n\t\t\tthis.name = name;\n\t\t\tthis.entryType = entryType;\n\t\t\tthis.startTime = startTime;\n\t\t\tthis.duration = duration;\n\t\t}\n\t\ttoJSON() {\n\t\t\treturn JSON.stringify({ ...this });\n\t\t}\n\t};\n\tfunction fakePerformance(clock, performance) {\n\t\tconst result = { now: () => clock.performanceNow() };\n\t\tresult.__defineGetter__(\"timeOrigin\", () => clock._now.origin || 0);\n\t\tfor (const key of Object.keys(performance.__proto__)) {\n\t\t\tif (key === \"now\" || key === \"timeOrigin\") continue;\n\t\t\tif (key === \"getEntries\" || key === \"getEntriesByName\" || key === \"getEntriesByType\") result[key] = () => [];\n\t\t\telse if (key === \"mark\") result[key] = (name) => new FakePerformanceEntry(name, \"mark\", 0, 0);\n\t\t\telse if (key === \"measure\") result[key] = (name) => new FakePerformanceEntry(name, \"measure\", 0, 50);\n\t\t\telse result[key] = () => {};\n\t\t}\n\t\treturn result;\n\t}\n\tfunction fakeAbortSignal(clock, abortSignal, browserName) {\n\t\tObject.defineProperty(abortSignal, \"timeout\", { value(ms) {\n\t\t\tconst controller = new AbortController();\n\t\t\tclock.addTimer({\n\t\t\t\tdelay: ms,\n\t\t\t\ttype: \"Timeout\",\n\t\t\t\tfunc: () => controller.abort(new DOMException(browserName === \"chromium\" ? \"signal timed out\" : \"The operation timed out.\", \"TimeoutError\"))\n\t\t\t});\n\t\t\treturn controller.signal;\n\t\t} });\n\t\treturn abortSignal;\n\t}\n\tfunction createClock(globalObject, config = {}) {\n\t\tconst originals = platformOriginals(globalObject);\n\t\tconst clock = new ClockController({\n\t\t\tdateNow: () => originals.raw.Date.now(),\n\t\t\tperformanceNow: () => Math.ceil(originals.raw.performance.now()),\n\t\t\tsetTimeout: (task, timeout) => {\n\t\t\t\tconst timerId = originals.bound.setTimeout(task, timeout);\n\t\t\t\treturn () => originals.bound.clearTimeout(timerId);\n\t\t\t},\n\t\t\tsetInterval: (task, delay) => {\n\t\t\t\tconst intervalId = originals.bound.setInterval(task, delay);\n\t\t\t\treturn () => originals.bound.clearInterval(intervalId);\n\t\t\t}\n\t\t});\n\t\treturn {\n\t\t\tclock,\n\t\t\tapi: createApi(clock, originals.bound, config.browserName),\n\t\t\toriginals: originals.raw\n\t\t};\n\t}\n\tfunction install(globalObject, config = {}) {\n\t\tif (globalObject.Date?.isFake) throw new TypeError(`Can't install fake timers twice on the same global object.`);\n\t\tconst { clock, api, originals } = createClock(globalObject, config);\n\t\tconst toFake = config.toFake?.length ? config.toFake : Object.keys(originals);\n\t\tfor (const method of toFake) {\n\t\t\tif (method === \"Date\") globalObject.Date = mirrorDateProperties(api.Date, globalObject.Date);\n\t\t\telse if (method === \"Intl\") globalObject.Intl = api[method];\n\t\t\telse if (method === \"AbortSignal\") globalObject.AbortSignal = api[method];\n\t\t\telse if (method === \"performance\") {\n\t\t\t\tglobalObject.performance = api[method];\n\t\t\t\tconst kEventTimeStamp = Symbol(\"playwrightEventTimeStamp\");\n\t\t\t\tObject.defineProperty(Event.prototype, \"timeStamp\", { get() {\n\t\t\t\t\tif (!this[kEventTimeStamp]) this[kEventTimeStamp] = api.performance?.now();\n\t\t\t\t\treturn this[kEventTimeStamp];\n\t\t\t\t} });\n\t\t\t} else globalObject[method] = (...args) => {\n\t\t\t\treturn api[method].apply(api, args);\n\t\t\t};\n\t\t\tclock.disposables.push(() => {\n\t\t\t\tglobalObject[method] = originals[method];\n\t\t\t});\n\t\t}\n\t\treturn {\n\t\t\tclock,\n\t\t\tapi,\n\t\t\toriginals\n\t\t};\n\t}\n\tfunction inject(globalObject, browserName) {\n\t\tconst builtins = platformOriginals(globalObject).bound;\n\t\tconst { clock: controller } = install(globalObject, { browserName });\n\t\tcontroller.resume();\n\t\treturn {\n\t\t\tcontroller,\n\t\t\tbuiltins\n\t\t};\n\t}\n\tfunction asWallTime(n) {\n\t\treturn n;\n\t}\n\tfunction shiftTicks(ticks, ms) {\n\t\treturn ticks + ms;\n\t}\n\t//#endregion\n\t//#region ../../../../private/var/folders/ch/vhk5lrl50js1y5n25sd7sbh00000gn/T/roxybrowser-playwright-clock-source-ZlgLh6/clock.entry.ts\n\tglobalThis.__roxyPlaywrightClockBundle = { inject };\n\t//#endregion\n\texports.inject = inject;\n\treturn exports;\n})({});\n";
|
|
9
|
+
//# sourceMappingURL=clockSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clockSource.d.ts","sourceRoot":"","sources":["../../../../src/vendor/playwright/generated/clockSource.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,uBAAuB,4spBAA4spB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by scripts/generate-playwright-clock-source.mjs.
|
|
3
|
+
*
|
|
4
|
+
* Source entry: library/playwright/packages/injected/src/clock.ts
|
|
5
|
+
* Do not edit this file directly; edit the upstream readable source and
|
|
6
|
+
* re-run this generator.
|
|
7
|
+
*/
|
|
8
|
+
export const PLAYWRIGHT_CLOCK_SOURCE = "var __roxyPlaywrightClockSource = (function(exports) {\n\tObject.defineProperty(exports, Symbol.toStringTag, { value: \"Module\" });\n\t//#region library/playwright/packages/injected/src/clock.ts\n\tvar ClockController = class {\n\t\tconstructor(embedder) {\n\t\t\tthis._duringTick = false;\n\t\t\tthis._uniqueTimerId = idCounterStart;\n\t\t\tthis.disposables = [];\n\t\t\tthis._log = [];\n\t\t\tthis._timers = /* @__PURE__ */ new Map();\n\t\t\tthis._now = {\n\t\t\t\ttime: asWallTime(0),\n\t\t\t\tisFixedTime: false,\n\t\t\t\tticks: 0,\n\t\t\t\torigin: asWallTime(-1)\n\t\t\t};\n\t\t\tthis._embedder = embedder;\n\t\t}\n\t\tuninstall() {\n\t\t\tthis.disposables.forEach((dispose) => dispose());\n\t\t\tthis.disposables.length = 0;\n\t\t}\n\t\tnow() {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._syncRealTime();\n\t\t\treturn this._now.time;\n\t\t}\n\t\tinstall(time) {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._innerInstall(asWallTime(time));\n\t\t}\n\t\tsetSystemTime(time) {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._innerSetTime(asWallTime(time));\n\t\t}\n\t\tsetFixedTime(time) {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._innerSetFixedTime(asWallTime(time));\n\t\t}\n\t\tperformanceNow() {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._syncRealTime();\n\t\t\treturn this._now.ticks;\n\t\t}\n\t\t_syncRealTime() {\n\t\t\tif (!this._realTime) return;\n\t\t\tconst now = this._embedder.performanceNow();\n\t\t\tconst sinceLastSync = now - this._realTime.lastSyncTicks;\n\t\t\tif (sinceLastSync > 0) {\n\t\t\t\tthis._advanceNow(shiftTicks(this._now.ticks, sinceLastSync));\n\t\t\t\tthis._realTime.lastSyncTicks = now;\n\t\t\t}\n\t\t}\n\t\t_innerSetTime(time) {\n\t\t\tthis._now.time = time;\n\t\t\tthis._now.isFixedTime = false;\n\t\t\tif (this._now.origin < 0) this._now.origin = this._now.time;\n\t\t}\n\t\t_innerInstall(time) {\n\t\t\tif (this._now.origin < 0) this._now.ticks = 0;\n\t\t\tthis._innerSetTime(time);\n\t\t}\n\t\t_innerSetFixedTime(time) {\n\t\t\tthis._innerSetTime(time);\n\t\t\tthis._now.isFixedTime = true;\n\t\t}\n\t\t_advanceNow(to) {\n\t\t\tif (this._now.ticks > to) return;\n\t\t\tif (!this._now.isFixedTime) this._now.time = asWallTime(this._now.time + to - this._now.ticks);\n\t\t\tthis._now.ticks = to;\n\t\t}\n\t\tasync log(type, time, param) {\n\t\t\tthis._log.push({\n\t\t\t\ttype,\n\t\t\t\ttime,\n\t\t\t\tparam\n\t\t\t});\n\t\t}\n\t\tasync runFor(ticks) {\n\t\t\tthis._replayLogOnce();\n\t\t\tif (ticks < 0) throw new TypeError(\"Negative ticks are not supported\");\n\t\t\tawait this._runWithDisabledRealTimeSync(async () => {\n\t\t\t\tawait this._runTo(shiftTicks(this._now.ticks, ticks));\n\t\t\t});\n\t\t}\n\t\tasync _runTo(to) {\n\t\t\tto = Math.ceil(to);\n\t\t\tif (this._now.ticks > to) return;\n\t\t\tlet firstException;\n\t\t\twhile (true) {\n\t\t\t\tconst result = await this._callFirstTimer(to);\n\t\t\t\tif (!result.timerFound) break;\n\t\t\t\tfirstException = firstException || result.error;\n\t\t\t}\n\t\t\tthis._advanceNow(to);\n\t\t\tif (firstException) throw firstException;\n\t\t}\n\t\tasync pauseAt(time) {\n\t\t\tthis._replayLogOnce();\n\t\t\tawait this._innerPause();\n\t\t\tconst toConsume = time - this._now.time;\n\t\t\tawait this._innerFastForwardTo(shiftTicks(this._now.ticks, toConsume));\n\t\t\treturn toConsume;\n\t\t}\n\t\tasync _innerPause() {\n\t\t\tthis._realTime = void 0;\n\t\t\tawait this._currentRealTimeTimer?.dispose();\n\t\t\tthis._currentRealTimeTimer = void 0;\n\t\t}\n\t\tresume() {\n\t\t\tthis._replayLogOnce();\n\t\t\tthis._innerResume();\n\t\t}\n\t\t_innerResume() {\n\t\t\tconst now = this._embedder.performanceNow();\n\t\t\tthis._realTime = {\n\t\t\t\tstartTicks: now,\n\t\t\t\tlastSyncTicks: now\n\t\t\t};\n\t\t\tthis._updateRealTimeTimer();\n\t\t}\n\t\t_updateRealTimeTimer() {\n\t\t\tif (this._currentRealTimeTimer?.promise) return;\n\t\t\tconst firstTimer = this._firstTimer();\n\t\t\tconst nextTick = Math.min(firstTimer ? firstTimer.callAt : this._now.ticks + maxTimeout, this._now.ticks + 100);\n\t\t\tconst callAt = this._currentRealTimeTimer ? Math.min(this._currentRealTimeTimer.callAt, nextTick) : nextTick;\n\t\t\tif (this._currentRealTimeTimer) {\n\t\t\t\tthis._currentRealTimeTimer.cancel();\n\t\t\t\tthis._currentRealTimeTimer = void 0;\n\t\t\t}\n\t\t\tconst realTimeTimer = {\n\t\t\t\tcallAt,\n\t\t\t\tpromise: void 0,\n\t\t\t\tcancel: this._embedder.setTimeout(() => {\n\t\t\t\t\tthis._syncRealTime();\n\t\t\t\t\trealTimeTimer.promise = this._runTo(this._now.ticks).catch((e) => console.error(e));\n\t\t\t\t\trealTimeTimer.promise.then(() => {\n\t\t\t\t\t\tthis._currentRealTimeTimer = void 0;\n\t\t\t\t\t\tif (this._realTime) this._updateRealTimeTimer();\n\t\t\t\t\t});\n\t\t\t\t}, callAt - this._now.ticks),\n\t\t\t\tdispose: async () => {\n\t\t\t\t\trealTimeTimer.cancel();\n\t\t\t\t\tawait realTimeTimer.promise;\n\t\t\t\t}\n\t\t\t};\n\t\t\tthis._currentRealTimeTimer = realTimeTimer;\n\t\t}\n\t\tasync _runWithDisabledRealTimeSync(fn) {\n\t\t\tif (!this._realTime) {\n\t\t\t\tawait fn();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait this._innerPause();\n\t\t\ttry {\n\t\t\t\tawait fn();\n\t\t\t} finally {\n\t\t\t\tthis._innerResume();\n\t\t\t}\n\t\t}\n\t\tasync fastForward(ticks) {\n\t\t\tthis._replayLogOnce();\n\t\t\tawait this._runWithDisabledRealTimeSync(async () => {\n\t\t\t\tawait this._innerFastForwardTo(shiftTicks(this._now.ticks, ticks | 0));\n\t\t\t});\n\t\t}\n\t\tasync _innerFastForwardTo(to) {\n\t\t\tif (to < this._now.ticks) throw new Error(\"Cannot fast-forward to the past\");\n\t\t\tfor (const timer of this._timers.values()) if (to > timer.callAt) timer.callAt = to;\n\t\t\tawait this._runTo(to);\n\t\t}\n\t\taddTimer(options) {\n\t\t\tthis._replayLogOnce();\n\t\t\tif (options.type === \"AnimationFrame\" && !options.func) throw new Error(\"Callback must be provided to requestAnimationFrame calls\");\n\t\t\tif (options.type === \"IdleCallback\" && !options.func) throw new Error(\"Callback must be provided to requestIdleCallback calls\");\n\t\t\tif ([\"Timeout\", \"Interval\"].includes(options.type) && !options.func && options.delay === void 0) throw new Error(\"Callback must be provided to timer calls\");\n\t\t\tlet delay = options.delay ? +options.delay : 0;\n\t\t\tif (!Number.isFinite(delay)) delay = 0;\n\t\t\tdelay = delay > maxTimeout ? 1 : delay;\n\t\t\tdelay = Math.max(0, delay);\n\t\t\tconst timer = {\n\t\t\t\ttype: options.type,\n\t\t\t\tfunc: options.func,\n\t\t\t\targs: options.args || [],\n\t\t\t\tdelay,\n\t\t\t\tcallAt: shiftTicks(this._now.ticks, delay || (this._duringTick ? 1 : 0)),\n\t\t\t\tcreatedAt: this._now.ticks,\n\t\t\t\tid: this._uniqueTimerId++,\n\t\t\t\terror: /* @__PURE__ */ new Error()\n\t\t\t};\n\t\t\tthis._timers.set(timer.id, timer);\n\t\t\tif (this._realTime) this._updateRealTimeTimer();\n\t\t\treturn timer.id;\n\t\t}\n\t\tcountTimers() {\n\t\t\treturn this._timers.size;\n\t\t}\n\t\t_firstTimer(beforeTick) {\n\t\t\tlet firstTimer = null;\n\t\t\tfor (const timer of this._timers.values()) if ((beforeTick === void 0 || timer.callAt <= beforeTick) && (!firstTimer || compareTimers(firstTimer, timer) === 1)) firstTimer = timer;\n\t\t\treturn firstTimer;\n\t\t}\n\t\t_takeFirstTimer(beforeTick) {\n\t\t\tconst timer = this._firstTimer(beforeTick);\n\t\t\tif (!timer) return null;\n\t\t\tthis._advanceNow(timer.callAt);\n\t\t\tif (timer.type === \"Interval\") timer.callAt = shiftTicks(timer.callAt, timer.delay);\n\t\t\telse this._timers.delete(timer.id);\n\t\t\treturn timer;\n\t\t}\n\t\tasync _callFirstTimer(beforeTick) {\n\t\t\tconst timer = this._takeFirstTimer(beforeTick);\n\t\t\tif (!timer) return { timerFound: false };\n\t\t\tthis._duringTick = true;\n\t\t\ttry {\n\t\t\t\tif (typeof timer.func !== \"function\") {\n\t\t\t\t\tlet error;\n\t\t\t\t\ttry {\n\t\t\t\t\t\t(() => {\n\t\t\t\t\t\t\tglobalThis.eval(timer.func);\n\t\t\t\t\t\t})();\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\terror = e;\n\t\t\t\t\t}\n\t\t\t\t\tawait new Promise((f) => this._embedder.setTimeout(f));\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttimerFound: true,\n\t\t\t\t\t\terror\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tlet args = timer.args;\n\t\t\t\tif (timer.type === \"AnimationFrame\") args = [this._now.ticks];\n\t\t\t\telse if (timer.type === \"IdleCallback\") args = [{\n\t\t\t\t\tdidTimeout: false,\n\t\t\t\t\ttimeRemaining: () => 0\n\t\t\t\t}];\n\t\t\t\tlet error;\n\t\t\t\ttry {\n\t\t\t\t\ttimer.func.apply(null, args);\n\t\t\t\t} catch (e) {\n\t\t\t\t\terror = e;\n\t\t\t\t}\n\t\t\t\tawait new Promise((f) => this._embedder.setTimeout(f));\n\t\t\t\treturn {\n\t\t\t\t\ttimerFound: true,\n\t\t\t\t\terror\n\t\t\t\t};\n\t\t\t} finally {\n\t\t\t\tthis._duringTick = false;\n\t\t\t}\n\t\t}\n\t\tgetTimeToNextFrame() {\n\t\t\tthis._replayLogOnce();\n\t\t\treturn 16 - this._now.ticks % 16;\n\t\t}\n\t\tclearTimer(timerId, type) {\n\t\t\tthis._replayLogOnce();\n\t\t\tif (!timerId) return;\n\t\t\tconst id = Number(timerId);\n\t\t\tif (Number.isNaN(id) || id < idCounterStart) `${getClearHandler(type)}`;\n\t\t\tconst timer = this._timers.get(id);\n\t\t\tif (timer) if (timer.type === type || timer.type === \"Timeout\" && type === \"Interval\" || timer.type === \"Interval\" && type === \"Timeout\") this._timers.delete(id);\n\t\t\telse {\n\t\t\t\tconst clear = getClearHandler(type);\n\t\t\t\tconst schedule = getScheduleHandler(timer.type);\n\t\t\t\tthrow new Error(`Cannot clear timer: timer created with ${schedule}() but cleared with ${clear}()`);\n\t\t\t}\n\t\t}\n\t\t_replayLogOnce() {\n\t\t\tif (!this._log.length) return;\n\t\t\tlet lastLogTime = -1;\n\t\t\tlet isPaused = false;\n\t\t\tfor (const { type, time, param } of this._log) {\n\t\t\t\tif (!isPaused && lastLogTime !== -1) this._advanceNow(shiftTicks(this._now.ticks, time - lastLogTime));\n\t\t\t\tlastLogTime = time;\n\t\t\t\tif (type === \"install\") this._innerInstall(asWallTime(param));\n\t\t\t\telse if (type === \"fastForward\" || type === \"runFor\") this._advanceNow(shiftTicks(this._now.ticks, param));\n\t\t\t\telse if (type === \"pauseAt\") {\n\t\t\t\t\tisPaused = true;\n\t\t\t\t\tthis._innerSetTime(asWallTime(param));\n\t\t\t\t} else if (type === \"resume\") isPaused = false;\n\t\t\t\telse if (type === \"setFixedTime\") this._innerSetFixedTime(asWallTime(param));\n\t\t\t\telse if (type === \"setSystemTime\") this._innerSetTime(asWallTime(param));\n\t\t\t}\n\t\t\tif (!isPaused) {\n\t\t\t\tif (lastLogTime > 0) this._advanceNow(shiftTicks(this._now.ticks, this._embedder.dateNow() - lastLogTime));\n\t\t\t\tthis._innerResume();\n\t\t\t} else this._realTime = void 0;\n\t\t\tthis._log.length = 0;\n\t\t}\n\t};\n\tfunction mirrorDateProperties(target, source) {\n\t\tfor (const prop in source) if (source.hasOwnProperty(prop)) target[prop] = source[prop];\n\t\ttarget.toString = () => source.toString();\n\t\ttarget.prototype = source.prototype;\n\t\ttarget.parse = source.parse;\n\t\ttarget.UTC = source.UTC;\n\t\ttarget.prototype.toUTCString = source.prototype.toUTCString;\n\t\ttarget.isFake = true;\n\t\treturn target;\n\t}\n\tfunction createDate(clock, NativeDate) {\n\t\tfunction ClockDate(year, month, date, hour, minute, second, ms) {\n\t\t\tif (!(this instanceof ClockDate)) return new NativeDate(clock.now()).toString();\n\t\t\tswitch (arguments.length) {\n\t\t\t\tcase 0: return new NativeDate(clock.now());\n\t\t\t\tcase 1: return new NativeDate(year);\n\t\t\t\tcase 2: return new NativeDate(year, month);\n\t\t\t\tcase 3: return new NativeDate(year, month, date);\n\t\t\t\tcase 4: return new NativeDate(year, month, date, hour);\n\t\t\t\tcase 5: return new NativeDate(year, month, date, hour, minute);\n\t\t\t\tcase 6: return new NativeDate(year, month, date, hour, minute, second);\n\t\t\t\tdefault: return new NativeDate(year, month, date, hour, minute, second, ms);\n\t\t\t}\n\t\t}\n\t\tClockDate.now = () => clock.now();\n\t\treturn mirrorDateProperties(ClockDate, NativeDate);\n\t}\n\t/**\n\t* Mirror Intl by default on our fake implementation\n\t*\n\t* Most of the properties are the original native ones,\n\t* but we need to take control of those that have a\n\t* dependency on the current clock.\n\t*/\n\tfunction createIntl(clock, NativeIntl) {\n\t\tconst ClockIntl = {};\n\t\tfor (const key of Object.getOwnPropertyNames(NativeIntl)) ClockIntl[key] = NativeIntl[key];\n\t\tClockIntl.DateTimeFormat = function(...args) {\n\t\t\tconst realFormatter = new NativeIntl.DateTimeFormat(...args);\n\t\t\treturn {\n\t\t\t\tformatRange: realFormatter.formatRange.bind(realFormatter),\n\t\t\t\tformatRangeToParts: realFormatter.formatRangeToParts.bind(realFormatter),\n\t\t\t\tresolvedOptions: realFormatter.resolvedOptions.bind(realFormatter),\n\t\t\t\tformat: (date) => realFormatter.format(date || clock.now()),\n\t\t\t\tformatToParts: (date) => realFormatter.formatToParts(date || clock.now())\n\t\t\t};\n\t\t};\n\t\tClockIntl.DateTimeFormat.prototype = Object.create(NativeIntl.DateTimeFormat.prototype);\n\t\tClockIntl.DateTimeFormat.supportedLocalesOf = NativeIntl.DateTimeFormat.supportedLocalesOf;\n\t\treturn ClockIntl;\n\t}\n\tfunction compareTimers(a, b) {\n\t\tif (a.callAt < b.callAt) return -1;\n\t\tif (a.callAt > b.callAt) return 1;\n\t\tif (a.type === \"Immediate\" && b.type !== \"Immediate\") return -1;\n\t\tif (a.type !== \"Immediate\" && b.type === \"Immediate\") return 1;\n\t\tif (a.createdAt < b.createdAt) return -1;\n\t\tif (a.createdAt > b.createdAt) return 1;\n\t\tif (a.id < b.id) return -1;\n\t\tif (a.id > b.id) return 1;\n\t}\n\tvar maxTimeout = Math.pow(2, 31) - 1;\n\tvar idCounterStart = 0xe8d4a51000;\n\tfunction platformOriginals(globalObject) {\n\t\tconst raw = {\n\t\t\tsetTimeout: globalObject.setTimeout,\n\t\t\tclearTimeout: globalObject.clearTimeout,\n\t\t\tsetInterval: globalObject.setInterval,\n\t\t\tclearInterval: globalObject.clearInterval,\n\t\t\trequestAnimationFrame: globalObject.requestAnimationFrame ? globalObject.requestAnimationFrame : void 0,\n\t\t\tcancelAnimationFrame: globalObject.cancelAnimationFrame ? globalObject.cancelAnimationFrame : void 0,\n\t\t\trequestIdleCallback: globalObject.requestIdleCallback ? globalObject.requestIdleCallback : void 0,\n\t\t\tcancelIdleCallback: globalObject.cancelIdleCallback ? globalObject.cancelIdleCallback : void 0,\n\t\t\tDate: globalObject.Date,\n\t\t\tperformance: globalObject.performance,\n\t\t\tIntl: globalObject.Intl,\n\t\t\tAbortSignal: globalObject.AbortSignal\n\t\t};\n\t\tconst bound = { ...raw };\n\t\tfor (const key of Object.keys(bound)) if (key !== \"Date\" && key !== \"AbortSignal\" && typeof bound[key] === \"function\") bound[key] = bound[key].bind(globalObject);\n\t\treturn {\n\t\t\traw,\n\t\t\tbound\n\t\t};\n\t}\n\t/**\n\t* Gets schedule handler name for a given timer type\n\t*/\n\tfunction getScheduleHandler(type) {\n\t\tif (type === \"IdleCallback\" || type === \"AnimationFrame\") return `request${type}`;\n\t\treturn `set${type}`;\n\t}\n\tfunction createApi(clock, originals, browserName) {\n\t\treturn {\n\t\t\tsetTimeout: (func, timeout, ...args) => {\n\t\t\t\tconst delay = timeout ? +timeout : timeout;\n\t\t\t\treturn clock.addTimer({\n\t\t\t\t\ttype: \"Timeout\",\n\t\t\t\t\tfunc,\n\t\t\t\t\targs,\n\t\t\t\t\tdelay\n\t\t\t\t});\n\t\t\t},\n\t\t\tclearTimeout: (timerId) => {\n\t\t\t\tif (timerId) clock.clearTimer(timerId, \"Timeout\");\n\t\t\t},\n\t\t\tsetInterval: (func, timeout, ...args) => {\n\t\t\t\tconst delay = timeout ? +timeout : timeout;\n\t\t\t\treturn clock.addTimer({\n\t\t\t\t\ttype: \"Interval\",\n\t\t\t\t\tfunc,\n\t\t\t\t\targs,\n\t\t\t\t\tdelay\n\t\t\t\t});\n\t\t\t},\n\t\t\tclearInterval: (timerId) => {\n\t\t\t\tif (timerId) return clock.clearTimer(timerId, \"Interval\");\n\t\t\t},\n\t\t\trequestAnimationFrame: (callback) => {\n\t\t\t\treturn clock.addTimer({\n\t\t\t\t\ttype: \"AnimationFrame\",\n\t\t\t\t\tfunc: callback,\n\t\t\t\t\tdelay: clock.getTimeToNextFrame()\n\t\t\t\t});\n\t\t\t},\n\t\t\tcancelAnimationFrame: (timerId) => {\n\t\t\t\tif (timerId) return clock.clearTimer(timerId, \"AnimationFrame\");\n\t\t\t},\n\t\t\trequestIdleCallback: (callback, options) => {\n\t\t\t\tlet timeToNextIdlePeriod = 0;\n\t\t\t\tif (clock.countTimers() > 0) timeToNextIdlePeriod = 50;\n\t\t\t\treturn clock.addTimer({\n\t\t\t\t\ttype: \"IdleCallback\",\n\t\t\t\t\tfunc: callback,\n\t\t\t\t\tdelay: options?.timeout ? Math.min(options?.timeout, timeToNextIdlePeriod) : timeToNextIdlePeriod\n\t\t\t\t});\n\t\t\t},\n\t\t\tcancelIdleCallback: (timerId) => {\n\t\t\t\tif (timerId) return clock.clearTimer(timerId, \"IdleCallback\");\n\t\t\t},\n\t\t\tIntl: originals.Intl ? createIntl(clock, originals.Intl) : void 0,\n\t\t\tDate: createDate(clock, originals.Date),\n\t\t\tperformance: originals.performance ? fakePerformance(clock, originals.performance) : void 0,\n\t\t\tAbortSignal: originals.AbortSignal ? fakeAbortSignal(clock, originals.AbortSignal, browserName) : void 0\n\t\t};\n\t}\n\tfunction getClearHandler(type) {\n\t\tif (type === \"IdleCallback\" || type === \"AnimationFrame\") return `cancel${type}`;\n\t\treturn `clear${type}`;\n\t}\n\tvar FakePerformanceEntry = class {\n\t\tconstructor(name, entryType, startTime, duration) {\n\t\t\tthis.name = name;\n\t\t\tthis.entryType = entryType;\n\t\t\tthis.startTime = startTime;\n\t\t\tthis.duration = duration;\n\t\t}\n\t\ttoJSON() {\n\t\t\treturn JSON.stringify({ ...this });\n\t\t}\n\t};\n\tfunction fakePerformance(clock, performance) {\n\t\tconst result = { now: () => clock.performanceNow() };\n\t\tresult.__defineGetter__(\"timeOrigin\", () => clock._now.origin || 0);\n\t\tfor (const key of Object.keys(performance.__proto__)) {\n\t\t\tif (key === \"now\" || key === \"timeOrigin\") continue;\n\t\t\tif (key === \"getEntries\" || key === \"getEntriesByName\" || key === \"getEntriesByType\") result[key] = () => [];\n\t\t\telse if (key === \"mark\") result[key] = (name) => new FakePerformanceEntry(name, \"mark\", 0, 0);\n\t\t\telse if (key === \"measure\") result[key] = (name) => new FakePerformanceEntry(name, \"measure\", 0, 50);\n\t\t\telse result[key] = () => {};\n\t\t}\n\t\treturn result;\n\t}\n\tfunction fakeAbortSignal(clock, abortSignal, browserName) {\n\t\tObject.defineProperty(abortSignal, \"timeout\", { value(ms) {\n\t\t\tconst controller = new AbortController();\n\t\t\tclock.addTimer({\n\t\t\t\tdelay: ms,\n\t\t\t\ttype: \"Timeout\",\n\t\t\t\tfunc: () => controller.abort(new DOMException(browserName === \"chromium\" ? \"signal timed out\" : \"The operation timed out.\", \"TimeoutError\"))\n\t\t\t});\n\t\t\treturn controller.signal;\n\t\t} });\n\t\treturn abortSignal;\n\t}\n\tfunction createClock(globalObject, config = {}) {\n\t\tconst originals = platformOriginals(globalObject);\n\t\tconst clock = new ClockController({\n\t\t\tdateNow: () => originals.raw.Date.now(),\n\t\t\tperformanceNow: () => Math.ceil(originals.raw.performance.now()),\n\t\t\tsetTimeout: (task, timeout) => {\n\t\t\t\tconst timerId = originals.bound.setTimeout(task, timeout);\n\t\t\t\treturn () => originals.bound.clearTimeout(timerId);\n\t\t\t},\n\t\t\tsetInterval: (task, delay) => {\n\t\t\t\tconst intervalId = originals.bound.setInterval(task, delay);\n\t\t\t\treturn () => originals.bound.clearInterval(intervalId);\n\t\t\t}\n\t\t});\n\t\treturn {\n\t\t\tclock,\n\t\t\tapi: createApi(clock, originals.bound, config.browserName),\n\t\t\toriginals: originals.raw\n\t\t};\n\t}\n\tfunction install(globalObject, config = {}) {\n\t\tif (globalObject.Date?.isFake) throw new TypeError(`Can't install fake timers twice on the same global object.`);\n\t\tconst { clock, api, originals } = createClock(globalObject, config);\n\t\tconst toFake = config.toFake?.length ? config.toFake : Object.keys(originals);\n\t\tfor (const method of toFake) {\n\t\t\tif (method === \"Date\") globalObject.Date = mirrorDateProperties(api.Date, globalObject.Date);\n\t\t\telse if (method === \"Intl\") globalObject.Intl = api[method];\n\t\t\telse if (method === \"AbortSignal\") globalObject.AbortSignal = api[method];\n\t\t\telse if (method === \"performance\") {\n\t\t\t\tglobalObject.performance = api[method];\n\t\t\t\tconst kEventTimeStamp = Symbol(\"playwrightEventTimeStamp\");\n\t\t\t\tObject.defineProperty(Event.prototype, \"timeStamp\", { get() {\n\t\t\t\t\tif (!this[kEventTimeStamp]) this[kEventTimeStamp] = api.performance?.now();\n\t\t\t\t\treturn this[kEventTimeStamp];\n\t\t\t\t} });\n\t\t\t} else globalObject[method] = (...args) => {\n\t\t\t\treturn api[method].apply(api, args);\n\t\t\t};\n\t\t\tclock.disposables.push(() => {\n\t\t\t\tglobalObject[method] = originals[method];\n\t\t\t});\n\t\t}\n\t\treturn {\n\t\t\tclock,\n\t\t\tapi,\n\t\t\toriginals\n\t\t};\n\t}\n\tfunction inject(globalObject, browserName) {\n\t\tconst builtins = platformOriginals(globalObject).bound;\n\t\tconst { clock: controller } = install(globalObject, { browserName });\n\t\tcontroller.resume();\n\t\treturn {\n\t\t\tcontroller,\n\t\t\tbuiltins\n\t\t};\n\t}\n\tfunction asWallTime(n) {\n\t\treturn n;\n\t}\n\tfunction shiftTicks(ticks, ms) {\n\t\treturn ticks + ms;\n\t}\n\t//#endregion\n\t//#region ../../../../private/var/folders/ch/vhk5lrl50js1y5n25sd7sbh00000gn/T/roxybrowser-playwright-clock-source-ZlgLh6/clock.entry.ts\n\tglobalThis.__roxyPlaywrightClockBundle = { inject };\n\t//#endregion\n\texports.inject = inject;\n\treturn exports;\n})({});\n";
|
|
9
|
+
//# sourceMappingURL=clockSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clockSource.js","sourceRoot":"","sources":["../../../../src/vendor/playwright/generated/clockSource.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,yspBAAyspB,CAAC"}
|