buninu-browser 0.0.2
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.md +13 -0
- package/Architecture.md +601 -0
- package/LICENSE +21 -0
- package/LICENSES/Apache-2.0.txt +202 -0
- package/LICENSES/BSD-3-Clause-Skia.txt +29 -0
- package/LICENSES/Bitstream-Vera.txt +44 -0
- package/LICENSES/CC-BY-4.0.txt +396 -0
- package/LICENSES/OFL-1.1.txt +91 -0
- package/LICENSES/README.md +9 -0
- package/LICENSES/acorn.txt +21 -0
- package/LICENSES/chromium.txt +27 -0
- package/LICENSES/dropflow.txt +19 -0
- package/LICENSES/emscripten.txt +102 -0
- package/LICENSES/freetype.txt +169 -0
- package/LICENSES/happy-dom.txt +22 -0
- package/LICENSES/harfbuzz.txt +42 -0
- package/LICENSES/icu.txt +512 -0
- package/LICENSES/libjpeg-ijg.txt +260 -0
- package/LICENSES/libjpeg-turbo.txt +147 -0
- package/LICENSES/libpng.txt +134 -0
- package/LICENSES/libwebp.txt +30 -0
- package/LICENSES/ses-aura.txt +16 -0
- package/LICENSES/ses-caja.txt +13 -0
- package/LICENSES/ses-corejs.txt +19 -0
- package/LICENSES/ses-v8.txt +9 -0
- package/LICENSES/ses.txt +201 -0
- package/LICENSES/termdom.txt +21 -0
- package/LICENSES/wasmpeg.txt +501 -0
- package/LICENSES/woff2.txt +19 -0
- package/LICENSES/wuffs.txt +211 -0
- package/LICENSES/zlib.txt +22 -0
- package/Linux +0 -0
- package/PORTING.md +825 -0
- package/README.md +283 -0
- package/THIRD_PARTY_NOTICES.md +224 -0
- package/bunfig.toml +2 -0
- package/buninu-browser.js +65 -0
- package/index.js +149 -0
- package/lib/cdp-server.js +1424 -0
- package/lib/cdp.js +203 -0
- package/lib/happy-dom/entities-adapter.js +51 -0
- package/lib/happy-dom/image-size-adapter.js +8 -0
- package/lib/happy-dom/mime-type-adapter.js +27 -0
- package/lib/happy-dom/parser.js +53 -0
- package/lib/happy-dom/websocket-adapter.js +62 -0
- package/lib/headless-shell.js +362 -0
- package/lib/input/hit-test.js +78 -0
- package/lib/layout/scroll-viewport.js +53 -0
- package/lib/layout/text-layout.js +2236 -0
- package/lib/log.js +85 -0
- package/lib/network/cookie-jar.js +178 -0
- package/lib/network/network-service.js +268 -0
- package/lib/network/resolver.js +97 -0
- package/lib/paint/display-list.js +359 -0
- package/lib/paint/frame.js +88 -0
- package/lib/paint/gradient.js +207 -0
- package/lib/render-tree/index.js +263 -0
- package/lib/render-tree/svg.js +210 -0
- package/lib/renderer/bindings.js +1291 -0
- package/lib/renderer/compositor.js +123 -0
- package/lib/renderer/flags.js +20 -0
- package/lib/renderer/host.js +503 -0
- package/lib/renderer/main.js +234 -0
- package/lib/renderer/module-transform.js +399 -0
- package/lib/renderer/page-realm.js +1471 -0
- package/lib/renderer/page-renderer.js +1691 -0
- package/lib/renderer/script-rewrite.js +232 -0
- package/lib/renderer/seccomp.js +215 -0
- package/lib/renderer/syscall-numbers.js +139 -0
- package/lib/style/computed-style.js +2053 -0
- package/package.json +39 -0
- package/patches/happy-dom/0001-use-bun-entity-adapter.patch +15 -0
- package/patches/happy-dom/0002-use-bun-platform-adapters.patch +69 -0
- package/patches/happy-dom/README.md +38 -0
- package/test/chromium-headless-shell +5 -0
- package/test/compositor.test.js +154 -0
- package/test/computed-style.test.js +434 -0
- package/test/display-list.test.js +128 -0
- package/test/entities-adapter.test.js +43 -0
- package/test/fixtures/fake-renderer.js +26 -0
- package/test/fixtures/seccomp-child.js +32 -0
- package/test/fixtures/video.mp4 +0 -0
- package/test/flex.test.js +150 -0
- package/test/gradient.test.js +56 -0
- package/test/grid.test.js +253 -0
- package/test/happy-dom-platform-adapters.test.js +18 -0
- package/test/headless-shell.test.js +318 -0
- package/test/hit-test.test.js +49 -0
- package/test/html-parser.test.js +40 -0
- package/test/index.test.js +29 -0
- package/test/log.test.js +40 -0
- package/test/mobile.test.js +85 -0
- package/test/network-service.test.js +214 -0
- package/test/page-scripts.test.js +552 -0
- package/test/poc-backend.js +189 -0
- package/test/poc-backend.test.js +154 -0
- package/test/positioning.test.js +112 -0
- package/test/render-tree.test.js +103 -0
- package/test/renderer-host.test.js +69 -0
- package/test/resolver.test.js +51 -0
- package/test/script-rewrite.test.js +31 -0
- package/test/scroll-viewport.test.js +25 -0
- package/test/seccomp.test.js +71 -0
- package/test/site-isolation.test.js +74 -0
- package/test/svg.test.js +61 -0
- package/test/text-layout.test.js +419 -0
- package/usr/README.md +20 -0
- package/usr/lib/canvaskit/LICENSE +29 -0
- package/usr/lib/canvaskit/canvaskit.js +264 -0
- package/usr/lib/canvaskit/canvaskit.wasm +0 -0
- package/usr/share/fonts/DejaVuSansMono-Bold.ttf +0 -0
- package/usr/share/fonts/DejaVuSansMono.ttf +0 -0
- package/usr/share/fonts/LICENSE-Apache-2.0.txt +202 -0
- package/usr/share/fonts/LICENSE-DejaVu.txt +44 -0
- package/usr/share/fonts/LICENSE-OFL-1.1.txt +91 -0
- package/usr/share/fonts/NotoColorEmoji.ttf +0 -0
- package/usr/share/fonts/NotoColorEmojiFlags.ttf +0 -0
- package/usr/share/fonts/NotoSansCJK-Regular.ttc +0 -0
- package/usr/share/fonts/NotoSansSymbols-Regular-Subsetted.ttf +0 -0
- package/usr/share/fonts/NotoSansSymbols-Regular-Subsetted2.ttf +0 -0
- package/usr/share/fonts/Roboto-Regular.ttf +0 -0
- package/usr/share/fonts/fonts.json +28 -0
- package/vendor/acorn/LICENSE +21 -0
- package/vendor/acorn/README.md +309 -0
- package/vendor/acorn/dist/acorn.mjs +6313 -0
- package/vendor/acorn/package.json +50 -0
- package/vendor/happy-dom/.editorconfig +8 -0
- package/vendor/happy-dom/.eslintignore +6 -0
- package/vendor/happy-dom/.eslintrc.cjs +188 -0
- package/vendor/happy-dom/.github/CODEOWNERS +2 -0
- package/vendor/happy-dom/.github/FUNDING.yml +1 -0
- package/vendor/happy-dom/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
- package/vendor/happy-dom/.github/ISSUE_TEMPLATE/custom.md +10 -0
- package/vendor/happy-dom/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- package/vendor/happy-dom/.github/PULL_REQUEST_TEMPLATE.md +27 -0
- package/vendor/happy-dom/.github/workflows/auto-assign.yml +23 -0
- package/vendor/happy-dom/.github/workflows/pull_request.yml +53 -0
- package/vendor/happy-dom/.github/workflows/release.yml +143 -0
- package/vendor/happy-dom/.husky/pre-commit +1 -0
- package/vendor/happy-dom/.prettierignore +1 -0
- package/vendor/happy-dom/.prettierrc.cjs +6 -0
- package/vendor/happy-dom/.vscode/extensions.json +3 -0
- package/vendor/happy-dom/CODE_OF_CONDUCT.md +128 -0
- package/vendor/happy-dom/CONTRIBUTING.md +147 -0
- package/vendor/happy-dom/LICENSE +21 -0
- package/vendor/happy-dom/README.md +62 -0
- package/vendor/happy-dom/SECURITY.md +12 -0
- package/vendor/happy-dom/cspell.json +34 -0
- package/vendor/happy-dom/docs/happy-dom-logo.jpg +0 -0
- package/vendor/happy-dom/integration-test/.editorconfig +8 -0
- package/vendor/happy-dom/integration-test/LICENSE +21 -0
- package/vendor/happy-dom/integration-test/README.md +1 -0
- package/vendor/happy-dom/integration-test/package.json +24 -0
- package/vendor/happy-dom/package-lock.json +15520 -0
- package/vendor/happy-dom/package.json +55 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/LICENSE +21 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/README.md +60 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/package.json +52 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/register.js +2 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/src/GlobalRegistrator.ts +121 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/src/index.ts +3 -0
- package/vendor/happy-dom/packages/@happy-dom/global-registrator/tsconfig.json +30 -0
- package/vendor/happy-dom/packages/@happy-dom/jest-environment/LICENSE +21 -0
- package/vendor/happy-dom/packages/@happy-dom/jest-environment/README.md +71 -0
- package/vendor/happy-dom/packages/@happy-dom/jest-environment/package.json +93 -0
- package/vendor/happy-dom/packages/@happy-dom/jest-environment/src/index.ts +192 -0
- package/vendor/happy-dom/packages/@happy-dom/jest-environment/tsconfig.json +30 -0
- package/vendor/happy-dom/packages/@happy-dom/node-canvas-adapter/README.md +48 -0
- package/vendor/happy-dom/packages/@happy-dom/node-canvas-adapter/package.json +41 -0
- package/vendor/happy-dom/packages/@happy-dom/node-canvas-adapter/src/CanvasAdapter.ts +275 -0
- package/vendor/happy-dom/packages/@happy-dom/node-canvas-adapter/src/index.ts +1 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/LICENSE +21 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/README.md +100 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/bin/src/happy-dom-sr.ts +30 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/package.json +62 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRenderer.ts +368 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRendererBrowser.ts +142 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRendererBrowserWorker.ts +29 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRendererPage.ts +305 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRendererPageWorker.ts +55 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/ServerRendererServer.ts +332 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/config/DefaultServerRendererConfiguration.ts +47 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/enums/ServerRendererLogLevelEnum.ts +9 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/enums/ServerRendererModeEnum.ts +8 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/index.ts +19 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/types/IOptionalServerRendererConfiguration.ts +127 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/types/IServerRendererConfiguration.ts +126 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/types/IServerRendererItem.ts +6 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/types/IServerRendererResult.ts +11 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/BrowserWindowPolyfill.ts +138 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/HelpPrinter.ts +36 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/HelpPrinterRows.ts +288 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/PackageVersion.ts +12 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/ProcessArgumentsParser.ts +387 -0
- package/vendor/happy-dom/packages/@happy-dom/server-renderer/src/utilities/ServerRendererConfigurationFactory.ts +91 -0
- package/vendor/happy-dom/packages/happy-dom/LICENSE +21 -0
- package/vendor/happy-dom/packages/happy-dom/README.md +42 -0
- package/vendor/happy-dom/packages/happy-dom/package.json +58 -0
- package/vendor/happy-dom/packages/happy-dom/src/PropertySymbol.ts +431 -0
- package/vendor/happy-dom/packages/happy-dom/src/animation/Animation.ts +273 -0
- package/vendor/happy-dom/packages/happy-dom/src/animation/AnimationTimeline.ts +15 -0
- package/vendor/happy-dom/packages/happy-dom/src/animation/DocumentTimeline.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/animation/KeyframeEffect.ts +295 -0
- package/vendor/happy-dom/packages/happy-dom/src/async-task-manager/AsyncTaskManager.ts +340 -0
- package/vendor/happy-dom/packages/happy-dom/src/async-task-manager/AsyncTaskManagerDebugError.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/base64/Base64.ts +97 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/Browser.ts +123 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/BrowserContext.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/BrowserFrame.ts +232 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/BrowserPage.ts +205 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/BrowserSettingsFactory.ts +96 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/DefaultBrowserSettings.ts +67 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/detached-browser/DetachedBrowser.ts +129 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/detached-browser/DetachedBrowserContext.ts +103 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/detached-browser/DetachedBrowserFrame.ts +250 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/detached-browser/DetachedBrowserPage.ts +218 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/enums/BrowserErrorCaptureEnum.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/enums/BrowserNavigationCrossOriginPolicyEnum.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowser.ts +51 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowserContext.ts +44 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowserFrame.ts +112 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowserPage.ts +110 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowserPageViewport.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IBrowserSettings.ts +194 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IGoToOptions.ts +17 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IOptionalBrowserPageViewport.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IOptionalBrowserSettings.ts +190 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/types/IReloadOptions.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserExceptionObserver.ts +123 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserFrameFactory.ts +106 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserFrameNavigator.ts +574 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserFrameScriptEvaluator.ts +71 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserFrameURL.ts +30 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserFrameValidator.ts +84 -0
- package/vendor/happy-dom/packages/happy-dom/src/browser/utilities/BrowserPageUtility.ts +56 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasAdapter.ts +63 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasAdapterCaller.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasGradient.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasPattern.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasRenderingContext2D.ts +162 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ICanvasShape.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/IImageBitmapOptions.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ITextMetrics.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ImageBitmap.ts +162 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/ImageData.ts +83 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/OffscreenCanvas.ts +162 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/TCanvasImage.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/canvas/TImageBitmapSource.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/clipboard/Clipboard.ts +108 -0
- package/vendor/happy-dom/packages/happy-dom/src/clipboard/ClipboardItem.ts +57 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/HTMLElementConfig.ts +536 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/HTMLElementConfigContentModelEnum.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/IHTMLElementTagNameMap.ts +181 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/ISVGElementTagNameMap.ts +127 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/NamespaceURI.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/config/SVGElementConfig.ts +70 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/IConsole.ts +161 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/IVirtualConsoleLogEntry.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/IVirtualConsoleLogGroup.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/IVirtualConsolePrinter.ts +58 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/VirtualConsole.ts +363 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/VirtualConsolePrinter.ts +148 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/enums/VirtualConsoleLogLevelEnum.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/enums/VirtualConsoleLogTypeEnum.ts +29 -0
- package/vendor/happy-dom/packages/happy-dom/src/console/utilities/VirtualConsoleLogEntryStringifier.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/CookieContainer.ts +91 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/DefaultCookie.ts +17 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/ICookie.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/ICookieContainer.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/IOptionalCookie.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/enums/CookieSameSiteEnum.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/urilities/CookieExpireUtility.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/urilities/CookieStringUtility.ts +119 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie/urilities/CookieURLUtility.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie-store/CookieStore.ts +226 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie-store/ICookieStoreDeleteOptions.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie-store/ICookieStoreGetOptions.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie-store/ICookieStoreItem.ts +13 -0
- package/vendor/happy-dom/packages/happy-dom/src/cookie-store/ICookieStoreSetOptions.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSS.ts +63 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSSRule.ts +84 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSSRuleTypeEnum.ts +18 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSSStyleSheet.ts +141 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSSUnitValue.ts +26 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/CSSUnits.ts +31 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/MediaList.ts +177 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/CSSPropertyList.ts +1273 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/CSSStyleDeclaration.ts +355 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/ICSSStyleDeclaration.ts +1178 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/computed-style/CSSComputedStyle.ts +502 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/computed-style/config/CSSComputedStyleElementDefault.ts +133 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/computed-style/config/CSSComputedStyleInheritedProperties.ts +39 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/computed-style/config/CSSComputedStyleMeasurementProperties.ts +41 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/CSSPropertyManager.ts +641 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/parsers/CSSPropertyGetParser.ts +741 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/parsers/CSSPropertySetParser.ts +2955 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/types/ICSSPropertyMap.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/types/ICSSPropertyValue.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/utilities/CSSStringUtility.ts +90 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/utilities/CSSValueFormatter.ts +447 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/property-manager/utilities/CSSVariableFormatter.ts +76 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/utilities/CSSMeasurementConverter.ts +79 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/declaration/utilities/CSSTextParser.ts +44 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSConditionRule.ts +20 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSContainerRule.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSFontFaceRule.ts +45 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSGroupingRule.ts +84 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSKeyframeRule.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSKeyframesRule.ts +147 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSMediaRule.ts +50 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSScopeRule.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSStyleRule.ts +73 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/rules/CSSSupportsRule.ts +30 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/style-property-map/CSSKeywordValue.ts +35 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/style-property-map/CSSStyleValue.ts +37 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/style-property-map/StylePropertyMap.ts +45 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/style-property-map/StylePropertyMapReadOnly.ts +128 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/utilities/CSSEscaper.ts +87 -0
- package/vendor/happy-dom/packages/happy-dom/src/css/utilities/CSSRuleParser.ts +315 -0
- package/vendor/happy-dom/packages/happy-dom/src/custom-element/CustomElementReactionStack.ts +91 -0
- package/vendor/happy-dom/packages/happy-dom/src/custom-element/CustomElementRegistry.ts +186 -0
- package/vendor/happy-dom/packages/happy-dom/src/custom-element/CustomElementUtility.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/custom-element/ICustomElementDefinition.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMPoint.ts +84 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMPointReadOnly.ts +117 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMRect.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMRectList.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMRectReadOnly.ts +129 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMStringMap.ts +93 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMStringMapUtility.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/DOMTokenList.ts +363 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/IDOMPointInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/IDOMRectInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/DOMMatrix.ts +526 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/DOMMatrixReadOnly.ts +1608 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/IDOMMatrixCompatibleObject.ts +24 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/IDOMMatrixJSON.ts +26 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/TDOMMatrix2DArray.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/TDOMMatrix3DArray.ts +20 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom/dom-matrix/TDOMMatrixInit.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom-implementation/DOMImplementation.ts +81 -0
- package/vendor/happy-dom/packages/happy-dom/src/dom-parser/DOMParser.ts +47 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/DataTransfer.ts +128 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/DataTransferItem.ts +47 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/DataTransferItemList.ts +44 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/Event.ts +222 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/EventPhaseEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/EventTarget.ts +396 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/IEventInit.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/IEventListenerOptions.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/ITouchInit.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/IUIEventInit.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/MessagePort.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/TEventListener.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/TEventListenerFunction.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/TEventListenerObject.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/Touch.ts +40 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/UIEvent.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/AnimationEvent.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ClipboardEvent.ts +22 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/CloseEvent.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/CookieChangeEvent.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/CustomEvent.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ErrorEvent.ts +29 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/FocusEvent.ts +22 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/HashChangeEvent.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IAnimationEventInit.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IClipboardEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ICloseEventInit.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ICookieChangeEventInit.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ICustomEventInit.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IErrorEventInit.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IFocusEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IHashChangeEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IInputEventInit.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IKeyboardEventInit.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IMediaQueryListEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IMediaQueryListInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IMessageEventInit.ts +11 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IMouseEventInit.ts +21 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IPointerEventInit.ts +19 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IPopStateEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IProgressEventInit.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IStorageEventInit.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ISubmitEventInit.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ITouchEventInit.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/IWheelEventInit.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/InputEvent.ts +28 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/KeyboardEvent.ts +80 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/MediaQueryListEvent.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/MediaStreamTrackEvent.ts +22 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/MessageEvent.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/MouseEvent.ts +52 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/PointerEvent.ts +51 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/PopStateEvent.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/ProgressEvent.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/StorageEvent.ts +30 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/SubmitEvent.ts +22 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/TouchEvent.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/event/events/WheelEvent.ts +30 -0
- package/vendor/happy-dom/packages/happy-dom/src/exception/DOMException.ts +21 -0
- package/vendor/happy-dom/packages/happy-dom/src/exception/DOMExceptionNameEnum.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/AbortController.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/AbortSignal.ts +182 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/Fetch.ts +1072 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/Headers.ts +177 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/ReadableStreamWrapper.ts +30 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/Request.ts +492 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/ResourceFetch.ts +190 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/Response.ts +439 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/SyncFetch.ts +717 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/preflight/ICacheablePreflightRequest.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/preflight/ICacheablePreflightResponse.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/preflight/ICachedPreflightResponse.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/preflight/IPreflightResponseCache.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/preflight/PreflightResponseCache.ts +94 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/CachedResponseStateEnum.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/ICacheableRequest.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/ICacheableResponse.ts +11 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/ICachedResponse.ts +40 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/IResponseCache.ts +37 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/IResponseCacheFileSystem.ts +18 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/ResponseCache.ts +248 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/cache/response/ResponseCacheFileSystem.ts +175 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/certificate/FetchHTTPSCertificate.ts +52 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/data-uri/DataURIParser.ts +66 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/multipart/MultipartFormDataParser.ts +174 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/multipart/MultipartReader.ts +216 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/preload/PreloadEntry.ts +50 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/preload/PreloadUtility.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IFetchInterceptor.ts +60 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IFetchRequestHeaders.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IRequestInit.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IResourceFetchResponse.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IResponseInit.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/ISyncResponse.ts +18 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/IVirtualServer.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/THeadersInit.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestBody.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestCredentials.ts +1 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestInfo.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestMode.ts +1 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestRedirect.ts +1 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TRequestReferrerPolicy.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/types/TResponseBody.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchBodyUtility.ts +284 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchCORSUtility.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchRequestHeaderUtility.ts +141 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchRequestReferrerUtility.ts +259 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchRequestValidationUtility.ts +128 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchResponseHeaderUtility.ts +48 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/FetchResponseRedirectUtility.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/SyncFetchScriptBuilder.ts +77 -0
- package/vendor/happy-dom/packages/happy-dom/src/fetch/utilities/VirtualServerUtility.ts +114 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/Blob.ts +163 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/File.ts +43 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/FileReader.ts +211 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/FileReaderEventTypeEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/FileReaderFormatEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/file/FileReaderReadyStateEnum.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/form-data/FormData.ts +291 -0
- package/vendor/happy-dom/packages/happy-dom/src/history/History.ts +220 -0
- package/vendor/happy-dom/packages/happy-dom/src/history/HistoryItemList.ts +72 -0
- package/vendor/happy-dom/packages/happy-dom/src/history/HistoryScrollRestorationEnum.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/history/IHistoryItem.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/html-parser/HTMLParser.ts +920 -0
- package/vendor/happy-dom/packages/happy-dom/src/html-serializer/HTMLSerializer.ts +172 -0
- package/vendor/happy-dom/packages/happy-dom/src/index.ts +495 -0
- package/vendor/happy-dom/packages/happy-dom/src/intersection-observer/IIntersectionObserverInit.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/intersection-observer/IntersectionObserver.ts +64 -0
- package/vendor/happy-dom/packages/happy-dom/src/intersection-observer/IntersectionObserverEntry.ts +26 -0
- package/vendor/happy-dom/packages/happy-dom/src/javascript/IJavaScriptCompiledResult.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/javascript/JavaScriptCompiler.ts +381 -0
- package/vendor/happy-dom/packages/happy-dom/src/location/Location.ts +319 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/IMediaQueryRange.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/IMediaQueryRule.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/MediaQueryItem.ts +354 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/MediaQueryList.ts +133 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/MediaQueryParser.ts +113 -0
- package/vendor/happy-dom/packages/happy-dom/src/match-media/MediaQueryTypeEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/CSSModule.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/ECMAScriptModule.ts +194 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/ECMAScriptModuleCompiler.ts +961 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/JSONModule.ts +58 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/ModuleFactory.ts +148 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/ModuleURLUtility.ts +199 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/UnresolvedModule.ts +81 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/enums/ECMAScriptModuleEvaluateStateEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IECMAScriptModuleCachedResult.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IECMAScriptModuleCompiledResult.ts +19 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IECMAScriptModuleImport.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IECMAScriptModuleInit.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IModule.ts +20 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IModuleImportMap.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IModuleImportMapRule.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IModuleImportMapScope.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IModuleInit.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/module/types/IResolveNodeModules.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/IMutationListener.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/IMutationObserverInit.ts +14 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/MutationObserver.ts +175 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/MutationObserverListener.ts +115 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/MutationRecord.ts +55 -0
- package/vendor/happy-dom/packages/happy-dom/src/mutation-observer/MutationTypeEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/navigator/MimeType.ts +35 -0
- package/vendor/happy-dom/packages/happy-dom/src/navigator/MimeTypeArray.ts +48 -0
- package/vendor/happy-dom/packages/happy-dom/src/navigator/Navigator.ts +247 -0
- package/vendor/happy-dom/packages/happy-dom/src/navigator/Plugin.ts +61 -0
- package/vendor/happy-dom/packages/happy-dom/src/navigator/PluginArray.ts +58 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/NodeFactory.ts +38 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/attr/Attr.ts +119 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/character-data/CharacterData.ts +218 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/character-data/CharacterDataUtility.ts +68 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/child-node/ChildNodeUtility.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/child-node/IChildNode.ts +29 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/child-node/INonDocumentTypeChildNode.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/child-node/NonDocumentChildNodeUtility.ts +37 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/comment/Comment.ts +36 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document/Document.ts +2310 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document/DocumentReadyStateEnum.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document/DocumentReadyStateManager.ts +52 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document/VisibilityStateEnum.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document-fragment/DocumentFragment.ts +208 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/document-type/DocumentType.ts +70 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/Element.ts +1842 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/ElementEventAttributeUtility.ts +96 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/HTMLCollection.ts +228 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/NamedNodeMap.ts +274 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/NamedNodeMapProxyFactory.ts +127 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/THTMLCollectionListener.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/element/TNamedNodeMapListener.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-anchor-element/HTMLAnchorElement.ts +439 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-area-element/HTMLAreaElement.ts +426 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-audio-element/Audio.ts +28 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-audio-element/HTMLAudioElement.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-base-element/HTMLBaseElement.ts +64 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-body-element/HTMLBodyElement.ts +161 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-br-element/HTMLBRElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-button-element/HTMLButtonElement.ts +406 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-canvas-element/CanvasCaptureMediaStreamTrack.ts +51 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-canvas-element/HTMLCanvasElement.ts +304 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-d-list-element/HTMLDListElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-data-element/HTMLDataElement.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-data-list-element/HTMLDataListElement.ts +28 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-details-element/HTMLDetailsElement.ts +112 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-dialog-element/HTMLDialogElement.ts +104 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-div-element/HTMLDivElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-document/HTMLDocument.ts +82 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-element/HTMLElement.ts +1149 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-element/HTMLElementUtility.ts +119 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-embed-element/HTMLEmbedElement.ts +90 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-field-set-element/HTMLFieldSetElement.ts +165 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-form-element/HTMLFormControlsCollection.ts +35 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-form-element/HTMLFormElement.ts +675 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-form-element/RadioNodeList.ts +25 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-form-element/THTMLFormControlElement.ts +16 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-head-element/HTMLHeadElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-heading-element/HTMLHeadingElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-hr-element/HTMLHRElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-html-element/HTMLHtmlElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-hyperlink-element/HTMLHyperlinkElementUtility.ts +329 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-hyperlink-element/IHTMLHyperlinkElement.ts +19 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-iframe-element/HTMLIFrameElement.ts +460 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-image-element/HTMLImageElement.ts +500 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-image-element/Image.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/FileList.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts +1550 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElementDateUtility.ts +50 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElementSelectionDirectionEnum.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElementSelectionModeEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElementValueSanitizer.ts +211 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-input-element/HTMLInputElementValueStepping.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-label-element/HTMLLabelElement.ts +128 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-label-element/HTMLLabelElementUtility.ts +45 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-legend-element/HTMLLegendElement.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-li-element/HTMLLIElement.ts +31 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-link-element/HTMLLinkElement.ts +501 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-map-element/HTMLMapElement.ts +47 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/HTMLMediaElement.ts +906 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/IMediaTrackCapabilities.ts +21 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/IMediaTrackSettings.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/MediaStream.ts +114 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/MediaStreamTrack.ts +182 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/RemotePlayback.ts +47 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TextTrack.ts +156 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TextTrackCue.ts +51 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TextTrackCueList.ts +37 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TextTrackKindEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TextTrackList.ts +182 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/TimeRanges.ts +73 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/VTTCue.ts +80 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-media-element/VTTRegion.ts +15 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-menu-element/HTMLMenuElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-meta-element/HTMLMetaElement.ts +80 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-meter-element/HTMLMeterElement.ts +216 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-mod-element/HTMLModElement.ts +54 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-o-list-element/HTMLOListElement.ts +83 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-object-element/HTMLObjectElement.ts +223 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-opt-group-element/HTMLOptGroupElement.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-option-element/HTMLOptionElement.ts +192 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-output-element/HTMLOutputElement.ts +179 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-paragraph-element/HTMLParagraphElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-param-element/HTMLParamElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-picture-element/HTMLPictureElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-pre-element/HTMLPreElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-progress-element/HTMLProgressElement.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-quote-element/HTMLQuoteElement.ts +36 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-script-element/HTMLScriptElement.ts +735 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-select-element/HTMLOptionsCollection.ts +69 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-select-element/HTMLSelectElement.ts +779 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-slot-element/HTMLSlotElement.ts +249 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-source-element/HTMLSourceElement.ts +148 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-span-element/HTMLSpanElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-style-element/HTMLStyleElement.ts +125 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-caption-element/HTMLTableCaptionElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-cell-element/HTMLTableCellElement.ts +125 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-col-element/HTMLTableColElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-element/HTMLTableElement.ts +343 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-row-element/HTMLTableRowElement.ts +149 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-table-section-element/HTMLTableSectionElement.ts +88 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-template-element/HTMLTemplateElement.ts +154 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-text-area-element/HTMLTextAreaElement.ts +649 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-time-element/HTMLTimeElement.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-title-element/HTMLTitleElement.ts +48 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-track-element/HTMLTrackElement.ts +164 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-u-list-element/HTMLUListElement.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-unknown-element/HTMLUnknownElement.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/html-video-element/HTMLVideoElement.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedComputedStyleResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedElementByIdResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedElementByTagNameResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedElementsByTagNameResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedMatchesResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedQuerySelectorAllResult.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedQuerySelectorResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedResult.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/ICachedStyleResult.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/Node.ts +1373 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/NodeDocumentPositionEnum.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/NodeList.ts +224 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/NodeTypeEnum.ts +13 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/NodeUtility.ts +330 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/node/TNodeListListener.ts +1 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/parent-node/IParentNode.ts +109 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/parent-node/ParentNodeUtility.ts +334 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/processing-instruction/ProcessingInstruction.ts +22 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/shadow-root/ShadowRoot.ts +290 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-animate-element/SVGAnimateElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-animate-motion-element/SVGAnimateMotionElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-animate-transform-element/SVGAnimateTransformElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-animation-element/SVGAnimationElement.ts +94 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-circle-element/SVGCircleElement.ts +72 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-clip-path-element/SVGClipPathElement.ts +34 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-component-transfer-function-element/SVGComponentTransferFunctionElement.ts +167 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-defs-element/SVGDefsElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-desc-element/SVGDescElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-element/SVGElement.ts +828 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-ellipse-element/SVGEllipseElement.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-blend-element/SVGFEBlendElement.ts +192 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-color-matrix-element/SVGFEColorMatrixElement.ts +204 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-component-transfer-element/SVGFEComponentTransferElement.ts +133 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-composite-element/SVGFECompositeElement.ts +186 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-convolve-matrix-element/SVGFEConvolveMatrixElement.ts +366 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-diffuse-lighting-element/SVGFEDiffuseLightingElement.ts +214 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-displacement-map-element/SVGFEDisplacementMapElement.ts +226 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-distant-light-element/SVGFEDistantLightElement.ts +52 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-drop-shadow-element/SVGFEDropShadowElement.ts +227 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-flood-element/SVGFEFloodElement.ts +113 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-func-a-element/SVGFEFuncAElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-func-b-element/SVGFEFuncBElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-func-g-element/SVGFEFuncGElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-func-r-element/SVGFEFuncRElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-gaussian-blur-element/SVGFEGaussianBlurElement.ts +214 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-image-element/SVGFEImageElement.ts +173 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-merge-element/SVGFEMergeElement.ts +113 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-merge-node-element/SVGFEMergeNodeElement.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-morphology-element/SVGFEMorphologyElement.ts +202 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-offset-element/SVGFEOffsetElement.ts +174 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-point-light-element/SVGFEPointLightElement.ts +72 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-specular-lighting-element/SVGFESpecularLightingElement.ts +237 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-spot-light-element/SVGFESpotLightElement.ts +173 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-tile-element/SVGFETileElement.ts +133 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-fe-turbulence-element/SVGFETurbulenceElement.ts +249 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-filter-element/SVGFilterElement.ts +158 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-foreign-object-element/SVGForeignObjectElement.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-g-element/SVGGElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-geometry-element/SVGGeometryElement.ts +94 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-gradient-element/SVGGradientElement.ts +104 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-graphics-element/SVGGraphicsElement.ts +134 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-image-element/SVGImageElement.ts +188 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-line-element/SVGLineElement.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-linear-gradient-element/SVGLinearGradientElement.ts +92 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-m-path-element/SVGMPathElement.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-marker-element/SVGMarkerElement.ts +230 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-mask-element/SVGMaskElement.ts +137 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-metadata-element/SVGMetadataElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-path-element/SVGPathElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-pattern-element/SVGPatternElement.ts +179 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-polygon-element/SVGPolygonElement.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-polyline-element/SVGPolylineElement.ts +53 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-radial-gradient-element/SVGRadialGradientElement.ts +112 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-rect-element/SVGRectElement.ts +132 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-script-element/SVGScriptElement.ts +50 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-set-element/SVGSetElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-stop-element/SVGStopElement.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-style-element/SVGStyleElement.ts +143 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-svg-element/SVGSVGElement.ts +601 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-switch-element/SVGSwitchElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-symbol-element/SVGSymbolElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-t-span-element/SVGTSpanElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-text-content-element/SVGTextContentElement.ts +143 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-text-element/SVGTextElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-text-path-element/SVGTextPathElement.ts +106 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-text-positioning-element/SVGTextPositioningElement.ts +113 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-title-element/SVGTitleElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-use-element/SVGUseElement.ts +113 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/svg-view-element/SVGViewElement.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/text/Text.ts +154 -0
- package/vendor/happy-dom/packages/happy-dom/src/nodes/xml-document/XMLDocument.ts +10 -0
- package/vendor/happy-dom/packages/happy-dom/src/permissions/PermissionNameEnum.ts +32 -0
- package/vendor/happy-dom/packages/happy-dom/src/permissions/PermissionStatus.ts +23 -0
- package/vendor/happy-dom/packages/happy-dom/src/permissions/Permissions.ts +59 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/ISelectorAttribute.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/ISelectorMatch.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/ISelectorPseudo.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/QuerySelector.ts +849 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/SelectorCombinatorEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/SelectorItem.ts +575 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/SelectorParser.ts +699 -0
- package/vendor/happy-dom/packages/happy-dom/src/query-selector/TGlobalMatchFunction.ts +12 -0
- package/vendor/happy-dom/packages/happy-dom/src/range/IRangeBoundaryPoint.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/range/Range.ts +1161 -0
- package/vendor/happy-dom/packages/happy-dom/src/range/RangeHowEnum.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/range/RangeUtility.ts +118 -0
- package/vendor/happy-dom/packages/happy-dom/src/resize-observer/ResizeObserver.ts +33 -0
- package/vendor/happy-dom/packages/happy-dom/src/screen/Screen.ts +19 -0
- package/vendor/happy-dom/packages/happy-dom/src/screen/ScreenDetailed.ts +17 -0
- package/vendor/happy-dom/packages/happy-dom/src/screen/ScreenDetails.ts +27 -0
- package/vendor/happy-dom/packages/happy-dom/src/selection/Selection.ts +556 -0
- package/vendor/happy-dom/packages/happy-dom/src/selection/SelectionDirectionEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/storage/Storage.ts +149 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAngle.ts +310 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAngleTypeEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedAngle.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedBoolean.ts +80 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedEnumeration.ts +119 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedInteger.ts +97 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedLength.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedLengthList.ts +101 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedNumber.ts +101 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedNumberList.ts +101 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedPreserveAspectRatio.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedRect.ts +100 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedString.ts +83 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGAnimatedTransformList.ts +101 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGLength.ts +375 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGLengthList.ts +489 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGLengthTypeEnum.ts +15 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGMatrix.ts +429 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGNumber.ts +83 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGNumberList.ts +522 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGPoint.ts +114 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGPointList.ts +526 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGPreserveAspectRatio.ts +176 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGPreserveAspectRatioAlignEnum.ts +15 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGPreserveAspectRatioMeetOrSliceEnum.ts +7 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGRect.ts +200 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGStringList.ts +422 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGTransform.ts +369 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGTransformList.ts +531 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGTransformTypeEnum.ts +11 -0
- package/vendor/happy-dom/packages/happy-dom/src/svg/SVGUnitTypes.ts +26 -0
- package/vendor/happy-dom/packages/happy-dom/src/tree-walker/NodeFilter.ts +18 -0
- package/vendor/happy-dom/packages/happy-dom/src/tree-walker/NodeFilterMask.ts +28 -0
- package/vendor/happy-dom/packages/happy-dom/src/tree-walker/NodeIterator.ts +85 -0
- package/vendor/happy-dom/packages/happy-dom/src/tree-walker/TNodeFilter.ts +3 -0
- package/vendor/happy-dom/packages/happy-dom/src/tree-walker/TreeWalker.ts +339 -0
- package/vendor/happy-dom/packages/happy-dom/src/url/URL.ts +45 -0
- package/vendor/happy-dom/packages/happy-dom/src/utilities/AttributeUtility.ts +43 -0
- package/vendor/happy-dom/packages/happy-dom/src/utilities/ClassMethodBinder.ts +71 -0
- package/vendor/happy-dom/packages/happy-dom/src/utilities/StringUtility.ts +47 -0
- package/vendor/happy-dom/packages/happy-dom/src/utilities/XMLEncodeUtility.ts +166 -0
- package/vendor/happy-dom/packages/happy-dom/src/validity-state/ValidityState.ts +234 -0
- package/vendor/happy-dom/packages/happy-dom/src/version.ts +1 -0
- package/vendor/happy-dom/packages/happy-dom/src/web-socket/WebSocket.ts +408 -0
- package/vendor/happy-dom/packages/happy-dom/src/web-socket/WebSocketReadyStateEnum.ts +8 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/BrowserWindow.ts +3074 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/CrossOriginBrowserWindow.ts +152 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/DetachedWindowAPI.ts +133 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/GlobalWindow.ts +90 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/INodeJSGlobal.ts +76 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/IOptionalTimerLoopsLimit.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/IScrollToOptions.ts +5 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/ITimerLoopsLimit.ts +4 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/VMGlobalPropertyScript.ts +59 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/Window.ts +67 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/WindowBrowserContext.ts +117 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/WindowContextClassExtender.ts +288 -0
- package/vendor/happy-dom/packages/happy-dom/src/window/WindowPageOpenUtility.ts +200 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpRequest.ts +577 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpRequestEventTarget.ts +88 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpRequestReadyStateEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpRequestResponseDataParser.ts +70 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpRequestUpload.ts +6 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-http-request/XMLHttpResponseTypeEnum.ts +9 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-parser/XMLParser.ts +744 -0
- package/vendor/happy-dom/packages/happy-dom/src/xml-serializer/XMLSerializer.ts +280 -0
- package/vendor/happy-dom/turbo.json +52 -0
- package/vendor/ses/LICENSE +201 -0
- package/vendor/ses/LICENSE-aura +16 -0
- package/vendor/ses/LICENSE-caja +13 -0
- package/vendor/ses/LICENSE-corejs +19 -0
- package/vendor/ses/LICENSE-v8 +9 -0
- package/vendor/ses/README.md +968 -0
- package/vendor/ses/dist/ses.mjs +15219 -0
- package/vendor/ses/package.json +142 -0
- package/vendor/wasmpeg/LICENSE +501 -0
- package/vendor/wasmpeg/NOTICE +30 -0
- package/vendor/wasmpeg/VENDORING.md +35 -0
- package/vendor/wasmpeg/dist/cpu.js +2 -0
- package/vendor/wasmpeg/dist/cpu.wasm +0 -0
- package/vendor/wasmpeg/package.json +45 -0
- package/vendor/wasmpeg/source-v1.0.1.tar.gz +0 -0
- package/vendor/wasmpeg/src/js/exec.mjs +478 -0
- package/vendor/wasmpeg/src/js/ffmpeg.js +94 -0
- package/vendor/wasmpeg/src/js/formats.js +84 -0
- package/vendor/wasmpeg/src/js/gpu.js +480 -0
- package/vendor/wasmpeg/src/js/index.d.ts +154 -0
- package/vendor/wasmpeg/src/js/index.js +7 -0
- package/vendor/wasmpeg/src/js/wasmpeg.mjs +221 -0
|
@@ -0,0 +1,1424 @@
|
|
|
1
|
+
const CDP_DEFAULT_PORT = 9222;
|
|
2
|
+
const CDP_PROTOCOL_VERSION = "1.3";
|
|
3
|
+
const CDP_BROWSER_ID = "cdp-server";
|
|
4
|
+
const CDP_BROWSER_PATH = `/devtools/browser/${CDP_BROWSER_ID}`;
|
|
5
|
+
|
|
6
|
+
let serverLogEnabled = 0//true;
|
|
7
|
+
function serverLog(...args) {
|
|
8
|
+
if ( process.env.JSMDCUI_CDP_DEBUG ||
|
|
9
|
+
serverLogEnabled )
|
|
10
|
+
{
|
|
11
|
+
console.log(...args);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function serverError(...args) {
|
|
15
|
+
if ( process.env.JSMDCUI_CDP_DEBUG ||
|
|
16
|
+
serverLogEnabled )
|
|
17
|
+
{
|
|
18
|
+
console.error(...args);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class CdpServer {
|
|
23
|
+
#context;
|
|
24
|
+
|
|
25
|
+
constructor(context) {
|
|
26
|
+
this.#context = context;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static create(context) {
|
|
30
|
+
return new CdpServer(context);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
listen(port = CDP_DEFAULT_PORT, hostname = "127.0.0.1", options = {}) {
|
|
34
|
+
const context = this.#context;
|
|
35
|
+
const state = createCdpState();
|
|
36
|
+
state.context = context;
|
|
37
|
+
const remoteAllowOrigins = parseAllowedOrigins(options.remoteAllowOrigins);
|
|
38
|
+
// Pages change on their own (loading stages, scripts, compositor
|
|
39
|
+
// scrolling): push a screencast frame whenever the context reports one,
|
|
40
|
+
// and send lifecycle events when the document really reaches them.
|
|
41
|
+
context.onFrame?.(() => {
|
|
42
|
+
for (const target of state.targets.values()) {
|
|
43
|
+
if (target.screencast && target.screencastEmit) pushScreencastFrame(context, state, target);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
context.onLifecycle?.((name) => {
|
|
47
|
+
for (const target of state.targets.values()) emitLifecycle(target, name);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const server = Bun.serve({
|
|
51
|
+
port,
|
|
52
|
+
hostname,
|
|
53
|
+
fetch(req, server) {
|
|
54
|
+
const url = new URL(req.url);
|
|
55
|
+
const pathname = url.pathname.replace(/\/+$/, "") || "/";
|
|
56
|
+
|
|
57
|
+
const origin = req.headers.get("origin");
|
|
58
|
+
const respond = async (response) => {
|
|
59
|
+
const text = await response.clone().text();
|
|
60
|
+
serverLog(
|
|
61
|
+
`[CdpServer] HTTP ${req.method} ${pathname} -> ${response.status}`,
|
|
62
|
+
text,
|
|
63
|
+
);
|
|
64
|
+
return response;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
serverLog(`[CdpServer] HTTP ${req.method} ${pathname}`);
|
|
68
|
+
|
|
69
|
+
serverLog(`[CdpServer] Origin ${origin}`);
|
|
70
|
+
|
|
71
|
+
if (!isSafeHostHeader(req.headers.get("host"))) {
|
|
72
|
+
return respond(new Response("Host header must be an IP address or localhost", {
|
|
73
|
+
status: 500,
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (req.headers.get("upgrade")?.toLowerCase() === "websocket") {
|
|
78
|
+
if (!isOriginAllowed(origin, remoteAllowOrigins)) {
|
|
79
|
+
return respond(new Response(
|
|
80
|
+
`Rejected an incoming WebSocket connection from the ${origin} origin. `
|
|
81
|
+
+ `Use --remote-allow-origins=${origin} to allow it, or `
|
|
82
|
+
+ "--remote-allow-origins=* to allow all origins.",
|
|
83
|
+
{ status: 403 },
|
|
84
|
+
));
|
|
85
|
+
}
|
|
86
|
+
const pageMatch = pathname.match(/^\/devtools\/page\/([^/]+)$/);
|
|
87
|
+
if (pathname !== CDP_BROWSER_PATH && !pageMatch) {
|
|
88
|
+
return respond(new Response("Not Found", { status: 404 }));
|
|
89
|
+
}
|
|
90
|
+
if (pageMatch && !state.targets.has(pageMatch[1])) {
|
|
91
|
+
return respond(new Response("No such target", { status: 404 }));
|
|
92
|
+
}
|
|
93
|
+
if (server.upgrade(req, {
|
|
94
|
+
data: {
|
|
95
|
+
targetId: pageMatch?.[1] ?? null,
|
|
96
|
+
},
|
|
97
|
+
})) {
|
|
98
|
+
serverLog(
|
|
99
|
+
`[CdpServer] HTTP ${req.method} ${pathname} -> 101`,
|
|
100
|
+
"Switching Protocols",
|
|
101
|
+
);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
return respond(new Response("WebSocket upgrade failed", { status: 500 }));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const host = req.headers.get("host") ?? `127.0.0.1:${port}`;
|
|
108
|
+
const webSocketDebuggerUrl = `ws://${host}/devtools/browser/${CDP_BROWSER_ID}`;
|
|
109
|
+
|
|
110
|
+
if (pathname === "/json/new") {
|
|
111
|
+
// PUT only, as in Chromium: a page can make its browser send a GET
|
|
112
|
+
// (an <img>, a no-cors fetch) and would open targets at will.
|
|
113
|
+
if (req.method !== "PUT") {
|
|
114
|
+
return respond(new Response(
|
|
115
|
+
`Using unsafe HTTP verb ${req.method} to invoke /json/new. This action supports only PUT verb.`,
|
|
116
|
+
{ status: 405 },
|
|
117
|
+
));
|
|
118
|
+
}
|
|
119
|
+
const target = createTarget(state, url.search.slice(1) || "about:blank");
|
|
120
|
+
return respond(jsonResponse(createHttpTarget(target, host)));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (pathname === "/json/version") {
|
|
124
|
+
return respond(jsonResponse({
|
|
125
|
+
Browser: "CdpServer/1.0",
|
|
126
|
+
"Protocol-Version": CDP_PROTOCOL_VERSION,
|
|
127
|
+
"User-Agent": "CdpServer/1.0",
|
|
128
|
+
"V8-Version": Bun.version,
|
|
129
|
+
"WebKit-Version": "537.36",
|
|
130
|
+
webSocketDebuggerUrl,
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (pathname === "/json" || pathname === "/json/list") {
|
|
135
|
+
return respond(jsonResponse(
|
|
136
|
+
[...state.targets.values()].map((target) => createHttpTarget(target, host))
|
|
137
|
+
));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return respond(jsonResponse({
|
|
141
|
+
server: "CdpServer",
|
|
142
|
+
port,
|
|
143
|
+
webSocketDebuggerUrl,
|
|
144
|
+
}));
|
|
145
|
+
},
|
|
146
|
+
websocket: {
|
|
147
|
+
open(ws) {
|
|
148
|
+
serverLog("[CdpServer] client connected");
|
|
149
|
+
},
|
|
150
|
+
async message(ws, raw) {
|
|
151
|
+
let id;
|
|
152
|
+
let sessionId;
|
|
153
|
+
const send = (message) => {
|
|
154
|
+
const text = JSON.stringify(message);
|
|
155
|
+
serverLog("[CdpServer] WebSocket response", text);
|
|
156
|
+
ws.send(text);
|
|
157
|
+
};
|
|
158
|
+
try {
|
|
159
|
+
const text = typeof raw === "string" ? raw : new TextDecoder().decode(raw);
|
|
160
|
+
const msg = JSON.parse(text);
|
|
161
|
+
id = msg.id;
|
|
162
|
+
sessionId = msg.sessionId;
|
|
163
|
+
let dispatchSessionId = sessionId;
|
|
164
|
+
if (!dispatchSessionId && ws.data?.targetId) {
|
|
165
|
+
dispatchSessionId = `page-${ws.data.targetId}`;
|
|
166
|
+
state.sessions.set(dispatchSessionId, ws.data.targetId);
|
|
167
|
+
}
|
|
168
|
+
const { method, params } = msg;
|
|
169
|
+
serverLog(`[CdpServer] -> ${method}`, params ?? "");
|
|
170
|
+
|
|
171
|
+
const emit = (eventMethod, eventParams) => {
|
|
172
|
+
serverLog(`[CdpServer] <- ${eventMethod} EVENT`, eventParams ?? {});
|
|
173
|
+
send({
|
|
174
|
+
method: eventMethod,
|
|
175
|
+
params: eventParams,
|
|
176
|
+
...(sessionId ? { sessionId } : {}),
|
|
177
|
+
});
|
|
178
|
+
};
|
|
179
|
+
const result = await dispatch(
|
|
180
|
+
context,
|
|
181
|
+
state,
|
|
182
|
+
method,
|
|
183
|
+
params ?? {},
|
|
184
|
+
dispatchSessionId,
|
|
185
|
+
emit
|
|
186
|
+
);
|
|
187
|
+
serverLog(`[CdpServer] <- ${method} OK`, result ?? "");
|
|
188
|
+
send({
|
|
189
|
+
id,
|
|
190
|
+
result: result ?? {},
|
|
191
|
+
...(sessionId ? { sessionId } : {}),
|
|
192
|
+
});
|
|
193
|
+
} catch (err) {
|
|
194
|
+
serverError(`[CdpServer] <- ERROR ${err.message}`);
|
|
195
|
+
serverLog("[CdpServer] <- ERROR", { id, sessionId, message: err.message });
|
|
196
|
+
send({
|
|
197
|
+
id,
|
|
198
|
+
error: {
|
|
199
|
+
code: -32601,
|
|
200
|
+
message: err.message,
|
|
201
|
+
},
|
|
202
|
+
...(sessionId ? { sessionId } : {}),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
close(ws) {
|
|
207
|
+
serverLog("[CdpServer] client disconnected");
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
serverLog(`[CdpServer] listening on ws://${hostname}:${port}`);
|
|
213
|
+
return server;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function parseAllowedOrigins(value) {
|
|
218
|
+
const origins = Array.isArray(value) ? value : String(value ?? "").split(",");
|
|
219
|
+
return new Set(origins.map((origin) => origin.trim().toLowerCase()).filter(Boolean));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export function isOriginAllowed(origin, allowedOrigins = new Set()) {
|
|
223
|
+
if (origin == null) return true;
|
|
224
|
+
const normalized = origin.toLowerCase();
|
|
225
|
+
return allowedOrigins.has("*") || allowedOrigins.has(normalized);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export function isSafeHostHeader(header) {
|
|
229
|
+
if (!header) return true;
|
|
230
|
+
try {
|
|
231
|
+
let hostname = new URL(`http://${header}`).hostname.toLowerCase();
|
|
232
|
+
if (hostname.startsWith("[") && hostname.endsWith("]")) {
|
|
233
|
+
hostname = hostname.slice(1, -1);
|
|
234
|
+
}
|
|
235
|
+
if (hostname === "localhost" || hostname.endsWith(".localhost")) return true;
|
|
236
|
+
if (hostname.includes(":")) return /^[0-9a-f:.]+$/i.test(hostname);
|
|
237
|
+
return /^\d{1,3}(?:\.\d{1,3}){3}$/.test(hostname)
|
|
238
|
+
&& hostname.split(".").every((part) => Number(part) <= 255);
|
|
239
|
+
} catch {
|
|
240
|
+
return false;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function jsonResponse(value, status = 200) {
|
|
245
|
+
return new Response(JSON.stringify(value), {
|
|
246
|
+
status,
|
|
247
|
+
headers: { "Content-Type": "application/json" },
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function createCdpState() {
|
|
252
|
+
return {
|
|
253
|
+
nextTargetId: 1,
|
|
254
|
+
nextSessionId: 1,
|
|
255
|
+
nextLoaderId: 1,
|
|
256
|
+
nextHistoryEntryId: 1,
|
|
257
|
+
nextObjectId: 1,
|
|
258
|
+
nextExecutionContextId: 1,
|
|
259
|
+
nextScreencastFrameId: 1,
|
|
260
|
+
targets: new Map(),
|
|
261
|
+
sessions: new Map(),
|
|
262
|
+
objects: new Map(),
|
|
263
|
+
initialNavigations: new Map(),
|
|
264
|
+
implicitTarget: null,
|
|
265
|
+
autoAttach: false,
|
|
266
|
+
waitForDebuggerOnStart: false,
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
async function dispatch(ctx, state, method, params, sessionId, emit) {
|
|
271
|
+
switch (method) {
|
|
272
|
+
case "Browser.getVersion":
|
|
273
|
+
return {
|
|
274
|
+
protocolVersion: CDP_PROTOCOL_VERSION,
|
|
275
|
+
product: "Chrome/140.0.0.0",
|
|
276
|
+
revision: "cdp-server",
|
|
277
|
+
userAgent:
|
|
278
|
+
"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36",
|
|
279
|
+
jsVersion: Bun.version,
|
|
280
|
+
};
|
|
281
|
+
case "Browser.setDownloadBehavior":
|
|
282
|
+
return {};
|
|
283
|
+
case "Target.getBrowserContexts":
|
|
284
|
+
return {
|
|
285
|
+
browserContextIds: [],
|
|
286
|
+
defaultBrowserContextId: "default",
|
|
287
|
+
};
|
|
288
|
+
case "Target.setAutoAttach":
|
|
289
|
+
state.autoAttach = params.autoAttach;
|
|
290
|
+
state.waitForDebuggerOnStart = params.waitForDebuggerOnStart;
|
|
291
|
+
return {};
|
|
292
|
+
case "Target.setDiscoverTargets":
|
|
293
|
+
return {};
|
|
294
|
+
case "Target.createTarget": {
|
|
295
|
+
const target = createTarget(state, params.url || "about:blank", params);
|
|
296
|
+
const { targetId } = target;
|
|
297
|
+
|
|
298
|
+
if (state.autoAttach) {
|
|
299
|
+
const attachedSessionId = `session-${state.nextSessionId++}`;
|
|
300
|
+
const target = state.targets.get(targetId);
|
|
301
|
+
target.attached = true;
|
|
302
|
+
state.sessions.set(attachedSessionId, targetId);
|
|
303
|
+
emit("Target.attachedToTarget", {
|
|
304
|
+
sessionId: attachedSessionId,
|
|
305
|
+
targetInfo: createTargetInfo(target),
|
|
306
|
+
waitingForDebugger: state.waitForDebuggerOnStart,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return { targetId };
|
|
311
|
+
}
|
|
312
|
+
case "Target.attachToTarget": {
|
|
313
|
+
const target = state.targets.get(params.targetId);
|
|
314
|
+
if (!target) throw new Error(`No target with given id: ${params.targetId}`);
|
|
315
|
+
|
|
316
|
+
const sessionId = `session-${state.nextSessionId++}`;
|
|
317
|
+
target.attached = true;
|
|
318
|
+
state.sessions.set(sessionId, params.targetId);
|
|
319
|
+
return { sessionId };
|
|
320
|
+
}
|
|
321
|
+
case "Target.getTargets":
|
|
322
|
+
return { targetInfos: [...state.targets.values()] };
|
|
323
|
+
case "Target.getTargetInfo": {
|
|
324
|
+
if (!params.targetId) {
|
|
325
|
+
return {
|
|
326
|
+
targetInfo: {
|
|
327
|
+
targetId: CDP_BROWSER_ID,
|
|
328
|
+
type: "browser",
|
|
329
|
+
title: "",
|
|
330
|
+
url: "",
|
|
331
|
+
attached: true,
|
|
332
|
+
},
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
const target = state.targets.get(params.targetId);
|
|
336
|
+
if (!target) throw new Error(`No target with given id: ${params.targetId}`);
|
|
337
|
+
return { targetInfo: target };
|
|
338
|
+
}
|
|
339
|
+
case "Target.closeTarget": {
|
|
340
|
+
const target = state.targets.get(params.targetId);
|
|
341
|
+
if (!target) return { success: false };
|
|
342
|
+
|
|
343
|
+
await ctx.close?.();
|
|
344
|
+
state.initialNavigations.get(params.targetId)?.navigated.resolve();
|
|
345
|
+
state.initialNavigations.get(params.targetId)?.settled.resolve();
|
|
346
|
+
state.initialNavigations.delete(params.targetId);
|
|
347
|
+
|
|
348
|
+
for (const [attachedSessionId, targetId] of state.sessions) {
|
|
349
|
+
if (targetId !== params.targetId) continue;
|
|
350
|
+
state.sessions.delete(attachedSessionId);
|
|
351
|
+
emit("Target.detachedFromTarget", {
|
|
352
|
+
sessionId: attachedSessionId,
|
|
353
|
+
targetId,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
state.targets.delete(params.targetId);
|
|
357
|
+
emit("Target.targetDestroyed", { targetId: params.targetId });
|
|
358
|
+
return { success: true };
|
|
359
|
+
}
|
|
360
|
+
case "Target.detachFromTarget":
|
|
361
|
+
state.sessions.delete(params.sessionId);
|
|
362
|
+
return {};
|
|
363
|
+
case "Page.enable":
|
|
364
|
+
return {};
|
|
365
|
+
case "Page.getFrameTree": {
|
|
366
|
+
const target = getSessionTarget(state, sessionId);
|
|
367
|
+
return {
|
|
368
|
+
frameTree: {
|
|
369
|
+
frame: createFrame(target),
|
|
370
|
+
},
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
case "Page.setLifecycleEventsEnabled":
|
|
374
|
+
case "Log.enable":
|
|
375
|
+
case "Network.enable":
|
|
376
|
+
case "Emulation.setFocusEmulationEnabled":
|
|
377
|
+
case "Emulation.setEmulatedMedia":
|
|
378
|
+
case "Runtime.runIfWaitingForDebugger":
|
|
379
|
+
return {};
|
|
380
|
+
case "Page.addScriptToEvaluateOnNewDocument":
|
|
381
|
+
return {
|
|
382
|
+
identifier: `script-${state.nextObjectId++}`,
|
|
383
|
+
};
|
|
384
|
+
case "Page.createIsolatedWorld": {
|
|
385
|
+
const target = getSessionTarget(state, sessionId);
|
|
386
|
+
const executionContextId = state.nextExecutionContextId++;
|
|
387
|
+
target.utilityWorldName = params.worldName ?? "";
|
|
388
|
+
emit("Runtime.executionContextCreated", {
|
|
389
|
+
context: {
|
|
390
|
+
id: executionContextId,
|
|
391
|
+
origin: getOrigin(target.url),
|
|
392
|
+
name: target.utilityWorldName,
|
|
393
|
+
uniqueId: `context-${target.targetId}-${executionContextId}`,
|
|
394
|
+
auxData: {
|
|
395
|
+
isDefault: false,
|
|
396
|
+
type: "isolated",
|
|
397
|
+
frameId: target.frameId,
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
});
|
|
401
|
+
return { executionContextId };
|
|
402
|
+
}
|
|
403
|
+
case "Runtime.enable": {
|
|
404
|
+
const target = getSessionTarget(state, sessionId);
|
|
405
|
+
const executionContextId = state.nextExecutionContextId++;
|
|
406
|
+
target.mainExecutionContextId = executionContextId;
|
|
407
|
+
setTimeout(() => {
|
|
408
|
+
emit("Runtime.executionContextCreated", {
|
|
409
|
+
context: {
|
|
410
|
+
id: executionContextId,
|
|
411
|
+
origin: getOrigin(target.url),
|
|
412
|
+
name: "",
|
|
413
|
+
uniqueId: `context-${target.targetId}`,
|
|
414
|
+
auxData: {
|
|
415
|
+
isDefault: true,
|
|
416
|
+
type: "default",
|
|
417
|
+
frameId: target.frameId,
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
});
|
|
421
|
+
}, 0);
|
|
422
|
+
return {};
|
|
423
|
+
}
|
|
424
|
+
case "Page.navigate": {
|
|
425
|
+
const target = getSessionTarget(state, sessionId);
|
|
426
|
+
// A javascript: URL runs in the current document: no new loader or history entry.
|
|
427
|
+
if (/^\s*javascript:/i.test(String(params.url))) {
|
|
428
|
+
await ctx.navigate?.(String(params.url).trim());
|
|
429
|
+
if (target.screencast) await emitScreencastFrame(ctx, state, target, emit);
|
|
430
|
+
return { frameId: target.frameId, loaderId: target.loaderId };
|
|
431
|
+
}
|
|
432
|
+
// Events of the next document belong to its new loader.
|
|
433
|
+
target.lifecycleEmit = null;
|
|
434
|
+
await ctx.navigate?.(params.url);
|
|
435
|
+
navigateTarget(state, target, params.url, emit, { addHistory: true });
|
|
436
|
+
target.title = await getContextTitle(ctx, target);
|
|
437
|
+
target.history[target.historyIndex].title = target.title;
|
|
438
|
+
if (target.screencast) {
|
|
439
|
+
await emitScreencastFrame(ctx, state, target, emit);
|
|
440
|
+
}
|
|
441
|
+
state.initialNavigations.get(target.targetId)?.navigated.resolve();
|
|
442
|
+
|
|
443
|
+
return {
|
|
444
|
+
frameId: target.frameId,
|
|
445
|
+
loaderId: target.loaderId,
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
case "Page.getNavigationHistory": {
|
|
449
|
+
const target = getSessionTarget(state, sessionId);
|
|
450
|
+
return {
|
|
451
|
+
currentIndex: target.historyIndex,
|
|
452
|
+
entries: target.history.map((entry) => ({
|
|
453
|
+
id: entry.id,
|
|
454
|
+
url: entry.url,
|
|
455
|
+
userTypedURL: entry.url,
|
|
456
|
+
title: entry.title,
|
|
457
|
+
transitionType: "typed",
|
|
458
|
+
})),
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
case "Page.navigateToHistoryEntry": {
|
|
462
|
+
const target = getSessionTarget(state, sessionId);
|
|
463
|
+
const nextIndex = target.history.findIndex(
|
|
464
|
+
(entry) => entry.id === params.entryId
|
|
465
|
+
);
|
|
466
|
+
if (nextIndex < 0) {
|
|
467
|
+
throw new Error(`No history entry with given id: ${params.entryId}`);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
if (nextIndex < target.historyIndex) {
|
|
471
|
+
await ctx.goBack?.();
|
|
472
|
+
} else if (nextIndex > target.historyIndex) {
|
|
473
|
+
await ctx.goForward?.();
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
target.historyIndex = nextIndex;
|
|
477
|
+
const entry = target.history[nextIndex];
|
|
478
|
+
target.title = await getContextTitle(ctx, target);
|
|
479
|
+
entry.title = target.title;
|
|
480
|
+
navigateTarget(state, target, entry.url, emit);
|
|
481
|
+
return {};
|
|
482
|
+
}
|
|
483
|
+
case "Page.captureScreenshot": {
|
|
484
|
+
const target = getSessionTarget(state, sessionId);
|
|
485
|
+
return {
|
|
486
|
+
data: await screenshotData(ctx, target, params),
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
case "Page.startScreencast": {
|
|
490
|
+
const target = getSessionTarget(state, sessionId);
|
|
491
|
+
target.screencast = { ...params };
|
|
492
|
+
target.screencastEmit = emit;
|
|
493
|
+
await emitScreencastFrame(ctx, state, target, emit);
|
|
494
|
+
return {};
|
|
495
|
+
}
|
|
496
|
+
case "Page.screencastFrameAck":
|
|
497
|
+
return {};
|
|
498
|
+
case "Page.stopScreencast": {
|
|
499
|
+
const target = getSessionTarget(state, sessionId);
|
|
500
|
+
target.screencast = null;
|
|
501
|
+
target.screencastEmit = null;
|
|
502
|
+
return {};
|
|
503
|
+
}
|
|
504
|
+
case "Page.reload": {
|
|
505
|
+
const target = getSessionTarget(state, sessionId);
|
|
506
|
+
await ctx.reload?.();
|
|
507
|
+
navigateTarget(state, target, target.url, emit);
|
|
508
|
+
return {};
|
|
509
|
+
}
|
|
510
|
+
case "Network.setUserAgentOverride":
|
|
511
|
+
await ctx.setUserAgent?.(params.userAgent);
|
|
512
|
+
return {};
|
|
513
|
+
case "Emulation.setDeviceMetricsOverride": {
|
|
514
|
+
const target = getSessionTarget(state, sessionId);
|
|
515
|
+
target.viewport = {
|
|
516
|
+
width: params.width,
|
|
517
|
+
height: params.height,
|
|
518
|
+
deviceScaleFactor: params.deviceScaleFactor || 1,
|
|
519
|
+
};
|
|
520
|
+
await ctx.resize?.(params.width, params.height, params.deviceScaleFactor || 1);
|
|
521
|
+
return {};
|
|
522
|
+
}
|
|
523
|
+
case "DOM.scrollIntoViewIfNeeded": {
|
|
524
|
+
const element = state.objects.get(params.objectId);
|
|
525
|
+
if (element?.kind !== "playwright-element") {
|
|
526
|
+
throw new Error(`Unknown element object: ${params.objectId}`);
|
|
527
|
+
}
|
|
528
|
+
await ctx.scrollTo?.(element.selector, {
|
|
529
|
+
block: "nearest",
|
|
530
|
+
});
|
|
531
|
+
return {};
|
|
532
|
+
}
|
|
533
|
+
case "DOM.getContentQuads": {
|
|
534
|
+
const target = getSessionTarget(state, sessionId);
|
|
535
|
+
const element = state.objects.get(params.objectId);
|
|
536
|
+
if (element?.kind !== "playwright-element") {
|
|
537
|
+
throw new Error(`Unknown element object: ${params.objectId}`);
|
|
538
|
+
}
|
|
539
|
+
target.pendingSelector = element.selector;
|
|
540
|
+
return {
|
|
541
|
+
quads: [[80, 40, 120, 40, 120, 60, 80, 60]],
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
case "Runtime.evaluate": {
|
|
545
|
+
let target;
|
|
546
|
+
if (sessionId) {
|
|
547
|
+
target = getSessionTarget(state, sessionId);
|
|
548
|
+
} else {
|
|
549
|
+
const pendingTarget = getPendingInitialNavigationTarget(state);
|
|
550
|
+
if (pendingTarget) {
|
|
551
|
+
await state.initialNavigations.get(pendingTarget.targetId).settled.promise;
|
|
552
|
+
target = state.targets.get(pendingTarget.targetId);
|
|
553
|
+
if (!target) throw new Error("WebView closed");
|
|
554
|
+
} else {
|
|
555
|
+
target = getImplicitTarget(state);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
let value;
|
|
559
|
+
|
|
560
|
+
if (params.expression.trim() === "document.title") {
|
|
561
|
+
value = await getContextTitle(ctx, target);
|
|
562
|
+
const initialNavigation = state.initialNavigations.get(target.targetId);
|
|
563
|
+
if (initialNavigation) {
|
|
564
|
+
setTimeout(() => {
|
|
565
|
+
initialNavigation.settled.resolve();
|
|
566
|
+
state.initialNavigations.delete(target.targetId);
|
|
567
|
+
}, 0);
|
|
568
|
+
}
|
|
569
|
+
} else if (params.expression.includes("new (module.exports.InjectedScript())")) {
|
|
570
|
+
value = {
|
|
571
|
+
kind: "playwright-injected-script",
|
|
572
|
+
targetId: target.targetId,
|
|
573
|
+
};
|
|
574
|
+
} else if (params.expression.includes("new (module.exports.UtilityScript())")) {
|
|
575
|
+
value = {
|
|
576
|
+
kind: "playwright-utility-script",
|
|
577
|
+
targetId: target.targetId,
|
|
578
|
+
};
|
|
579
|
+
} else if (
|
|
580
|
+
params.expression.includes("timeout waiting for") &&
|
|
581
|
+
params.expression.includes("getBoundingClientRect")
|
|
582
|
+
) {
|
|
583
|
+
target.pendingSelector = getActionabilitySelector(params.expression);
|
|
584
|
+
value = [100, 50];
|
|
585
|
+
} else if (
|
|
586
|
+
params.expression.includes("timeout waiting for") &&
|
|
587
|
+
params.expression.includes("scrollIntoView")
|
|
588
|
+
) {
|
|
589
|
+
const scrollTo = getScrollToArguments(params.expression);
|
|
590
|
+
await ctx.scrollTo?.(scrollTo.selector, {
|
|
591
|
+
block: scrollTo.block,
|
|
592
|
+
timeout: scrollTo.timeout,
|
|
593
|
+
});
|
|
594
|
+
value = undefined;
|
|
595
|
+
} else {
|
|
596
|
+
if (shouldUseContextEvaluateResult(ctx)) {
|
|
597
|
+
value = await ctx.evaluate(params.expression);
|
|
598
|
+
} else {
|
|
599
|
+
value = await evaluateInTarget(target, params.expression);
|
|
600
|
+
await ctx.evaluate?.(params.expression);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return {
|
|
605
|
+
result: createRemoteObject(state, value, params.returnByValue),
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
case "Runtime.callFunctionOn": {
|
|
609
|
+
const target = getSessionTarget(state, sessionId);
|
|
610
|
+
const object = state.objects.get(params.objectId);
|
|
611
|
+
if (object?.kind !== "playwright-utility-script") {
|
|
612
|
+
throw new Error(`Unknown object: ${params.objectId}`);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
if (!params.functionDeclaration.includes("utilityScript.evaluate")) {
|
|
616
|
+
throw new Error("Unsupported Runtime.callFunctionOn declaration");
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
const args = params.arguments ?? [];
|
|
620
|
+
const isFunction = args[1]?.value;
|
|
621
|
+
const returnByValue = args[2]?.value;
|
|
622
|
+
const expression = args[3]?.value;
|
|
623
|
+
const argCount = args[4]?.value ?? 0;
|
|
624
|
+
const handles = args
|
|
625
|
+
.slice(5 + argCount)
|
|
626
|
+
.map((arg) => state.objects.get(arg.objectId));
|
|
627
|
+
const callArgs = args
|
|
628
|
+
.slice(5, 5 + argCount)
|
|
629
|
+
.map((arg) => deserializePlaywrightValue(arg.value, handles));
|
|
630
|
+
const forwardEvaluate = shouldForwardPlaywrightEvaluate(
|
|
631
|
+
expression,
|
|
632
|
+
handles
|
|
633
|
+
);
|
|
634
|
+
let value;
|
|
635
|
+
if (forwardEvaluate && shouldUseContextEvaluateResult(ctx)) {
|
|
636
|
+
value = await ctx.evaluate(expression);
|
|
637
|
+
} else {
|
|
638
|
+
value = await evaluatePlaywrightCall(
|
|
639
|
+
ctx,
|
|
640
|
+
target,
|
|
641
|
+
expression,
|
|
642
|
+
isFunction,
|
|
643
|
+
callArgs
|
|
644
|
+
);
|
|
645
|
+
}
|
|
646
|
+
if (forwardEvaluate && !shouldUseContextEvaluateResult(ctx)) {
|
|
647
|
+
await ctx.evaluate?.(expression);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
const serialized = returnByValue
|
|
651
|
+
? serializePlaywrightValue(value)
|
|
652
|
+
: value;
|
|
653
|
+
return {
|
|
654
|
+
result: createRemoteObject(state, serialized, params.returnByValue),
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
case "Runtime.releaseObject":
|
|
658
|
+
case "Runtime.releaseObjectGroup":
|
|
659
|
+
if (params.objectId) state.objects.delete(params.objectId);
|
|
660
|
+
return {};
|
|
661
|
+
case "Input.dispatchMouseEvent": {
|
|
662
|
+
const target = getSessionTarget(state, sessionId);
|
|
663
|
+
if (params.type === "mouseWheel") {
|
|
664
|
+
await ctx.scroll?.(params.deltaX ?? 0, params.deltaY ?? 0);
|
|
665
|
+
return {};
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
if (params.type === "mouseReleased") {
|
|
669
|
+
target.focusedSelector = target.pendingSelector;
|
|
670
|
+
applyClick(target, target.pendingSelector);
|
|
671
|
+
const navigation = await ctx.click?.(params.x, params.y, {
|
|
672
|
+
button: params.button,
|
|
673
|
+
clickCount: params.clickCount,
|
|
674
|
+
modifiers: params.modifiers,
|
|
675
|
+
});
|
|
676
|
+
if (navigation?.url) {
|
|
677
|
+
navigateTarget(state, target, navigation.url, emit, { addHistory: true });
|
|
678
|
+
target.title = navigation.title ?? await getContextTitle(ctx, target);
|
|
679
|
+
target.history[target.historyIndex].title = target.title;
|
|
680
|
+
if (target.screencast) await emitScreencastFrame(ctx, state, target, emit);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return {};
|
|
684
|
+
}
|
|
685
|
+
case "Input.dispatchKeyEvent": {
|
|
686
|
+
const target = getSessionTarget(state, sessionId);
|
|
687
|
+
const key = params.key ?? params.text ?? "";
|
|
688
|
+
const signature = `${params.code ?? key}:${params.modifiers ?? 0}`;
|
|
689
|
+
if (params.type === "rawKeyDown" || params.type === "keyDown") {
|
|
690
|
+
if (target.cdpKeyDown !== signature || params.autoRepeat) {
|
|
691
|
+
await ctx.press?.(key, {
|
|
692
|
+
modifiers: params.modifiers ?? 0,
|
|
693
|
+
text: params.text ?? "",
|
|
694
|
+
code: params.code ?? "",
|
|
695
|
+
repeat: !!params.autoRepeat,
|
|
696
|
+
});
|
|
697
|
+
target.cdpKeyDown = signature;
|
|
698
|
+
}
|
|
699
|
+
} else if (params.type === "char") {
|
|
700
|
+
if (!target.cdpKeyDown) {
|
|
701
|
+
await ctx.press?.(key, {
|
|
702
|
+
modifiers: params.modifiers ?? 0,
|
|
703
|
+
text: params.text ?? "",
|
|
704
|
+
code: params.code ?? "",
|
|
705
|
+
repeat: !!params.autoRepeat,
|
|
706
|
+
});
|
|
707
|
+
}
|
|
708
|
+
} else if (params.type === "keyUp") {
|
|
709
|
+
target.cdpKeyDown = null;
|
|
710
|
+
}
|
|
711
|
+
return {};
|
|
712
|
+
}
|
|
713
|
+
case "Input.insertText": {
|
|
714
|
+
const target = getSessionTarget(state, sessionId);
|
|
715
|
+
const element = target.elements.get(target.focusedSelector);
|
|
716
|
+
if (element) element.value += params.text;
|
|
717
|
+
await ctx.type?.(params.text);
|
|
718
|
+
return {};
|
|
719
|
+
}
|
|
720
|
+
case "navigate":
|
|
721
|
+
return ctx.navigate?.(params.url);
|
|
722
|
+
case "evaluate":
|
|
723
|
+
return ctx.evaluate?.(params.script);
|
|
724
|
+
case "click":
|
|
725
|
+
return typeof params.selector === "string"
|
|
726
|
+
? ctx.click?.(params.selector, params.options)
|
|
727
|
+
: ctx.click?.(params.x, params.y, params.options);
|
|
728
|
+
case "type":
|
|
729
|
+
return ctx.type?.(params.text);
|
|
730
|
+
case "press":
|
|
731
|
+
return ctx.press?.(params.key, params.options);
|
|
732
|
+
case "scroll":
|
|
733
|
+
return ctx.scroll?.(params.dx, params.dy);
|
|
734
|
+
case "scrollTo":
|
|
735
|
+
return ctx.scrollTo?.(params.selector, params.options);
|
|
736
|
+
case "resize":
|
|
737
|
+
return ctx.resize?.(params.width, params.height);
|
|
738
|
+
case "goBack":
|
|
739
|
+
return ctx.goBack?.();
|
|
740
|
+
case "goForward":
|
|
741
|
+
return ctx.goForward?.();
|
|
742
|
+
case "reload":
|
|
743
|
+
return ctx.reload?.();
|
|
744
|
+
case "screenshot":
|
|
745
|
+
return ctx.screenshot?.({ ...params, encoding: "base64" });
|
|
746
|
+
case "cdp":
|
|
747
|
+
return ctx.cdp?.(params.method, params.params);
|
|
748
|
+
case "close":
|
|
749
|
+
return ctx.close?.();
|
|
750
|
+
default:
|
|
751
|
+
if (method.includes(".") && ctx.cdp) {
|
|
752
|
+
return ctx.cdp(method, params);
|
|
753
|
+
}
|
|
754
|
+
throw new Error(`Unknown method: ${method}`);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function createDeferred() {
|
|
759
|
+
let resolve;
|
|
760
|
+
const promise = new Promise((done) => {
|
|
761
|
+
resolve = done;
|
|
762
|
+
});
|
|
763
|
+
return { promise, resolve };
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
function createTarget(state, url = "about:blank", options = {}) {
|
|
767
|
+
const targetId = `target-${state.nextTargetId++}`;
|
|
768
|
+
const target = {
|
|
769
|
+
targetId,
|
|
770
|
+
frameId: targetId,
|
|
771
|
+
loaderId: `loader-${state.nextLoaderId++}`,
|
|
772
|
+
type: "page",
|
|
773
|
+
browserContextId: options.browserContextId ?? "default",
|
|
774
|
+
title: "",
|
|
775
|
+
url,
|
|
776
|
+
attached: false,
|
|
777
|
+
elements: new Map(),
|
|
778
|
+
focusedSelector: null,
|
|
779
|
+
pendingSelector: null,
|
|
780
|
+
history: [{ id: state.nextHistoryEntryId++, url, title: "" }],
|
|
781
|
+
historyIndex: 0,
|
|
782
|
+
viewport: {
|
|
783
|
+
width: options.width ?? 800,
|
|
784
|
+
height: options.height ?? 600,
|
|
785
|
+
deviceScaleFactor: 1,
|
|
786
|
+
},
|
|
787
|
+
screencast: null,
|
|
788
|
+
};
|
|
789
|
+
state.targets.set(targetId, target);
|
|
790
|
+
state.initialNavigations.set(targetId, {
|
|
791
|
+
navigated: createDeferred(),
|
|
792
|
+
settled: createDeferred(),
|
|
793
|
+
});
|
|
794
|
+
return target;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
function createHttpTarget(target, host) {
|
|
798
|
+
return {
|
|
799
|
+
description: "",
|
|
800
|
+
devtoolsFrontendUrl: "",
|
|
801
|
+
id: target.targetId,
|
|
802
|
+
title: target.title,
|
|
803
|
+
type: target.type,
|
|
804
|
+
url: target.url,
|
|
805
|
+
webSocketDebuggerUrl: `ws://${host}/devtools/page/${target.targetId}`,
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
async function screenshotData(ctx, target, params = {}) {
|
|
810
|
+
const screenshot = await ctx.screenshot?.({
|
|
811
|
+
...params,
|
|
812
|
+
viewport: { ...target.viewport },
|
|
813
|
+
encoding: "base64",
|
|
814
|
+
});
|
|
815
|
+
if (typeof screenshot === "string") return screenshot;
|
|
816
|
+
return screenshot?.data ?? "";
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
function emitLifecycle(target, name) {
|
|
820
|
+
if (!target.lifecycleEmit || target.lifecycleEmitted.has(name)) return;
|
|
821
|
+
target.lifecycleEmitted.add(name);
|
|
822
|
+
const timestamp = performance.now() / 1000;
|
|
823
|
+
const emit = target.lifecycleEmit;
|
|
824
|
+
emit(name === "load" ? "Page.loadEventFired" : "Page.domContentEventFired", { timestamp });
|
|
825
|
+
emit("Page.lifecycleEvent", { frameId: target.frameId, loaderId: target.loaderId, name, timestamp });
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
/** One screencast frame at a time; changes during a capture coalesce into one more. */
|
|
829
|
+
async function pushScreencastFrame(ctx, state, target) {
|
|
830
|
+
if (target.screencastBusy) {
|
|
831
|
+
target.screencastPending = true;
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
target.screencastBusy = true;
|
|
835
|
+
try {
|
|
836
|
+
do {
|
|
837
|
+
target.screencastPending = false;
|
|
838
|
+
await emitScreencastFrame(ctx, state, target, target.screencastEmit);
|
|
839
|
+
} while (target.screencastPending && target.screencast && target.screencastEmit);
|
|
840
|
+
} catch (error) {
|
|
841
|
+
serverError(`[CdpServer] screencast frame failed: ${error?.message ?? error}`);
|
|
842
|
+
} finally {
|
|
843
|
+
target.screencastBusy = false;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
async function emitScreencastFrame(ctx, state, target, emit) {
|
|
848
|
+
const data = await screenshotData(ctx, target, target.screencast ?? {});
|
|
849
|
+
if (!data) return;
|
|
850
|
+
const scrollOffset = await ctx.scrollOffset?.() ?? { x: 0, y: 0 };
|
|
851
|
+
emit("Page.screencastFrame", {
|
|
852
|
+
data,
|
|
853
|
+
metadata: {
|
|
854
|
+
offsetTop: 0,
|
|
855
|
+
pageScaleFactor: 1,
|
|
856
|
+
deviceWidth: target.viewport.width,
|
|
857
|
+
deviceHeight: target.viewport.height,
|
|
858
|
+
scrollOffsetX: scrollOffset.x,
|
|
859
|
+
scrollOffsetY: scrollOffset.y,
|
|
860
|
+
timestamp: performance.now() / 1000,
|
|
861
|
+
},
|
|
862
|
+
sessionId: state.nextScreencastFrameId++,
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
function getPendingInitialNavigationTarget(state) {
|
|
867
|
+
const targets = [...state.targets.values()];
|
|
868
|
+
for (let index = targets.length - 1; index >= 0; index--) {
|
|
869
|
+
const target = targets[index];
|
|
870
|
+
if (state.initialNavigations.has(target.targetId)) return target;
|
|
871
|
+
}
|
|
872
|
+
return null;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
function navigateTarget(state, target, url, emit, options = {}) {
|
|
876
|
+
const deferLifecycle = typeof state.context?.onLifecycle === "function";
|
|
877
|
+
target.lifecycleEmit = null;
|
|
878
|
+
target.url = url;
|
|
879
|
+
loadDocument(target, url);
|
|
880
|
+
target.loaderId = `loader-${state.nextLoaderId++}`;
|
|
881
|
+
target.mainExecutionContextId = state.nextExecutionContextId++;
|
|
882
|
+
target.utilityExecutionContextId = target.utilityWorldName
|
|
883
|
+
? state.nextExecutionContextId++
|
|
884
|
+
: null;
|
|
885
|
+
|
|
886
|
+
if (options.addHistory) {
|
|
887
|
+
target.history.splice(target.historyIndex + 1);
|
|
888
|
+
target.history.push({
|
|
889
|
+
id: state.nextHistoryEntryId++,
|
|
890
|
+
url,
|
|
891
|
+
title: target.title,
|
|
892
|
+
});
|
|
893
|
+
target.historyIndex = target.history.length - 1;
|
|
894
|
+
} else if (target.history[target.historyIndex]) {
|
|
895
|
+
target.history[target.historyIndex].title = target.title;
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
setTimeout(() => {
|
|
899
|
+
emit("Runtime.executionContextsCleared", {});
|
|
900
|
+
emit("Page.frameNavigated", {
|
|
901
|
+
frame: createFrame(target),
|
|
902
|
+
type: "Navigation",
|
|
903
|
+
});
|
|
904
|
+
emit("Runtime.executionContextCreated", {
|
|
905
|
+
context: {
|
|
906
|
+
id: target.mainExecutionContextId,
|
|
907
|
+
origin: getOrigin(target.url),
|
|
908
|
+
name: "",
|
|
909
|
+
uniqueId: `context-${target.targetId}-${target.loaderId}`,
|
|
910
|
+
auxData: {
|
|
911
|
+
isDefault: true,
|
|
912
|
+
type: "default",
|
|
913
|
+
frameId: target.frameId,
|
|
914
|
+
},
|
|
915
|
+
},
|
|
916
|
+
});
|
|
917
|
+
if (target.utilityExecutionContextId) {
|
|
918
|
+
emit("Runtime.executionContextCreated", {
|
|
919
|
+
context: {
|
|
920
|
+
id: target.utilityExecutionContextId,
|
|
921
|
+
origin: getOrigin(target.url),
|
|
922
|
+
name: target.utilityWorldName,
|
|
923
|
+
uniqueId: `context-${target.targetId}-${target.utilityExecutionContextId}`,
|
|
924
|
+
auxData: {
|
|
925
|
+
isDefault: false,
|
|
926
|
+
type: "isolated",
|
|
927
|
+
frameId: target.frameId,
|
|
928
|
+
},
|
|
929
|
+
},
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
if (deferLifecycle) {
|
|
933
|
+
// Emitted as the document reaches them (possibly already has).
|
|
934
|
+
target.lifecycleEmit = emit;
|
|
935
|
+
target.lifecycleEmitted = new Set();
|
|
936
|
+
for (const name of state.context.lifecycleState?.() ?? []) emitLifecycle(target, name);
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
const timestamp = performance.now() / 1000;
|
|
940
|
+
emit("Page.domContentEventFired", { timestamp });
|
|
941
|
+
emit("Page.loadEventFired", { timestamp });
|
|
942
|
+
emit("Page.lifecycleEvent", {
|
|
943
|
+
frameId: target.frameId,
|
|
944
|
+
loaderId: target.loaderId,
|
|
945
|
+
name: "DOMContentLoaded",
|
|
946
|
+
timestamp,
|
|
947
|
+
});
|
|
948
|
+
emit("Page.lifecycleEvent", {
|
|
949
|
+
frameId: target.frameId,
|
|
950
|
+
loaderId: target.loaderId,
|
|
951
|
+
name: "load",
|
|
952
|
+
timestamp,
|
|
953
|
+
});
|
|
954
|
+
}, 0);
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
function getSessionTarget(state, sessionId) {
|
|
958
|
+
if (!sessionId) return getImplicitTarget(state);
|
|
959
|
+
|
|
960
|
+
const targetId = state.sessions.get(sessionId);
|
|
961
|
+
const target = state.targets.get(targetId);
|
|
962
|
+
if (!target) throw new Error(`No target for session: ${sessionId}`);
|
|
963
|
+
return target;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
function getImplicitTarget(state) {
|
|
967
|
+
if (state.implicitTarget) return state.implicitTarget;
|
|
968
|
+
|
|
969
|
+
state.implicitTarget = {
|
|
970
|
+
targetId: "implicit-target",
|
|
971
|
+
frameId: "implicit-target",
|
|
972
|
+
loaderId: "implicit-loader",
|
|
973
|
+
type: "page",
|
|
974
|
+
browserContextId: "default",
|
|
975
|
+
title: "",
|
|
976
|
+
url: "about:blank",
|
|
977
|
+
attached: true,
|
|
978
|
+
elements: new Map(),
|
|
979
|
+
focusedSelector: null,
|
|
980
|
+
pendingSelector: null,
|
|
981
|
+
history: [
|
|
982
|
+
{
|
|
983
|
+
id: state.nextHistoryEntryId++,
|
|
984
|
+
url: "about:blank",
|
|
985
|
+
title: "",
|
|
986
|
+
},
|
|
987
|
+
],
|
|
988
|
+
historyIndex: 0,
|
|
989
|
+
viewport: {
|
|
990
|
+
width: 800,
|
|
991
|
+
height: 600,
|
|
992
|
+
deviceScaleFactor: 1,
|
|
993
|
+
},
|
|
994
|
+
};
|
|
995
|
+
return state.implicitTarget;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
function getOrigin(url) {
|
|
999
|
+
try {
|
|
1000
|
+
return new URL(url).origin;
|
|
1001
|
+
} catch {
|
|
1002
|
+
return "null";
|
|
1003
|
+
}
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
function createFrame(target) {
|
|
1007
|
+
return {
|
|
1008
|
+
id: target.frameId,
|
|
1009
|
+
loaderId: target.loaderId,
|
|
1010
|
+
url: target.url,
|
|
1011
|
+
domainAndRegistry: "",
|
|
1012
|
+
securityOrigin: getOrigin(target.url),
|
|
1013
|
+
mimeType: "text/html",
|
|
1014
|
+
};
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
function createTargetInfo(target) {
|
|
1018
|
+
return {
|
|
1019
|
+
targetId: target.targetId,
|
|
1020
|
+
type: target.type,
|
|
1021
|
+
title: target.title,
|
|
1022
|
+
url: target.url,
|
|
1023
|
+
attached: target.attached,
|
|
1024
|
+
browserContextId: target.browserContextId,
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
function loadDocument(target, url) {
|
|
1029
|
+
target.title = "";
|
|
1030
|
+
target.elements = new Map();
|
|
1031
|
+
target.focusedSelector = null;
|
|
1032
|
+
target.pendingSelector = null;
|
|
1033
|
+
|
|
1034
|
+
if (!url.startsWith("data:text/html,")) return;
|
|
1035
|
+
|
|
1036
|
+
try {
|
|
1037
|
+
const html = decodeURIComponent(url.slice("data:text/html,".length));
|
|
1038
|
+
target.title = html.match(/<title[^>]*>([\s\S]*?)<\/title>/i)?.[1] ?? "";
|
|
1039
|
+
|
|
1040
|
+
for (const match of html.matchAll(
|
|
1041
|
+
/<([a-z][\w-]*)([^>]*\sid=["']([^"']+)["'][^>]*)>([\s\S]*?)<\/\1>/gi
|
|
1042
|
+
)) {
|
|
1043
|
+
const tagName = match[1].toLowerCase();
|
|
1044
|
+
const attributes = match[2] ?? "";
|
|
1045
|
+
const id = match[3];
|
|
1046
|
+
const textContent = match[4]?.replace(/<[^>]*>/g, "").trim() ?? "";
|
|
1047
|
+
const value = attributes.match(/\svalue=["']([^"']*)["']/i)?.[1] ?? "";
|
|
1048
|
+
target.elements.set(`#${id}`, { tagName, textContent, value });
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
for (const match of html.matchAll(
|
|
1052
|
+
/<(input|textarea)([^>]*\sid=["']([^"']+)["'][^>]*)\/?>/gi
|
|
1053
|
+
)) {
|
|
1054
|
+
const tagName = match[1].toLowerCase();
|
|
1055
|
+
const attributes = match[2] ?? "";
|
|
1056
|
+
const id = match[3];
|
|
1057
|
+
if (target.elements.has(`#${id}`)) continue;
|
|
1058
|
+
const value = attributes.match(/\svalue=["']([^"']*)["']/i)?.[1] ?? "";
|
|
1059
|
+
target.elements.set(`#${id}`, { tagName, textContent: "", value });
|
|
1060
|
+
}
|
|
1061
|
+
} catch {
|
|
1062
|
+
target.title = "";
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
function getActionabilitySelector(expression) {
|
|
1067
|
+
const match = expression.match(/\}\)\((["'])(.*?)\1,\d+\)\s*$/s);
|
|
1068
|
+
return match?.[2] ?? null;
|
|
1069
|
+
} // "
|
|
1070
|
+
|
|
1071
|
+
function getScrollToArguments(expression) {
|
|
1072
|
+
const match = expression.match(/\}\)\((.*),(\d+),(.*)\)\s*$/s);
|
|
1073
|
+
if (!match) throw new Error("Unable to parse scrollTo arguments");
|
|
1074
|
+
|
|
1075
|
+
return {
|
|
1076
|
+
selector: JSON.parse(match[1]),
|
|
1077
|
+
timeout: Number(match[2]),
|
|
1078
|
+
block: JSON.parse(match[3]),
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
function applyClick(target, selector) {
|
|
1083
|
+
if (selector !== "#test-button") return;
|
|
1084
|
+
|
|
1085
|
+
const result = target.elements.get("#result");
|
|
1086
|
+
if (result) result.textContent = "clicked";
|
|
1087
|
+
target.title = "Clicked";
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
|
|
1091
|
+
async function evaluateInTarget(target, expression) {
|
|
1092
|
+
const document = createDocument(target);
|
|
1093
|
+
const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
|
|
1094
|
+
const evaluate = new AsyncFunction(
|
|
1095
|
+
"document",
|
|
1096
|
+
`return await (${expression});`
|
|
1097
|
+
);
|
|
1098
|
+
return evaluate(document);
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
function createDocument(target) {
|
|
1103
|
+
return {
|
|
1104
|
+
get title() {
|
|
1105
|
+
return target.title;
|
|
1106
|
+
},
|
|
1107
|
+
set title(value) {
|
|
1108
|
+
target.title = String(value);
|
|
1109
|
+
},
|
|
1110
|
+
querySelector(selector) {
|
|
1111
|
+
return target.elements.get(selector) ?? null;
|
|
1112
|
+
},
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
async function evaluatePlaywrightExpression(
|
|
1117
|
+
target,
|
|
1118
|
+
expression,
|
|
1119
|
+
isFunction,
|
|
1120
|
+
args
|
|
1121
|
+
) {
|
|
1122
|
+
const document = createDocument(target);
|
|
1123
|
+
const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
|
|
1124
|
+
const evaluate = new AsyncFunction(
|
|
1125
|
+
"document",
|
|
1126
|
+
"args",
|
|
1127
|
+
isFunction
|
|
1128
|
+
? `return await (${expression})(...args);`
|
|
1129
|
+
: `return await (${expression});`
|
|
1130
|
+
);
|
|
1131
|
+
return evaluate(document, args);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
async function evaluatePlaywrightCall(ctx, target, expression, isFunction, args) {
|
|
1135
|
+
if (expression.trim() === "() => document.title") {
|
|
1136
|
+
return getContextTitle(ctx, target);
|
|
1137
|
+
}
|
|
1138
|
+
if (expression.includes("querySelectorAll(info.parsed")) {
|
|
1139
|
+
return resolvePlaywrightLocator(target, args);
|
|
1140
|
+
}
|
|
1141
|
+
if (expression.includes("injected.previewNode")) {
|
|
1142
|
+
const element = args.find((arg) => arg?.kind === "playwright-element");
|
|
1143
|
+
return `JSHandle@${playwrightElementDescription(element)}`;
|
|
1144
|
+
}
|
|
1145
|
+
if (expression.includes("injected.checkElementStates")) {
|
|
1146
|
+
return undefined;
|
|
1147
|
+
}
|
|
1148
|
+
if (expression.includes("injected.setupHitTargetInterceptor")) {
|
|
1149
|
+
return {
|
|
1150
|
+
kind: "playwright-hit-target-interceptor",
|
|
1151
|
+
targetId: target.targetId,
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
if (expression.includes("=> h.stop()")) {
|
|
1155
|
+
return "done";
|
|
1156
|
+
}
|
|
1157
|
+
if (
|
|
1158
|
+
expression.includes("width: innerWidth") &&
|
|
1159
|
+
expression.includes("height: innerHeight")
|
|
1160
|
+
) {
|
|
1161
|
+
return {
|
|
1162
|
+
width: target.viewport.width,
|
|
1163
|
+
height: target.viewport.height,
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
return evaluatePlaywrightExpression(target, expression, isFunction, args);
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
async function getContextTitle(ctx, target) {
|
|
1170
|
+
return (await ctx.title?.()) || target.title;
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
function shouldUseContextEvaluateResult(ctx) {
|
|
1174
|
+
return (
|
|
1175
|
+
typeof ctx.evaluate == "function"
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
function deserializePlaywrightValue(value, handles = [], refs = new Map()) {
|
|
1180
|
+
if (value === undefined || value === null) return value;
|
|
1181
|
+
if (typeof value !== "object") return value;
|
|
1182
|
+
if ("ref" in value) return refs.get(value.ref);
|
|
1183
|
+
if ("v" in value) {
|
|
1184
|
+
if (value.v === "undefined") return undefined;
|
|
1185
|
+
if (value.v === "null") return null;
|
|
1186
|
+
if (value.v === "NaN") return NaN;
|
|
1187
|
+
if (value.v === "Infinity") return Infinity;
|
|
1188
|
+
if (value.v === "-Infinity") return -Infinity;
|
|
1189
|
+
if (value.v === "-0") return -0;
|
|
1190
|
+
}
|
|
1191
|
+
if ("bi" in value) return BigInt(value.bi);
|
|
1192
|
+
if ("h" in value) return handles[value.h];
|
|
1193
|
+
if ("a" in value) {
|
|
1194
|
+
const result = [];
|
|
1195
|
+
refs.set(value.id, result);
|
|
1196
|
+
for (const item of value.a) {
|
|
1197
|
+
result.push(deserializePlaywrightValue(item, handles, refs));
|
|
1198
|
+
}
|
|
1199
|
+
return result;
|
|
1200
|
+
}
|
|
1201
|
+
if ("o" in value) {
|
|
1202
|
+
const result = {};
|
|
1203
|
+
refs.set(value.id, result);
|
|
1204
|
+
for (const item of value.o) {
|
|
1205
|
+
if (item.k === "__proto__") continue;
|
|
1206
|
+
result[item.k] = deserializePlaywrightValue(item.v, handles, refs);
|
|
1207
|
+
}
|
|
1208
|
+
return result;
|
|
1209
|
+
}
|
|
1210
|
+
return value;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
function resolvePlaywrightLocator(target, args) {
|
|
1214
|
+
const [, options] = args;
|
|
1215
|
+
const selector = getPlaywrightSelector(options?.info?.parsed);
|
|
1216
|
+
const element = target.elements.get(selector);
|
|
1217
|
+
if (!element) return { log: "", success: false, element: null };
|
|
1218
|
+
|
|
1219
|
+
return {
|
|
1220
|
+
kind: "playwright-locator-result",
|
|
1221
|
+
log: `locator resolved to ${selector}`,
|
|
1222
|
+
success: true,
|
|
1223
|
+
element: {
|
|
1224
|
+
kind: "playwright-element",
|
|
1225
|
+
targetId: target.targetId,
|
|
1226
|
+
selector,
|
|
1227
|
+
element,
|
|
1228
|
+
},
|
|
1229
|
+
};
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
function shouldForwardPlaywrightEvaluate(expression, handles) {
|
|
1233
|
+
if (handles.some((handle) => handle?.kind?.startsWith("playwright-"))) {
|
|
1234
|
+
return false;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
const source = expression.trim();
|
|
1238
|
+
if (source === "() => document.title") return false;
|
|
1239
|
+
if (
|
|
1240
|
+
source.includes("querySelectorAll(info.parsed") ||
|
|
1241
|
+
source.includes("injected.previewNode") ||
|
|
1242
|
+
source.includes("injected.checkElementStates") ||
|
|
1243
|
+
source.includes("injected.setupHitTargetInterceptor") ||
|
|
1244
|
+
(source.includes("width: innerWidth") &&
|
|
1245
|
+
source.includes("height: innerHeight"))
|
|
1246
|
+
) {
|
|
1247
|
+
return false;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
return true;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
function getPlaywrightSelector(parsed) {
|
|
1254
|
+
if (typeof parsed === "string") return parsed;
|
|
1255
|
+
if (!parsed || typeof parsed !== "object") return null;
|
|
1256
|
+
if (typeof parsed.source === "string") return parsed.source;
|
|
1257
|
+
if (typeof parsed.body === "string") return parsed.body;
|
|
1258
|
+
|
|
1259
|
+
for (const value of Object.values(parsed)) {
|
|
1260
|
+
const selector = getPlaywrightSelector(value);
|
|
1261
|
+
if (selector) return selector;
|
|
1262
|
+
}
|
|
1263
|
+
return null;
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
function serializePlaywrightValue(value, seen = new Map()) {
|
|
1267
|
+
if (value === undefined) return { v: "undefined" };
|
|
1268
|
+
if (value === null) return { v: "null" };
|
|
1269
|
+
if (
|
|
1270
|
+
typeof value === "string" ||
|
|
1271
|
+
typeof value === "number" ||
|
|
1272
|
+
typeof value === "boolean"
|
|
1273
|
+
) {
|
|
1274
|
+
return value;
|
|
1275
|
+
}
|
|
1276
|
+
if (typeof value === "bigint") return { bi: value.toString() };
|
|
1277
|
+
|
|
1278
|
+
if (seen.has(value)) return { ref: seen.get(value) };
|
|
1279
|
+
const id = seen.size + 1;
|
|
1280
|
+
seen.set(value, id);
|
|
1281
|
+
|
|
1282
|
+
if (Array.isArray(value)) {
|
|
1283
|
+
return {
|
|
1284
|
+
a: value.map((item) => serializePlaywrightValue(item, seen)),
|
|
1285
|
+
id,
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
return {
|
|
1290
|
+
o: Object.entries(value).map(([key, item]) => ({
|
|
1291
|
+
k: key,
|
|
1292
|
+
v: serializePlaywrightValue(item, seen),
|
|
1293
|
+
})),
|
|
1294
|
+
id,
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
function createRemoteObject(state, value, returnByValue) {
|
|
1299
|
+
if (value === undefined) return { type: "undefined" };
|
|
1300
|
+
if (value === null) return { type: "object", subtype: "null", value: null };
|
|
1301
|
+
if (value?.kind === "playwright-element") {
|
|
1302
|
+
const objectId = `object-${state.nextObjectId++}`;
|
|
1303
|
+
state.objects.set(objectId, value);
|
|
1304
|
+
return {
|
|
1305
|
+
type: "object",
|
|
1306
|
+
subtype: "node",
|
|
1307
|
+
className: playwrightElementClassName(value.element?.tagName),
|
|
1308
|
+
description: playwrightElementDescription(value),
|
|
1309
|
+
objectId,
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
const type = typeof value;
|
|
1314
|
+
if (type === "string" || type === "boolean") {
|
|
1315
|
+
return { type, value };
|
|
1316
|
+
}
|
|
1317
|
+
if (type === "number") {
|
|
1318
|
+
return Number.isFinite(value)
|
|
1319
|
+
? { type, value }
|
|
1320
|
+
: { type, unserializableValue: String(value) };
|
|
1321
|
+
}
|
|
1322
|
+
if (type === "bigint") {
|
|
1323
|
+
return { type, unserializableValue: `${value}n` };
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
if (returnByValue) {
|
|
1327
|
+
return {
|
|
1328
|
+
type: "object",
|
|
1329
|
+
value,
|
|
1330
|
+
description: Array.isArray(value) ? "Array" : "Object",
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
const objectId = `object-${state.nextObjectId++}`;
|
|
1335
|
+
state.objects.set(objectId, value);
|
|
1336
|
+
return {
|
|
1337
|
+
type: "object",
|
|
1338
|
+
className: "Object",
|
|
1339
|
+
description: "Object",
|
|
1340
|
+
objectId,
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
function playwrightElementClassName(tagName) {
|
|
1345
|
+
const names = {
|
|
1346
|
+
button: "HTMLButtonElement",
|
|
1347
|
+
input: "HTMLInputElement",
|
|
1348
|
+
textarea: "HTMLTextAreaElement",
|
|
1349
|
+
output: "HTMLOutputElement",
|
|
1350
|
+
};
|
|
1351
|
+
return names[tagName] ?? "HTMLElement";
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
function playwrightElementDescription(value) {
|
|
1355
|
+
const tagName = value.element?.tagName ?? "element";
|
|
1356
|
+
return `${tagName}#${value.selector.replace(/^#/, "")}`;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
function createLoggingContext() {
|
|
1360
|
+
const log = (method, payload = {}) => {
|
|
1361
|
+
|
|
1362
|
+
serverError(Bun.markdown.ansi(`## [CdpServer:context] ${method}`))
|
|
1363
|
+
serverError(payload);
|
|
1364
|
+
return { ok: true, method, payload };
|
|
1365
|
+
};
|
|
1366
|
+
|
|
1367
|
+
return {
|
|
1368
|
+
navigate(url) {
|
|
1369
|
+
return log("navigate", { url });
|
|
1370
|
+
},
|
|
1371
|
+
evaluate(script) {
|
|
1372
|
+
return log("evaluate", { script });
|
|
1373
|
+
},
|
|
1374
|
+
title() {
|
|
1375
|
+
log("title");
|
|
1376
|
+
return "";
|
|
1377
|
+
},
|
|
1378
|
+
click(selectorOrX, yOrOptions, options) {
|
|
1379
|
+
if (typeof selectorOrX === "string") {
|
|
1380
|
+
return log("click", { selector: selectorOrX, options: yOrOptions });
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
return log("click", { x: selectorOrX, y: yOrOptions, options });
|
|
1384
|
+
},
|
|
1385
|
+
type(text) {
|
|
1386
|
+
return log("type", { text });
|
|
1387
|
+
},
|
|
1388
|
+
press(key, options) {
|
|
1389
|
+
return log("press", { key, options });
|
|
1390
|
+
},
|
|
1391
|
+
scroll(dx, dy) {
|
|
1392
|
+
return log("scroll", { dx, dy });
|
|
1393
|
+
},
|
|
1394
|
+
scrollTo(selector, options) {
|
|
1395
|
+
return log("scrollTo", { selector, options });
|
|
1396
|
+
},
|
|
1397
|
+
resize(width, height) {
|
|
1398
|
+
return log("resize", { width, height });
|
|
1399
|
+
},
|
|
1400
|
+
goBack() {
|
|
1401
|
+
return log("goBack");
|
|
1402
|
+
},
|
|
1403
|
+
goForward() {
|
|
1404
|
+
return log("goForward");
|
|
1405
|
+
},
|
|
1406
|
+
reload() {
|
|
1407
|
+
return log("reload");
|
|
1408
|
+
},
|
|
1409
|
+
screenshot(options) {
|
|
1410
|
+
return log("screenshot", { options });
|
|
1411
|
+
},
|
|
1412
|
+
cdp(method, params) {
|
|
1413
|
+
return log("cdp", { method, params });
|
|
1414
|
+
},
|
|
1415
|
+
close() {
|
|
1416
|
+
return log("close");
|
|
1417
|
+
},
|
|
1418
|
+
};
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
if (import.meta.main) {
|
|
1422
|
+
const port = Number(Bun.argv[2] ?? CDP_DEFAULT_PORT);
|
|
1423
|
+
CdpServer.create(createLoggingContext()).listen(port);
|
|
1424
|
+
}
|