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,1471 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JavaScript environment of one document.
|
|
3
|
+
*
|
|
4
|
+
* In the default mode page scripts run in an SES Compartment whose global
|
|
5
|
+
* object holds only DOM bindings and a curated set of Web APIs; the renderer
|
|
6
|
+
* process must have called lockdown() first. With
|
|
7
|
+
* --dangerously-allow-host-js ("host" mode) scripts run in the renderer's own
|
|
8
|
+
* global scope instead, with full access to Bun.
|
|
9
|
+
*
|
|
10
|
+
* Scripts, timer callbacks and event listeners each run as a task. Errors in
|
|
11
|
+
* a task are reported and never escape; after every task `afterTask()` lets
|
|
12
|
+
* the renderer schedule style, layout and paint.
|
|
13
|
+
*/
|
|
14
|
+
import {
|
|
15
|
+
BindingRealm, defineEventHandlerProperty, eventConstructors, hardenBindings, INTERFACES, nodeOf, windowEventMethods,
|
|
16
|
+
} from "./bindings.js";
|
|
17
|
+
import { resolveModuleSpecifier, transformModule } from "./module-transform.js";
|
|
18
|
+
import { CONSTRUCTOR_HELPER, rewriteClassicScript, rewriteConstructorReads } from "./script-rewrite.js";
|
|
19
|
+
import { mediaQueryMatches } from "../style/computed-style.js";
|
|
20
|
+
|
|
21
|
+
// Captured at load, before host mode can install page globals over them.
|
|
22
|
+
const hostSetTimeout = globalThis.setTimeout;
|
|
23
|
+
const hostClearTimeout = globalThis.clearTimeout;
|
|
24
|
+
const hostQueueMicrotask = globalThis.queueMicrotask;
|
|
25
|
+
const hostPerformance = globalThis.performance;
|
|
26
|
+
const hostCrypto = globalThis.crypto;
|
|
27
|
+
const hostStructuredClone = globalThis.structuredClone;
|
|
28
|
+
const hostAtob = globalThis.atob;
|
|
29
|
+
const hostBtoa = globalThis.btoa;
|
|
30
|
+
|
|
31
|
+
const CLASSIC_SCRIPT_TYPES = new Set([
|
|
32
|
+
"", "text/javascript", "application/javascript", "text/ecmascript", "application/ecmascript",
|
|
33
|
+
"application/x-javascript", "text/jscript", "text/livescript",
|
|
34
|
+
]);
|
|
35
|
+
const INLINE_HANDLER_EVENTS = [
|
|
36
|
+
"click", "dblclick", "mousedown", "mouseup", "input", "change", "submit", "keydown", "keyup",
|
|
37
|
+
"keypress", "beforeinput", "focus", "blur", "load",
|
|
38
|
+
];
|
|
39
|
+
const MAX_CONSOLE_ENTRIES = 500;
|
|
40
|
+
// Element interfaces recognised by instanceof, by tag name.
|
|
41
|
+
const ELEMENT_INTERFACES = Object.freeze({
|
|
42
|
+
HTMLAnchorElement: ["A"], HTMLAreaElement: ["AREA"], HTMLAudioElement: ["AUDIO"], HTMLBRElement: ["BR"],
|
|
43
|
+
HTMLBaseElement: ["BASE"], HTMLBodyElement: ["BODY"], HTMLButtonElement: ["BUTTON"], HTMLCanvasElement: ["CANVAS"],
|
|
44
|
+
HTMLDListElement: ["DL"], HTMLDetailsElement: ["DETAILS"], HTMLDialogElement: ["DIALOG"], HTMLDivElement: ["DIV"],
|
|
45
|
+
HTMLEmbedElement: ["EMBED"], HTMLFieldSetElement: ["FIELDSET"], HTMLFormElement: ["FORM"], HTMLHRElement: ["HR"],
|
|
46
|
+
HTMLHeadElement: ["HEAD"], HTMLHeadingElement: ["H1", "H2", "H3", "H4", "H5", "H6"], HTMLHtmlElement: ["HTML"],
|
|
47
|
+
HTMLIFrameElement: ["IFRAME"], HTMLImageElement: ["IMG"], HTMLInputElement: ["INPUT"], HTMLLIElement: ["LI"],
|
|
48
|
+
HTMLLabelElement: ["LABEL"], HTMLLegendElement: ["LEGEND"], HTMLLinkElement: ["LINK"], HTMLMapElement: ["MAP"],
|
|
49
|
+
HTMLMediaElement: ["AUDIO", "VIDEO"], HTMLMetaElement: ["META"], HTMLMeterElement: ["METER"],
|
|
50
|
+
HTMLOListElement: ["OL"], HTMLObjectElement: ["OBJECT"], HTMLOptGroupElement: ["OPTGROUP"], HTMLOptionElement: ["OPTION"],
|
|
51
|
+
HTMLOutputElement: ["OUTPUT"], HTMLParagraphElement: ["P"], HTMLPictureElement: ["PICTURE"], HTMLPreElement: ["PRE"],
|
|
52
|
+
HTMLProgressElement: ["PROGRESS"], HTMLQuoteElement: ["BLOCKQUOTE", "Q"], HTMLScriptElement: ["SCRIPT"],
|
|
53
|
+
HTMLSelectElement: ["SELECT"], HTMLSlotElement: ["SLOT"], HTMLSourceElement: ["SOURCE"], HTMLSpanElement: ["SPAN"],
|
|
54
|
+
HTMLStyleElement: ["STYLE"], HTMLTableCellElement: ["TD", "TH"], HTMLTableElement: ["TABLE"], HTMLTableRowElement: ["TR"],
|
|
55
|
+
HTMLTableSectionElement: ["THEAD", "TBODY", "TFOOT"], HTMLTemplateElement: ["TEMPLATE"], HTMLTextAreaElement: ["TEXTAREA"],
|
|
56
|
+
HTMLTimeElement: ["TIME"], HTMLTitleElement: ["TITLE"], HTMLTrackElement: ["TRACK"], HTMLUListElement: ["UL"],
|
|
57
|
+
HTMLVideoElement: ["VIDEO"],
|
|
58
|
+
});
|
|
59
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
60
|
+
const LIFECYCLE_EVENT_TYPES = new Set(["load", "DOMContentLoaded", "readystatechange"]);
|
|
61
|
+
// window.on* handler properties (window.onerror has a different signature and is not modelled).
|
|
62
|
+
const WINDOW_HANDLER_EVENTS = [
|
|
63
|
+
"load", "resize", "scroll", "keydown", "keyup", "keypress", "click", "message", "hashchange",
|
|
64
|
+
"popstate", "beforeunload", "unload", "focus", "blur", "online", "offline",
|
|
65
|
+
];
|
|
66
|
+
const hostStorage = new Map();
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @param {{
|
|
70
|
+
* window: object, document: object, mode: "ses" | "host",
|
|
71
|
+
* hooks: {
|
|
72
|
+
* touch(): void, afterTask(): void,
|
|
73
|
+
* boundsOf(element: object): { left: number, top: number, width: number, height: number } | null,
|
|
74
|
+
* viewport(): { width: number, height: number, scrollX: number, scrollY: number, devicePixelRatio: number },
|
|
75
|
+
* scrollTo(x: number, y: number): void,
|
|
76
|
+
* computedStyle(element: object): object | null,
|
|
77
|
+
* navigate(url: string): void,
|
|
78
|
+
* fetchScript(url: string): Promise<string>,
|
|
79
|
+
* reportError(message: string): void,
|
|
80
|
+
* consoleMessage?: ((level: string, text: string) => void) | null,
|
|
81
|
+
* lifecycle?: (name: "DOMContentLoaded" | "load") => void,
|
|
82
|
+
* userAgent(): string,
|
|
83
|
+
* },
|
|
84
|
+
* }} options
|
|
85
|
+
*/
|
|
86
|
+
export function createPageRealm({ window, document, mode, hooks }) {
|
|
87
|
+
const timers = new Map();
|
|
88
|
+
// Close functions of this document's open WebSockets (see networkApi)
|
|
89
|
+
const openSockets = new Set();
|
|
90
|
+
// Happy DOM runs its own document lifecycle and fires load/DOMContentLoaded
|
|
91
|
+
// on its own schedule; only the lifecycle events this realm dispatches
|
|
92
|
+
// reach page listeners (see acceptEvent).
|
|
93
|
+
const lifecycleEvents = new WeakSet();
|
|
94
|
+
// Script elements created by page code run when they are inserted;
|
|
95
|
+
// parser-created and innerHTML-created ones never do (HTML "already started").
|
|
96
|
+
const createdScripts = new WeakSet();
|
|
97
|
+
const startedScripts = new WeakSet();
|
|
98
|
+
// Scripts inserted before the load event delay it, as in HTML.
|
|
99
|
+
const pendingLoads = new Set();
|
|
100
|
+
const consoleEntries = [];
|
|
101
|
+
let nextTimerId = 1;
|
|
102
|
+
let disposed = false;
|
|
103
|
+
let readyState = "loading";
|
|
104
|
+
let currentScript = null;
|
|
105
|
+
let pageGlobal = null;
|
|
106
|
+
let evaluate;
|
|
107
|
+
let evaluateModuleCode;
|
|
108
|
+
let importMap = null;
|
|
109
|
+
const modules = new Map();
|
|
110
|
+
let inlineModuleCount = 0;
|
|
111
|
+
|
|
112
|
+
const reportError = (error, source = currentScript?.src) => {
|
|
113
|
+
// SES "safe" error taming blanks .stack, so fall back to name and message.
|
|
114
|
+
const detail = error?.stack || (error?.name ? `${error.name}: ${error.message}` : String(error?.message ?? error));
|
|
115
|
+
const message = source ? `${source}: ${detail}` : detail;
|
|
116
|
+
consoleEntries.push({ level: "error", text: message });
|
|
117
|
+
hooks.reportError(message);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/** Runs page code as a task: errors are reported, then the renderer may update. */
|
|
121
|
+
const runTask = (task) => {
|
|
122
|
+
if (disposed) return undefined;
|
|
123
|
+
try {
|
|
124
|
+
return task();
|
|
125
|
+
} catch (error) {
|
|
126
|
+
reportError(error);
|
|
127
|
+
return undefined;
|
|
128
|
+
} finally {
|
|
129
|
+
hooks.afterTask();
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/** Calls a page function from the host (listeners, callbacks) without letting it throw out. */
|
|
134
|
+
const callPage = (fn, thisArg, args) => {
|
|
135
|
+
if (typeof fn !== "function") return undefined;
|
|
136
|
+
try {
|
|
137
|
+
return Reflect.apply(fn, thisArg, args);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
reportError(error);
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const realm = new BindingRealm(window, {
|
|
145
|
+
touch: hooks.touch,
|
|
146
|
+
boundsOf: hooks.boundsOf,
|
|
147
|
+
viewport: hooks.viewport,
|
|
148
|
+
scrollTo: hooks.scrollTo,
|
|
149
|
+
playVideo: hooks.playVideo,
|
|
150
|
+
pauseVideo: hooks.pauseVideo,
|
|
151
|
+
videoState: hooks.videoState,
|
|
152
|
+
call: callPage,
|
|
153
|
+
readyState: () => readyState,
|
|
154
|
+
documentCookie: () => hooks.documentCookie?.() ?? "",
|
|
155
|
+
setDocumentCookie: (value) => hooks.setDocumentCookie?.(value),
|
|
156
|
+
currentScript: () => currentScript,
|
|
157
|
+
pageGlobal: () => pageGlobal,
|
|
158
|
+
targetOf: (real) => real === window ? pageGlobal : null,
|
|
159
|
+
created: (element) => {
|
|
160
|
+
if (element.tagName === "SCRIPT") createdScripts.add(element);
|
|
161
|
+
},
|
|
162
|
+
inserted: (nodes) => startInsertedScripts(nodes),
|
|
163
|
+
acceptEvent: (event) => !LIFECYCLE_EVENT_TYPES.has(event.type)
|
|
164
|
+
|| (event.target !== window && event.target !== document)
|
|
165
|
+
|| lifecycleEvents.has(event),
|
|
166
|
+
});
|
|
167
|
+
const documentBinding = realm.wrap(document);
|
|
168
|
+
|
|
169
|
+
const fireLifecycle = (target, event) => {
|
|
170
|
+
lifecycleEvents.add(event);
|
|
171
|
+
target.dispatchEvent(event);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const schedule = (handler, delay, args, repeat) => {
|
|
175
|
+
const id = nextTimerId++;
|
|
176
|
+
const callback = typeof handler === "function"
|
|
177
|
+
? () => callPage(handler, pageGlobal, args)
|
|
178
|
+
: () => evaluate(String(handler), "timer");
|
|
179
|
+
const fire = () => {
|
|
180
|
+
if (!timers.has(id)) return;
|
|
181
|
+
if (repeat) timers.set(id, hostSetTimeout(fire, Math.max(4, delay)));
|
|
182
|
+
else timers.delete(id);
|
|
183
|
+
runTask(callback);
|
|
184
|
+
};
|
|
185
|
+
timers.set(id, hostSetTimeout(fire, Math.max(0, Number(delay) || 0)));
|
|
186
|
+
return id;
|
|
187
|
+
};
|
|
188
|
+
const cancel = (id) => {
|
|
189
|
+
const handle = timers.get(Number(id));
|
|
190
|
+
if (handle) hostClearTimeout(handle);
|
|
191
|
+
timers.delete(Number(id));
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const pageConsole = Object.fromEntries(["log", "info", "warn", "error", "debug", "trace"].map((level) => [
|
|
195
|
+
level,
|
|
196
|
+
(...args) => {
|
|
197
|
+
const text = args.map(formatConsoleValue).join(" ");
|
|
198
|
+
consoleEntries.push({ level, text });
|
|
199
|
+
if (consoleEntries.length > MAX_CONSOLE_ENTRIES) consoleEntries.shift();
|
|
200
|
+
hooks.consoleMessage?.(level, text);
|
|
201
|
+
},
|
|
202
|
+
]));
|
|
203
|
+
pageConsole.table = pageConsole.log;
|
|
204
|
+
pageConsole.dir = pageConsole.log;
|
|
205
|
+
pageConsole.group = pageConsole.log;
|
|
206
|
+
pageConsole.groupEnd = () => {};
|
|
207
|
+
pageConsole.assert = (condition, ...args) => {
|
|
208
|
+
if (!condition) pageConsole.error("Assertion failed:", ...args);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* MutationObserver wraps Happy DOM's implementation (records carry node
|
|
213
|
+
* wrappers); Resize- and IntersectionObserver report the current layout
|
|
214
|
+
* once per observed element, which is enough for common lazy-loading and
|
|
215
|
+
* sizing code in a headless viewport.
|
|
216
|
+
*/
|
|
217
|
+
function observerConstructors() {
|
|
218
|
+
function MutationObserver(callback) {
|
|
219
|
+
if (!new.target) throw new TypeError("Constructor MutationObserver requires 'new'");
|
|
220
|
+
const self = {};
|
|
221
|
+
const wrapRecord = (record) => ({
|
|
222
|
+
type: record.type,
|
|
223
|
+
target: realm.wrap(record.target),
|
|
224
|
+
addedNodes: realm.wrapAll(record.addedNodes),
|
|
225
|
+
removedNodes: realm.wrapAll(record.removedNodes),
|
|
226
|
+
previousSibling: realm.wrap(record.previousSibling),
|
|
227
|
+
nextSibling: realm.wrap(record.nextSibling),
|
|
228
|
+
attributeName: record.attributeName ?? null,
|
|
229
|
+
oldValue: record.oldValue ?? null,
|
|
230
|
+
});
|
|
231
|
+
const real = new window.MutationObserver((records) => {
|
|
232
|
+
runTask(() => callPage(callback, self, [records.map(wrapRecord), self]));
|
|
233
|
+
});
|
|
234
|
+
self.observe = (target, options = {}) => {
|
|
235
|
+
const node = nodeOf(target);
|
|
236
|
+
if (!node) throw new TypeError("MutationObserver.observe requires a Node");
|
|
237
|
+
real.observe(node, {
|
|
238
|
+
childList: Boolean(options.childList),
|
|
239
|
+
attributes: Boolean(options.attributes ?? options.attributeFilter ?? options.attributeOldValue),
|
|
240
|
+
characterData: Boolean(options.characterData ?? options.characterDataOldValue),
|
|
241
|
+
subtree: Boolean(options.subtree),
|
|
242
|
+
attributeOldValue: Boolean(options.attributeOldValue),
|
|
243
|
+
characterDataOldValue: Boolean(options.characterDataOldValue),
|
|
244
|
+
...(Array.isArray(options.attributeFilter) ? { attributeFilter: options.attributeFilter.map(String) } : {}),
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
self.disconnect = () => real.disconnect();
|
|
248
|
+
self.takeRecords = () => real.takeRecords().map(wrapRecord);
|
|
249
|
+
return self;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const layoutObserver = (name, entryFor) => function Observer(callback) {
|
|
253
|
+
if (!new.target) throw new TypeError(`Constructor ${name} requires 'new'`);
|
|
254
|
+
const self = {};
|
|
255
|
+
const observed = new Set();
|
|
256
|
+
self.observe = (target) => {
|
|
257
|
+
const node = nodeOf(target);
|
|
258
|
+
if (!node || observed.has(node)) return;
|
|
259
|
+
observed.add(node);
|
|
260
|
+
schedule(() => {
|
|
261
|
+
if (!observed.has(node)) return;
|
|
262
|
+
const rect = hooks.boundsOf(node) ?? { left: 0, top: 0, width: 0, height: 0 };
|
|
263
|
+
callPage(callback, self, [[entryFor(target, rect)], self]);
|
|
264
|
+
}, 0, [], false);
|
|
265
|
+
};
|
|
266
|
+
self.unobserve = (target) => observed.delete(nodeOf(target));
|
|
267
|
+
self.disconnect = () => observed.clear();
|
|
268
|
+
self.takeRecords = () => [];
|
|
269
|
+
return self;
|
|
270
|
+
};
|
|
271
|
+
const rectangle = ({ left, top, width, height }) => ({
|
|
272
|
+
x: left, y: top, left, top, width, height, right: left + width, bottom: top + height,
|
|
273
|
+
});
|
|
274
|
+
const ResizeObserver = layoutObserver("ResizeObserver", (target, rect) => ({
|
|
275
|
+
target,
|
|
276
|
+
contentRect: rectangle({ ...rect, left: 0, top: 0 }),
|
|
277
|
+
borderBoxSize: [{ inlineSize: rect.width, blockSize: rect.height }],
|
|
278
|
+
contentBoxSize: [{ inlineSize: rect.width, blockSize: rect.height }],
|
|
279
|
+
}));
|
|
280
|
+
const IntersectionObserver = layoutObserver("IntersectionObserver", (target, rect) => {
|
|
281
|
+
const { width, height } = hooks.viewport();
|
|
282
|
+
const visible = rect.top < height && rect.top + rect.height > 0 && rect.left < width && rect.left + rect.width > 0;
|
|
283
|
+
return {
|
|
284
|
+
target,
|
|
285
|
+
time: hostPerformance.now(),
|
|
286
|
+
isIntersecting: visible,
|
|
287
|
+
intersectionRatio: visible ? 1 : 0,
|
|
288
|
+
boundingClientRect: rectangle(rect),
|
|
289
|
+
intersectionRect: rectangle(visible ? rect : { left: 0, top: 0, width: 0, height: 0 }),
|
|
290
|
+
rootBounds: rectangle({ left: 0, top: 0, width, height }),
|
|
291
|
+
};
|
|
292
|
+
});
|
|
293
|
+
return { MutationObserver, ResizeObserver, IntersectionObserver };
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* fetch() and XMLHttpRequest. Requests are described as plain data and
|
|
298
|
+
* sent through the controller (cookies, CORS, redirects); data: and blob:
|
|
299
|
+
* URLs are read locally. Bodies are normalised with Bun's Response, which
|
|
300
|
+
* also yields the right Content-Type (multipart boundaries included).
|
|
301
|
+
*/
|
|
302
|
+
function networkApi() {
|
|
303
|
+
const abortError = () => new DOMException("The operation was aborted.", "AbortError");
|
|
304
|
+
|
|
305
|
+
async function describeRequest(input, init = {}) {
|
|
306
|
+
const source = input instanceof Request ? input : null;
|
|
307
|
+
const url = new URL(source ? source.url : String(input), document.URL);
|
|
308
|
+
const method = String(init.method ?? source?.method ?? "GET").toUpperCase();
|
|
309
|
+
const headers = new Headers(init.headers ?? source?.headers ?? undefined);
|
|
310
|
+
let body = null;
|
|
311
|
+
const bodyInit = init.body !== undefined ? init.body : source && !["GET", "HEAD"].includes(method)
|
|
312
|
+
? await source.clone().arrayBuffer() : null;
|
|
313
|
+
if (bodyInit !== null && bodyInit !== undefined) {
|
|
314
|
+
if (["GET", "HEAD"].includes(method)) throw new TypeError("Request with GET/HEAD method cannot have body.");
|
|
315
|
+
const normalized = new Response(bodyInit);
|
|
316
|
+
// Read the derived Content-Type before consuming the body: after
|
|
317
|
+
// lockdown, Bun no longer reports it once the body has been read.
|
|
318
|
+
const type = normalized.headers.get("content-type")
|
|
319
|
+
?? (typeof bodyInit === "string" ? "text/plain;charset=UTF-8" : null);
|
|
320
|
+
body = new Uint8Array(await normalized.arrayBuffer());
|
|
321
|
+
if (type && !headers.has("content-type")) headers.set("content-type", type);
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
url: url.href,
|
|
325
|
+
method,
|
|
326
|
+
headers: [...headers],
|
|
327
|
+
body,
|
|
328
|
+
mode: init.mode ?? source?.mode ?? "cors",
|
|
329
|
+
credentials: init.credentials ?? source?.credentials ?? "same-origin",
|
|
330
|
+
redirect: init.redirect ?? source?.redirect ?? "follow",
|
|
331
|
+
signal: init.signal ?? source?.signal ?? null,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function makeResponse(data) {
|
|
336
|
+
const bytes = data.body instanceof Uint8Array ? data.body : new Uint8Array(0);
|
|
337
|
+
const headers = new Headers(data.headers ?? []);
|
|
338
|
+
let used = false;
|
|
339
|
+
const read = () => {
|
|
340
|
+
if (used) return Promise.reject(new TypeError("Body has already been used"));
|
|
341
|
+
used = true;
|
|
342
|
+
return Promise.resolve(new Response(bytes, { headers: { "content-type": headers.get("content-type") ?? "" } }));
|
|
343
|
+
};
|
|
344
|
+
const response = {
|
|
345
|
+
type: data.type ?? "basic",
|
|
346
|
+
url: data.url ?? "",
|
|
347
|
+
redirected: Boolean(data.redirected),
|
|
348
|
+
status: data.status ?? 200,
|
|
349
|
+
ok: (data.status ?? 200) >= 200 && (data.status ?? 200) <= 299,
|
|
350
|
+
statusText: data.statusText ?? "",
|
|
351
|
+
headers,
|
|
352
|
+
get bodyUsed() {
|
|
353
|
+
return used;
|
|
354
|
+
},
|
|
355
|
+
get body() {
|
|
356
|
+
return used ? null : new Response(bytes).body;
|
|
357
|
+
},
|
|
358
|
+
text: () => read().then((body) => body.text()),
|
|
359
|
+
json: () => read().then((body) => body.json()),
|
|
360
|
+
arrayBuffer: () => read().then((body) => body.arrayBuffer()),
|
|
361
|
+
blob: () => read().then((body) => body.blob()),
|
|
362
|
+
formData: () => read().then((body) => body.formData()),
|
|
363
|
+
bytes: () => read().then((body) => body.bytes()),
|
|
364
|
+
clone: () => {
|
|
365
|
+
if (used) throw new TypeError("Body has already been used");
|
|
366
|
+
return makeResponse(data);
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
return response;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
async function pageFetch(input, init = {}) {
|
|
373
|
+
const request = await describeRequest(input, init ?? {});
|
|
374
|
+
const signal = request.signal;
|
|
375
|
+
if (signal?.aborted) throw abortError();
|
|
376
|
+
const scheme = new URL(request.url).protocol;
|
|
377
|
+
let pending;
|
|
378
|
+
if (scheme === "data:" || scheme === "blob:") {
|
|
379
|
+
pending = fetch(request.url).then(async (local) => ({
|
|
380
|
+
type: "basic", url: request.url, status: local.status, statusText: local.statusText,
|
|
381
|
+
headers: [...local.headers], body: new Uint8Array(await local.arrayBuffer()),
|
|
382
|
+
}));
|
|
383
|
+
} else {
|
|
384
|
+
const { signal: _signal, ...plain } = request;
|
|
385
|
+
// Network and CORS failures reach the page as a bare TypeError, as in
|
|
386
|
+
// browsers; the reason is only logged to the console.
|
|
387
|
+
pending = hooks.pageFetch(plain).catch((error) => {
|
|
388
|
+
const text = `fetch ${plain.url}: ${error?.message ?? error}`;
|
|
389
|
+
consoleEntries.push({ level: "error", text });
|
|
390
|
+
hooks.consoleMessage?.("error", text);
|
|
391
|
+
throw new TypeError("Failed to fetch");
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
const aborted = signal
|
|
395
|
+
? new Promise((_, reject) => signal.addEventListener("abort", () => reject(abortError()), { once: true }))
|
|
396
|
+
: null;
|
|
397
|
+
const data = await (aborted ? Promise.race([pending, aborted]) : pending);
|
|
398
|
+
hooks.afterTask();
|
|
399
|
+
return makeResponse(data);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function XMLHttpRequest() {
|
|
403
|
+
if (!new.target) throw new TypeError("Constructor XMLHttpRequest requires 'new'");
|
|
404
|
+
const listeners = new Map();
|
|
405
|
+
const requestHeaders = new Headers();
|
|
406
|
+
let method = "GET";
|
|
407
|
+
let url = null;
|
|
408
|
+
let response = null;
|
|
409
|
+
let controller = null;
|
|
410
|
+
let timer = null;
|
|
411
|
+
const xhr = {
|
|
412
|
+
UNSENT: 0, OPENED: 1, HEADERS_RECEIVED: 2, LOADING: 3, DONE: 4,
|
|
413
|
+
readyState: 0,
|
|
414
|
+
status: 0,
|
|
415
|
+
statusText: "",
|
|
416
|
+
responseURL: "",
|
|
417
|
+
responseType: "",
|
|
418
|
+
response: null,
|
|
419
|
+
responseText: "",
|
|
420
|
+
responseXML: null,
|
|
421
|
+
timeout: 0,
|
|
422
|
+
withCredentials: false,
|
|
423
|
+
upload: { addEventListener: () => {}, removeEventListener: () => {} },
|
|
424
|
+
open(requestMethod, requestUrl, async = true) {
|
|
425
|
+
if (async === false) {
|
|
426
|
+
throw new DOMException("Synchronous XMLHttpRequest is not supported", "InvalidAccessError");
|
|
427
|
+
}
|
|
428
|
+
method = String(requestMethod).toUpperCase();
|
|
429
|
+
url = new URL(String(requestUrl), document.URL).href;
|
|
430
|
+
setState(1);
|
|
431
|
+
},
|
|
432
|
+
setRequestHeader(name, value) {
|
|
433
|
+
requestHeaders.append(String(name), String(value));
|
|
434
|
+
},
|
|
435
|
+
getResponseHeader(name) {
|
|
436
|
+
return response?.headers.get(String(name)) ?? null;
|
|
437
|
+
},
|
|
438
|
+
getAllResponseHeaders() {
|
|
439
|
+
if (!response) return "";
|
|
440
|
+
return [...response.headers].map(([name, value]) => `${name}: ${value}\r\n`).join("");
|
|
441
|
+
},
|
|
442
|
+
overrideMimeType() {},
|
|
443
|
+
abort() {
|
|
444
|
+
controller?.abort();
|
|
445
|
+
},
|
|
446
|
+
send(body = null) {
|
|
447
|
+
if (xhr.readyState !== 1) throw new DOMException("The object's state must be OPENED.", "InvalidStateError");
|
|
448
|
+
controller = new AbortController();
|
|
449
|
+
if (xhr.timeout > 0) timer = schedule(() => controller.abort(), xhr.timeout, [], false);
|
|
450
|
+
fire("loadstart");
|
|
451
|
+
pageFetch(url, {
|
|
452
|
+
method,
|
|
453
|
+
headers: requestHeaders,
|
|
454
|
+
body: ["GET", "HEAD"].includes(method) ? null : body,
|
|
455
|
+
credentials: xhr.withCredentials ? "include" : "same-origin",
|
|
456
|
+
signal: controller.signal,
|
|
457
|
+
}).then(async (result) => {
|
|
458
|
+
response = result;
|
|
459
|
+
xhr.status = result.status;
|
|
460
|
+
xhr.statusText = result.statusText;
|
|
461
|
+
xhr.responseURL = result.url;
|
|
462
|
+
setState(2);
|
|
463
|
+
setState(3);
|
|
464
|
+
const bytes = await result.arrayBuffer();
|
|
465
|
+
const text = new TextDecoder().decode(bytes);
|
|
466
|
+
xhr.responseText = ["", "text"].includes(xhr.responseType) ? text : "";
|
|
467
|
+
xhr.response = xhr.responseType === "json" ? safeJson(text)
|
|
468
|
+
: xhr.responseType === "arraybuffer" ? bytes
|
|
469
|
+
: xhr.responseType === "blob" ? new Blob([bytes], { type: result.headers.get("content-type") ?? "" })
|
|
470
|
+
: text;
|
|
471
|
+
setState(4);
|
|
472
|
+
fire("load");
|
|
473
|
+
fire("loadend");
|
|
474
|
+
}, (error) => {
|
|
475
|
+
xhr.status = 0;
|
|
476
|
+
setState(4);
|
|
477
|
+
fire(error?.name === "AbortError" ? (timer !== null && xhr.timeout > 0 ? "timeout" : "abort") : "error");
|
|
478
|
+
fire("loadend");
|
|
479
|
+
}).finally(() => {
|
|
480
|
+
if (timer !== null) cancel(timer);
|
|
481
|
+
});
|
|
482
|
+
},
|
|
483
|
+
addEventListener(type, listener) {
|
|
484
|
+
if (!listeners.has(type)) listeners.set(type, new Set());
|
|
485
|
+
listeners.get(type).add(listener);
|
|
486
|
+
},
|
|
487
|
+
removeEventListener(type, listener) {
|
|
488
|
+
listeners.get(type)?.delete(listener);
|
|
489
|
+
},
|
|
490
|
+
dispatchEvent() {
|
|
491
|
+
return true;
|
|
492
|
+
},
|
|
493
|
+
};
|
|
494
|
+
for (const type of ["readystatechange", "loadstart", "load", "loadend", "error", "abort", "timeout", "progress"]) {
|
|
495
|
+
xhr[`on${type}`] = null;
|
|
496
|
+
}
|
|
497
|
+
function setState(state) {
|
|
498
|
+
xhr.readyState = state;
|
|
499
|
+
fire("readystatechange");
|
|
500
|
+
}
|
|
501
|
+
function fire(type) {
|
|
502
|
+
const event = { type, target: xhr, currentTarget: xhr, loaded: 0, total: 0, lengthComputable: false };
|
|
503
|
+
runTask(() => {
|
|
504
|
+
if (typeof xhr[`on${type}`] === "function") callPage(xhr[`on${type}`], xhr, [event]);
|
|
505
|
+
for (const listener of listeners.get(type) ?? []) callPage(listener, xhr, [event]);
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
return xhr;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* WebSocket (WHATWG WebSockets): the connection is Bun's WebSocket in the
|
|
512
|
+
* controller (hooks.webSockets); this side keeps the state machine and
|
|
513
|
+
* fires the page's events.
|
|
514
|
+
*/
|
|
515
|
+
function WebSocket(url, protocols = []) {
|
|
516
|
+
if (!new.target) throw new TypeError("Constructor WebSocket requires 'new'");
|
|
517
|
+
let target;
|
|
518
|
+
try {
|
|
519
|
+
target = new URL(String(url), document.URL);
|
|
520
|
+
} catch {
|
|
521
|
+
throw new DOMException(`Failed to construct 'WebSocket': The URL '${url}' is invalid.`, "SyntaxError");
|
|
522
|
+
}
|
|
523
|
+
if (target.protocol === "http:") target.protocol = "ws:";
|
|
524
|
+
else if (target.protocol === "https:") target.protocol = "wss:";
|
|
525
|
+
if (!["ws:", "wss:"].includes(target.protocol) || target.hash) {
|
|
526
|
+
throw new DOMException(`Failed to construct 'WebSocket': The URL '${target.href}' is invalid.`, "SyntaxError");
|
|
527
|
+
}
|
|
528
|
+
const list = typeof protocols === "string" ? [protocols] : [...protocols].map(String);
|
|
529
|
+
if (new Set(list).size !== list.length || list.some((name) => !/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/.test(name))) {
|
|
530
|
+
throw new DOMException("Failed to construct 'WebSocket': The subprotocol is invalid.", "SyntaxError");
|
|
531
|
+
}
|
|
532
|
+
const listeners = new Map();
|
|
533
|
+
let id = null;
|
|
534
|
+
let sending = Promise.resolve();
|
|
535
|
+
const socket = Object.create(WebSocket.prototype);
|
|
536
|
+
Object.assign(socket, {
|
|
537
|
+
CONNECTING: 0, OPEN: 1, CLOSING: 2, CLOSED: 3,
|
|
538
|
+
url: target.href,
|
|
539
|
+
readyState: 0,
|
|
540
|
+
protocol: "",
|
|
541
|
+
extensions: "",
|
|
542
|
+
bufferedAmount: 0,
|
|
543
|
+
binaryType: "blob",
|
|
544
|
+
onopen: null, onmessage: null, onerror: null, onclose: null,
|
|
545
|
+
send(data) {
|
|
546
|
+
if (socket.readyState === 0) throw new DOMException("Still in CONNECTING state.", "InvalidStateError");
|
|
547
|
+
if (socket.readyState !== 1) return;
|
|
548
|
+
if (typeof data === "string") {
|
|
549
|
+
sending = sending.then(() => hooks.webSockets.send(id, data));
|
|
550
|
+
} else if (data instanceof Blob) {
|
|
551
|
+
sending = sending.then(async () => hooks.webSockets.send(id, new Uint8Array(await data.arrayBuffer())));
|
|
552
|
+
} else if (data instanceof ArrayBuffer || ArrayBuffer.isView(data)) {
|
|
553
|
+
const view = data instanceof ArrayBuffer ? new Uint8Array(data) : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
554
|
+
const copy = view.slice();
|
|
555
|
+
sending = sending.then(() => hooks.webSockets.send(id, copy));
|
|
556
|
+
} else {
|
|
557
|
+
const text = String(data);
|
|
558
|
+
sending = sending.then(() => hooks.webSockets.send(id, text));
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
close(code = undefined, reason = "") {
|
|
562
|
+
if (code !== undefined && code !== 1000 && !(code >= 3000 && code <= 4999)) {
|
|
563
|
+
throw new DOMException(`The close code must be either 1000, or between 3000 and 4999. ${code} is neither.`, "InvalidAccessError");
|
|
564
|
+
}
|
|
565
|
+
if (new TextEncoder().encode(String(reason)).byteLength > 123) {
|
|
566
|
+
throw new DOMException("The close reason must not be greater than 123 UTF-8 bytes.", "SyntaxError");
|
|
567
|
+
}
|
|
568
|
+
if (socket.readyState >= 2) return;
|
|
569
|
+
socket.readyState = 2;
|
|
570
|
+
sending.then(() => hooks.webSockets.close(id, code, String(reason)));
|
|
571
|
+
},
|
|
572
|
+
addEventListener(type, listener) {
|
|
573
|
+
if (typeof listener !== "function" && typeof listener?.handleEvent !== "function") return;
|
|
574
|
+
if (!listeners.has(type)) listeners.set(type, new Set());
|
|
575
|
+
listeners.get(type).add(listener);
|
|
576
|
+
},
|
|
577
|
+
removeEventListener(type, listener) {
|
|
578
|
+
listeners.get(type)?.delete(listener);
|
|
579
|
+
},
|
|
580
|
+
dispatchEvent(event) {
|
|
581
|
+
fire(event.type, event);
|
|
582
|
+
return true;
|
|
583
|
+
},
|
|
584
|
+
});
|
|
585
|
+
function fire(type, fields = {}) {
|
|
586
|
+
const event = { type, target: socket, currentTarget: socket, isTrusted: true, bubbles: false, cancelable: false,
|
|
587
|
+
defaultPrevented: false, timeStamp: performance.now(), preventDefault() {}, stopPropagation() {},
|
|
588
|
+
stopImmediatePropagation() {}, ...fields };
|
|
589
|
+
runTask(() => {
|
|
590
|
+
if (typeof socket[`on${type}`] === "function") callPage(socket[`on${type}`], socket, [event]);
|
|
591
|
+
for (const listener of [...(listeners.get(type) ?? [])]) {
|
|
592
|
+
if (typeof listener === "function") callPage(listener, socket, [event]);
|
|
593
|
+
else callPage(listener.handleEvent, listener, [event]);
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
function onEvent(message) {
|
|
598
|
+
if (disposed) return;
|
|
599
|
+
if (message.event === "open" && socket.readyState === 0) {
|
|
600
|
+
socket.readyState = 1;
|
|
601
|
+
socket.protocol = String(message.protocol ?? "");
|
|
602
|
+
socket.extensions = String(message.extensions ?? "");
|
|
603
|
+
fire("open");
|
|
604
|
+
} else if (message.event === "message" && socket.readyState === 1) {
|
|
605
|
+
const { data } = message;
|
|
606
|
+
const value = typeof data === "string" ? data
|
|
607
|
+
: socket.binaryType === "arraybuffer" ? data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength)
|
|
608
|
+
: new Blob([data]);
|
|
609
|
+
fire("message", { data: value, origin: target.origin, lastEventId: "", source: null, ports: [] });
|
|
610
|
+
} else if (message.event === "error") {
|
|
611
|
+
fire("error");
|
|
612
|
+
} else if (message.event === "close") {
|
|
613
|
+
socket.readyState = 3;
|
|
614
|
+
openSockets.delete(close);
|
|
615
|
+
fire("close", { code: Number(message.code) || 1006, reason: String(message.reason ?? ""), wasClean: Boolean(message.wasClean) });
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
const close = () => {
|
|
619
|
+
if (socket.readyState < 2 && id !== null) hooks.webSockets.close(id, 1001, "");
|
|
620
|
+
};
|
|
621
|
+
if (!hooks.webSockets) {
|
|
622
|
+
// No network: fail like an unreachable server.
|
|
623
|
+
hostSetTimeout(() => onEvent({ event: "error" }) ?? onEvent({ event: "close", code: 1006 }), 0);
|
|
624
|
+
} else {
|
|
625
|
+
id = hooks.webSockets.open(target.href, list, onEvent);
|
|
626
|
+
openSockets.add(close);
|
|
627
|
+
}
|
|
628
|
+
return socket;
|
|
629
|
+
}
|
|
630
|
+
Object.assign(WebSocket, { CONNECTING: 0, OPEN: 1, CLOSING: 2, CLOSED: 3 });
|
|
631
|
+
|
|
632
|
+
XMLHttpRequest.UNSENT = 0;
|
|
633
|
+
XMLHttpRequest.OPENED = 1;
|
|
634
|
+
XMLHttpRequest.HEADERS_RECEIVED = 2;
|
|
635
|
+
XMLHttpRequest.LOADING = 3;
|
|
636
|
+
XMLHttpRequest.DONE = 4;
|
|
637
|
+
|
|
638
|
+
return {
|
|
639
|
+
fetch: pageFetch,
|
|
640
|
+
XMLHttpRequest,
|
|
641
|
+
WebSocket,
|
|
642
|
+
Headers,
|
|
643
|
+
Request,
|
|
644
|
+
Response,
|
|
645
|
+
AbortController,
|
|
646
|
+
AbortSignal,
|
|
647
|
+
FormData,
|
|
648
|
+
Blob,
|
|
649
|
+
File,
|
|
650
|
+
DOMException,
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Interface objects that exist for `instanceof` and feature checks. Each
|
|
656
|
+
* is an illegal constructor whose Symbol.hasInstance tests the real node.
|
|
657
|
+
*/
|
|
658
|
+
function typeCheckInterfaces() {
|
|
659
|
+
const make = (name, test) => {
|
|
660
|
+
const Interface = function () {
|
|
661
|
+
throw new TypeError("Illegal constructor");
|
|
662
|
+
};
|
|
663
|
+
Object.defineProperty(Interface, "name", { value: name });
|
|
664
|
+
Object.defineProperty(Interface, Symbol.hasInstance, {
|
|
665
|
+
value: (value) => {
|
|
666
|
+
if (value === pageGlobal) return name === "Window" || name === "EventTarget";
|
|
667
|
+
const node = nodeOf(value);
|
|
668
|
+
return Boolean(node) && test(node);
|
|
669
|
+
},
|
|
670
|
+
});
|
|
671
|
+
return Interface;
|
|
672
|
+
};
|
|
673
|
+
const interfaces = {
|
|
674
|
+
Window: make("Window", () => false),
|
|
675
|
+
EventTarget: make("EventTarget", () => true),
|
|
676
|
+
Comment: make("Comment", (node) => node.nodeType === 8),
|
|
677
|
+
DocumentType: make("DocumentType", (node) => node.nodeType === 10),
|
|
678
|
+
ShadowRoot: make("ShadowRoot", () => false),
|
|
679
|
+
SVGElement: make("SVGElement", (node) => node.namespaceURI === SVG_NAMESPACE),
|
|
680
|
+
SVGSVGElement: make("SVGSVGElement", (node) => node.namespaceURI === SVG_NAMESPACE && node.localName === "svg"),
|
|
681
|
+
HTMLUnknownElement: make("HTMLUnknownElement", () => false),
|
|
682
|
+
};
|
|
683
|
+
for (const [name, tags] of Object.entries(ELEMENT_INTERFACES)) {
|
|
684
|
+
interfaces[name] = make(name, (node) => node.nodeType === 1 && tags.includes(node.tagName));
|
|
685
|
+
}
|
|
686
|
+
return interfaces;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
const origin = safeOrigin(document.URL);
|
|
690
|
+
if (!hostStorage.has(origin)) hostStorage.set(origin, new Map());
|
|
691
|
+
|
|
692
|
+
const viewportValue = (key) => () => hooks.viewport()[key];
|
|
693
|
+
const { location, setHref } = locationBinding(document.URL, hooks.navigate);
|
|
694
|
+
const { History, history } = historyBinding(location, setHref);
|
|
695
|
+
const { Event, CustomEvent, ...uiEvents } = eventConstructors(realm);
|
|
696
|
+
const observers = observerConstructors();
|
|
697
|
+
const network = networkApi();
|
|
698
|
+
const windowEvents = windowEventMethods(realm, null);
|
|
699
|
+
|
|
700
|
+
/** Web APIs placed on the page's global object (bindings plus hardened host utilities). */
|
|
701
|
+
const api = {
|
|
702
|
+
document: documentBinding,
|
|
703
|
+
location,
|
|
704
|
+
navigator: {
|
|
705
|
+
userAgent: hooks.userAgent(),
|
|
706
|
+
language: "en-US",
|
|
707
|
+
languages: ["en-US"],
|
|
708
|
+
platform: "Linux",
|
|
709
|
+
onLine: true,
|
|
710
|
+
cookieEnabled: false,
|
|
711
|
+
webdriver: false,
|
|
712
|
+
hardwareConcurrency: 1,
|
|
713
|
+
maxTouchPoints: 0,
|
|
714
|
+
sendBeacon: (url, data) => {
|
|
715
|
+
network.fetch(url, { method: "POST", body: data, mode: "no-cors", credentials: "include", keepalive: true })
|
|
716
|
+
.catch(() => {});
|
|
717
|
+
return true;
|
|
718
|
+
},
|
|
719
|
+
},
|
|
720
|
+
History,
|
|
721
|
+
history,
|
|
722
|
+
screen: {
|
|
723
|
+
get width() {
|
|
724
|
+
return hooks.viewport().width;
|
|
725
|
+
},
|
|
726
|
+
get height() {
|
|
727
|
+
return hooks.viewport().height;
|
|
728
|
+
},
|
|
729
|
+
colorDepth: 24,
|
|
730
|
+
pixelDepth: 24,
|
|
731
|
+
},
|
|
732
|
+
// No pinch zoom; `scale` is the --mobile scale-up (client CSS pixels per page CSS pixel).
|
|
733
|
+
visualViewport: {
|
|
734
|
+
offsetLeft: 0,
|
|
735
|
+
offsetTop: 0,
|
|
736
|
+
get pageLeft() {
|
|
737
|
+
return hooks.viewport().scrollX;
|
|
738
|
+
},
|
|
739
|
+
get pageTop() {
|
|
740
|
+
return hooks.viewport().scrollY;
|
|
741
|
+
},
|
|
742
|
+
get width() {
|
|
743
|
+
return hooks.viewport().width;
|
|
744
|
+
},
|
|
745
|
+
get height() {
|
|
746
|
+
return hooks.viewport().height;
|
|
747
|
+
},
|
|
748
|
+
get scale() {
|
|
749
|
+
return hooks.viewport().pageScale ?? 1;
|
|
750
|
+
},
|
|
751
|
+
addEventListener: () => {},
|
|
752
|
+
removeEventListener: () => {},
|
|
753
|
+
},
|
|
754
|
+
localStorage: storageBinding(hostStorage.get(origin)),
|
|
755
|
+
sessionStorage: storageBinding(new Map()),
|
|
756
|
+
console: pageConsole,
|
|
757
|
+
setTimeout: (handler, delay = 0, ...args) => schedule(handler, delay, args, false),
|
|
758
|
+
setInterval: (handler, delay = 0, ...args) => schedule(handler, delay, args, true),
|
|
759
|
+
clearTimeout: cancel,
|
|
760
|
+
clearInterval: cancel,
|
|
761
|
+
requestAnimationFrame: (callback) => schedule(() => callPage(callback, pageGlobal, [hostPerformance.now()]), 16, [], false),
|
|
762
|
+
cancelAnimationFrame: cancel,
|
|
763
|
+
requestIdleCallback: (callback) => schedule(
|
|
764
|
+
() => callPage(callback, pageGlobal, [{ didTimeout: false, timeRemaining: () => 10 }]), 1, [], false),
|
|
765
|
+
cancelIdleCallback: cancel,
|
|
766
|
+
queueMicrotask: (callback) => hostQueueMicrotask(() => runTask(() => callPage(callback, pageGlobal, []))),
|
|
767
|
+
structuredClone: (value) => hostStructuredClone(value),
|
|
768
|
+
atob: (value) => hostAtob(String(value)),
|
|
769
|
+
btoa: (value) => hostBtoa(String(value)),
|
|
770
|
+
TextEncoder,
|
|
771
|
+
TextDecoder,
|
|
772
|
+
URL,
|
|
773
|
+
URLSearchParams,
|
|
774
|
+
performance: {
|
|
775
|
+
now: () => hostPerformance.now(),
|
|
776
|
+
timeOrigin: hostPerformance.timeOrigin,
|
|
777
|
+
mark: () => {},
|
|
778
|
+
measure: () => {},
|
|
779
|
+
getEntriesByType: () => [],
|
|
780
|
+
getEntriesByName: () => [],
|
|
781
|
+
},
|
|
782
|
+
crypto: {
|
|
783
|
+
getRandomValues: (array) => hostCrypto.getRandomValues(array),
|
|
784
|
+
randomUUID: () => hostCrypto.randomUUID(),
|
|
785
|
+
},
|
|
786
|
+
Event,
|
|
787
|
+
CustomEvent,
|
|
788
|
+
...uiEvents,
|
|
789
|
+
...observers,
|
|
790
|
+
...network,
|
|
791
|
+
Image: function Image(width, height) {
|
|
792
|
+
if (!new.target) throw new TypeError("Constructor Image requires 'new'");
|
|
793
|
+
const image = document.createElement("img");
|
|
794
|
+
if (width !== undefined) image.setAttribute("width", String(width));
|
|
795
|
+
if (height !== undefined) image.setAttribute("height", String(height));
|
|
796
|
+
return realm.wrap(image);
|
|
797
|
+
},
|
|
798
|
+
customElements: {
|
|
799
|
+
define: () => {},
|
|
800
|
+
get: () => undefined,
|
|
801
|
+
whenDefined: () => Promise.resolve(),
|
|
802
|
+
upgrade: () => {},
|
|
803
|
+
},
|
|
804
|
+
...INTERFACES,
|
|
805
|
+
...typeCheckInterfaces(),
|
|
806
|
+
addEventListener: windowEvents.addEventListener,
|
|
807
|
+
removeEventListener: windowEvents.removeEventListener,
|
|
808
|
+
dispatchEvent: windowEvents.dispatchEvent,
|
|
809
|
+
getComputedStyle: (element) => computedStyleBinding(hooks.computedStyle(nodeOf(element))),
|
|
810
|
+
matchMedia: (query) => {
|
|
811
|
+
const { width, height, mobile } = hooks.viewport();
|
|
812
|
+
return {
|
|
813
|
+
media: String(query),
|
|
814
|
+
matches: mediaQueryMatches(String(query), { width, height, mobile }),
|
|
815
|
+
onchange: null,
|
|
816
|
+
addListener: () => {},
|
|
817
|
+
removeListener: () => {},
|
|
818
|
+
addEventListener: () => {},
|
|
819
|
+
removeEventListener: () => {},
|
|
820
|
+
};
|
|
821
|
+
},
|
|
822
|
+
scrollTo: (x, y) => scrollArguments(hooks, x, y, false),
|
|
823
|
+
scroll: (x, y) => scrollArguments(hooks, x, y, false),
|
|
824
|
+
scrollBy: (x, y) => scrollArguments(hooks, x, y, true),
|
|
825
|
+
alert: () => {},
|
|
826
|
+
confirm: () => false,
|
|
827
|
+
prompt: () => null,
|
|
828
|
+
print: () => {},
|
|
829
|
+
focus: () => {},
|
|
830
|
+
blur: () => {},
|
|
831
|
+
close: () => {},
|
|
832
|
+
open: () => null,
|
|
833
|
+
postMessage: () => {},
|
|
834
|
+
};
|
|
835
|
+
const accessors = {
|
|
836
|
+
innerWidth: viewportValue("width"),
|
|
837
|
+
innerHeight: viewportValue("height"),
|
|
838
|
+
outerWidth: viewportValue("width"),
|
|
839
|
+
outerHeight: viewportValue("height"),
|
|
840
|
+
devicePixelRatio: viewportValue("devicePixelRatio"),
|
|
841
|
+
scrollX: viewportValue("scrollX"),
|
|
842
|
+
scrollY: viewportValue("scrollY"),
|
|
843
|
+
pageXOffset: viewportValue("scrollX"),
|
|
844
|
+
pageYOffset: viewportValue("scrollY"),
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
if (mode === "ses") {
|
|
848
|
+
hardenBindings();
|
|
849
|
+
// Host utilities are hardened before a page can see them: the engine
|
|
850
|
+
// itself uses URL, TextEncoder and Intl, so pages must not change them.
|
|
851
|
+
for (const value of [TextEncoder, TextDecoder, URL, URLSearchParams, Intl, Float64Array, Headers, Request, Response,
|
|
852
|
+
AbortController, AbortSignal, FormData, Blob, File, DOMException, ReadableStream]) {
|
|
853
|
+
harden(value);
|
|
854
|
+
}
|
|
855
|
+
// Everything in `api` is created per document; only shared host classes
|
|
856
|
+
// (above) and the binding classes need hardening.
|
|
857
|
+
const compartment = new Compartment({
|
|
858
|
+
globals: { ...api, Math, Date, Intl, Float64Array },
|
|
859
|
+
__options__: true,
|
|
860
|
+
});
|
|
861
|
+
pageGlobal = compartment.globalThis;
|
|
862
|
+
Object.defineProperty(pageGlobal, CONSTRUCTOR_HELPER, { value: constructorHelper(compartment) });
|
|
863
|
+
installGlobalAccessors(pageGlobal, accessors);
|
|
864
|
+
for (const alias of ["window", "self", "top", "parent", "frames"]) {
|
|
865
|
+
Object.defineProperty(pageGlobal, alias, { value: pageGlobal, writable: true, configurable: true });
|
|
866
|
+
}
|
|
867
|
+
evaluate = (source) => compartment.evaluate(rewriteClassicScript(rewriteConstructorReads(source).code).code, {
|
|
868
|
+
sloppyGlobalsMode: true,
|
|
869
|
+
__evadeImportExpressionTest__: true,
|
|
870
|
+
__evadeHtmlCommentTest__: true,
|
|
871
|
+
// `eval(...)` in page code still goes through the compartment's safe
|
|
872
|
+
// evaluator; rejecting every source that mentions it breaks real sites.
|
|
873
|
+
__rejectSomeDirectEvalExpressions__: false,
|
|
874
|
+
});
|
|
875
|
+
// Module code is already strict with its own scope; no global lifting.
|
|
876
|
+
evaluateModuleCode = (code) => compartment.evaluate(code, {
|
|
877
|
+
__evadeImportExpressionTest__: true,
|
|
878
|
+
__rejectSomeDirectEvalExpressions__: false,
|
|
879
|
+
});
|
|
880
|
+
} else {
|
|
881
|
+
// Host mode: the renderer's own global object becomes the page global.
|
|
882
|
+
pageGlobal = globalThis;
|
|
883
|
+
for (const [name, value] of Object.entries(api)) {
|
|
884
|
+
Object.defineProperty(globalThis, name, { value, writable: true, configurable: true });
|
|
885
|
+
}
|
|
886
|
+
installGlobalAccessors(globalThis, accessors);
|
|
887
|
+
for (const alias of ["window", "self", "top", "parent", "frames"]) {
|
|
888
|
+
Object.defineProperty(globalThis, alias, { value: globalThis, writable: true, configurable: true });
|
|
889
|
+
}
|
|
890
|
+
// No SES: constructors are the real ones.
|
|
891
|
+
Object.defineProperty(globalThis, CONSTRUCTOR_HELPER, {
|
|
892
|
+
value: (value, call = false) => call ? (...args) => Reflect.apply(value.constructor, value, args) : value.constructor,
|
|
893
|
+
configurable: true,
|
|
894
|
+
});
|
|
895
|
+
// Indirect eval: sloppy mode in the global scope, exactly like a <script>.
|
|
896
|
+
evaluate = (source) => (0, eval)(source);
|
|
897
|
+
evaluateModuleCode = (code) => (0, eval)(code);
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
for (const type of WINDOW_HANDLER_EVENTS) {
|
|
901
|
+
defineEventHandlerProperty(pageGlobal, type, () => window, () => realm);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
function startInsertedScripts(nodes) {
|
|
905
|
+
for (const node of nodes) {
|
|
906
|
+
if (node.nodeType !== 1) continue;
|
|
907
|
+
for (const script of [node, ...node.querySelectorAll("script")]) {
|
|
908
|
+
if (script.tagName !== "SCRIPT" || !createdScripts.has(script) || startedScripts.has(script)) continue;
|
|
909
|
+
if (!script.isConnected) continue;
|
|
910
|
+
runInsertedScript(script);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/**
|
|
916
|
+
* A script element inserted by page code: inline scripts run during the
|
|
917
|
+
* insertion, external ones once fetched, followed by load or error.
|
|
918
|
+
*/
|
|
919
|
+
function runInsertedScript(script) {
|
|
920
|
+
const type = (script.getAttribute("type") ?? "").trim().toLowerCase();
|
|
921
|
+
const src = script.getAttribute("src");
|
|
922
|
+
if (type === "module") {
|
|
923
|
+
if (!src && !script.textContent) return;
|
|
924
|
+
startedScripts.add(script);
|
|
925
|
+
trackPendingLoad(runModuleScript(script));
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
if (!CLASSIC_SCRIPT_TYPES.has(type)) return;
|
|
929
|
+
if (!src && !script.textContent) return;
|
|
930
|
+
startedScripts.add(script);
|
|
931
|
+
if (!src) {
|
|
932
|
+
runClassic(script, script.textContent);
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
const pending = hooks.fetchScript(new URL(src, document.URL).href).then(
|
|
936
|
+
(source) => {
|
|
937
|
+
runClassic(script, source);
|
|
938
|
+
runTask(() => script.dispatchEvent(new window.Event("load")));
|
|
939
|
+
},
|
|
940
|
+
(error) => {
|
|
941
|
+
reportError(error);
|
|
942
|
+
runTask(() => script.dispatchEvent(new window.Event("error")));
|
|
943
|
+
},
|
|
944
|
+
);
|
|
945
|
+
trackPendingLoad(pending);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
function trackPendingLoad(pending) {
|
|
949
|
+
if (readyState === "complete") return;
|
|
950
|
+
pendingLoads.add(pending);
|
|
951
|
+
pending.finally(() => pendingLoads.delete(pending));
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
// --- ES modules -------------------------------------------------------
|
|
955
|
+
// A record is fetched and transformed once per (URL, type); the graph is
|
|
956
|
+
// then walked breadth-first (so cycles cannot deadlock) and run in two
|
|
957
|
+
// phases, see module-transform.js.
|
|
958
|
+
|
|
959
|
+
function ensureFetched(url, type, sourceOverride = null) {
|
|
960
|
+
const key = `${type ?? "js"} ${url}`;
|
|
961
|
+
let record = modules.get(key);
|
|
962
|
+
if (record) return record.fetched;
|
|
963
|
+
record = { url, type, state: "fetching", namespace: Object.create(null), deps: [], error: null };
|
|
964
|
+
modules.set(key, record);
|
|
965
|
+
record.fetched = (async () => {
|
|
966
|
+
const source = sourceOverride ?? await hooks.fetchScript(url);
|
|
967
|
+
if (type === "json") {
|
|
968
|
+
Object.defineProperty(record.namespace, "default", { value: JSON.parse(source), enumerable: true });
|
|
969
|
+
record.state = "evaluated";
|
|
970
|
+
return record;
|
|
971
|
+
}
|
|
972
|
+
if (type !== null) throw new TypeError(`Unsupported module type "${type}" for ${url}`);
|
|
973
|
+
const { code, requests } = transformModule(mode === "ses" ? rewriteConstructorReads(source, "module").code : source);
|
|
974
|
+
record.fn = evaluateModuleCode(code);
|
|
975
|
+
record.requests = requests.map((entry) => ({
|
|
976
|
+
url: resolveModuleSpecifier(entry.specifier, url, importMap),
|
|
977
|
+
type: entry.type,
|
|
978
|
+
}));
|
|
979
|
+
record.state = "fetched";
|
|
980
|
+
return record;
|
|
981
|
+
})();
|
|
982
|
+
return record.fetched;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
async function loadGraph(root) {
|
|
986
|
+
const seen = new Set([root]);
|
|
987
|
+
let frontier = [root];
|
|
988
|
+
while (frontier.length) {
|
|
989
|
+
// Each level of the graph is fetched in parallel.
|
|
990
|
+
await Promise.all(frontier.map(async (record) => {
|
|
991
|
+
if (record.requests) record.deps = await Promise.all(record.requests.map((entry) => ensureFetched(entry.url, entry.type)));
|
|
992
|
+
}));
|
|
993
|
+
const next = [];
|
|
994
|
+
for (const record of frontier) {
|
|
995
|
+
for (const dep of record.deps) if (!seen.has(dep)) {
|
|
996
|
+
seen.add(dep);
|
|
997
|
+
next.push(dep);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
frontier = next;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
async function evaluateGraph(root) {
|
|
1005
|
+
const order = [];
|
|
1006
|
+
const visited = new Set();
|
|
1007
|
+
(function visit(record) {
|
|
1008
|
+
if (visited.has(record)) return;
|
|
1009
|
+
visited.add(record);
|
|
1010
|
+
for (const dep of record.deps) visit(dep);
|
|
1011
|
+
order.push(record);
|
|
1012
|
+
})(root);
|
|
1013
|
+
// Phase 1: each module defines its export getters, then waits.
|
|
1014
|
+
for (const record of order) {
|
|
1015
|
+
if (record.state !== "fetched") continue;
|
|
1016
|
+
record.state = "linking";
|
|
1017
|
+
let release;
|
|
1018
|
+
const linked = new Promise((resolve) => (release = resolve));
|
|
1019
|
+
record.release = release;
|
|
1020
|
+
record.completion = callModule(record, linked);
|
|
1021
|
+
}
|
|
1022
|
+
// Phase 2: dependencies first, each module runs to completion (top-level await included).
|
|
1023
|
+
for (const record of order) {
|
|
1024
|
+
if (record.state !== "linking") continue;
|
|
1025
|
+
record.state = "evaluating";
|
|
1026
|
+
record.release();
|
|
1027
|
+
try {
|
|
1028
|
+
await record.completion;
|
|
1029
|
+
record.state = "evaluated";
|
|
1030
|
+
} catch (error) {
|
|
1031
|
+
record.state = "errored";
|
|
1032
|
+
record.error = error;
|
|
1033
|
+
reportError(error, record.url);
|
|
1034
|
+
} finally {
|
|
1035
|
+
hooks.afterTask();
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
if (root.state === "errored") throw root.error;
|
|
1039
|
+
return root.namespace;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
function callModule(record, linked) {
|
|
1043
|
+
const namespaces = record.deps.map((dep) => dep.namespace);
|
|
1044
|
+
const context = {
|
|
1045
|
+
exports: record.namespace,
|
|
1046
|
+
namespaces,
|
|
1047
|
+
linked,
|
|
1048
|
+
meta: {
|
|
1049
|
+
url: record.url,
|
|
1050
|
+
resolve: (specifier) => resolveModuleSpecifier(String(specifier), record.url, importMap),
|
|
1051
|
+
},
|
|
1052
|
+
importDynamic: (specifier) => importModule(String(specifier), record.url),
|
|
1053
|
+
exportStar: (source) => {
|
|
1054
|
+
for (const name of Object.keys(source)) {
|
|
1055
|
+
if (name === "default" || Object.hasOwn(record.namespace, name)) continue;
|
|
1056
|
+
Object.defineProperty(record.namespace, name, { enumerable: true, configurable: true, get: () => source[name] });
|
|
1057
|
+
}
|
|
1058
|
+
},
|
|
1059
|
+
};
|
|
1060
|
+
try {
|
|
1061
|
+
// A plain call: module top-level `this` is undefined.
|
|
1062
|
+
return Promise.resolve(Reflect.apply(record.fn, undefined, [context]));
|
|
1063
|
+
} catch (error) {
|
|
1064
|
+
return Promise.reject(error);
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
async function importModule(specifier, referrer, type = null, sourceOverride = null) {
|
|
1069
|
+
const url = sourceOverride === null ? resolveModuleSpecifier(specifier, referrer, importMap) : specifier;
|
|
1070
|
+
const root = await ensureFetched(url, type, sourceOverride);
|
|
1071
|
+
await loadGraph(root);
|
|
1072
|
+
return evaluateGraph(root);
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
/** Runs a <script type="module"> (external or inline); external ones fire load/error. */
|
|
1076
|
+
async function runModuleScript(script) {
|
|
1077
|
+
const src = script.getAttribute("src");
|
|
1078
|
+
try {
|
|
1079
|
+
if (src) await importModule(new URL(src, document.URL).href, document.URL);
|
|
1080
|
+
else await importModule(`${document.URL}#inline-module-${++inlineModuleCount}`, document.URL, null, script.textContent ?? "");
|
|
1081
|
+
if (src) runTask(() => script.dispatchEvent(new window.Event("load")));
|
|
1082
|
+
} catch (error) {
|
|
1083
|
+
reportError(error, src ? new URL(src, document.URL).href : document.URL);
|
|
1084
|
+
if (src) runTask(() => script.dispatchEvent(new window.Event("error")));
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
function runClassic(script, source) {
|
|
1089
|
+
const previous = currentScript;
|
|
1090
|
+
currentScript = script;
|
|
1091
|
+
try {
|
|
1092
|
+
runTask(() => evaluate(source));
|
|
1093
|
+
} finally {
|
|
1094
|
+
currentScript = previous;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/** Compiles on* attributes (e.g. onclick="...") present when the document loads. */
|
|
1099
|
+
function compileInlineHandlers() {
|
|
1100
|
+
for (const element of document.querySelectorAll("*")) {
|
|
1101
|
+
for (const type of INLINE_HANDLER_EVENTS) {
|
|
1102
|
+
const code = element.getAttribute(`on${type}`);
|
|
1103
|
+
if (code === null) continue;
|
|
1104
|
+
let handler;
|
|
1105
|
+
try {
|
|
1106
|
+
handler = evaluate(`(function (event) {\n${code}\n})`);
|
|
1107
|
+
} catch (error) {
|
|
1108
|
+
reportError(error);
|
|
1109
|
+
continue;
|
|
1110
|
+
}
|
|
1111
|
+
const binding = type === "load" && element === document.body ? pageGlobal : realm.wrap(element);
|
|
1112
|
+
if (binding !== pageGlobal) {
|
|
1113
|
+
binding[`on${type}`] = handler;
|
|
1114
|
+
continue;
|
|
1115
|
+
}
|
|
1116
|
+
window.addEventListener(type, (event) => {
|
|
1117
|
+
const result = callPage(handler, binding, [realm.wrapEvent(event)]);
|
|
1118
|
+
if (result === false) event.preventDefault();
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
return {
|
|
1125
|
+
get pageGlobal() {
|
|
1126
|
+
return pageGlobal;
|
|
1127
|
+
},
|
|
1128
|
+
|
|
1129
|
+
get console() {
|
|
1130
|
+
return consoleEntries.slice();
|
|
1131
|
+
},
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* Runs the parser-inserted classic scripts in document order, then fires
|
|
1135
|
+
* DOMContentLoaded and load. Module scripts are skipped for now, which
|
|
1136
|
+
* makes their `nomodule` fallbacks run instead.
|
|
1137
|
+
*/
|
|
1138
|
+
async runDocumentScripts() {
|
|
1139
|
+
compileInlineHandlers();
|
|
1140
|
+
const all = [...document.querySelectorAll("script")];
|
|
1141
|
+
const mapScript = all.find((script) => (script.getAttribute("type") ?? "").trim().toLowerCase() === "importmap");
|
|
1142
|
+
if (mapScript) {
|
|
1143
|
+
try {
|
|
1144
|
+
importMap = JSON.parse(mapScript.textContent ?? "{}");
|
|
1145
|
+
} catch (error) {
|
|
1146
|
+
reportError(error);
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
// HTML order: blocking classic scripts during parsing, then defer and
|
|
1150
|
+
// module scripts in document order, then async scripts.
|
|
1151
|
+
const immediate = [];
|
|
1152
|
+
const deferred = [];
|
|
1153
|
+
const asynchronous = [];
|
|
1154
|
+
for (const script of all) {
|
|
1155
|
+
const type = (script.getAttribute("type") ?? "").trim().toLowerCase();
|
|
1156
|
+
const external = script.hasAttribute("src");
|
|
1157
|
+
if (type === "module") {
|
|
1158
|
+
(script.hasAttribute("async") ? asynchronous : deferred).push(script);
|
|
1159
|
+
} else if (CLASSIC_SCRIPT_TYPES.has(type) && !script.hasAttribute("nomodule")) {
|
|
1160
|
+
if (external && script.hasAttribute("async")) asynchronous.push(script);
|
|
1161
|
+
else if (external && script.hasAttribute("defer")) deferred.push(script);
|
|
1162
|
+
else immediate.push(script);
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
// Like a preload scanner: fetch every external script (and module graph)
|
|
1166
|
+
// up front, in parallel; execution order is unchanged.
|
|
1167
|
+
const preloaded = new Map();
|
|
1168
|
+
for (const script of [...immediate, ...deferred, ...asynchronous]) {
|
|
1169
|
+
const src = script.getAttribute("src");
|
|
1170
|
+
if (!src) continue;
|
|
1171
|
+
try {
|
|
1172
|
+
const url = new URL(src, document.URL).href;
|
|
1173
|
+
if ((script.getAttribute("type") ?? "").trim().toLowerCase() === "module") {
|
|
1174
|
+
ensureFetched(resolveModuleSpecifier(url, document.URL, importMap), null).then(loadGraph).catch(() => {});
|
|
1175
|
+
} else {
|
|
1176
|
+
const source = hooks.fetchScript(url);
|
|
1177
|
+
source.catch(() => {});
|
|
1178
|
+
preloaded.set(script, source);
|
|
1179
|
+
}
|
|
1180
|
+
} catch {
|
|
1181
|
+
// An unresolvable src is reported when the script runs.
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
const run = async (script) => {
|
|
1185
|
+
if (disposed) return;
|
|
1186
|
+
startedScripts.add(script);
|
|
1187
|
+
if ((script.getAttribute("type") ?? "").trim().toLowerCase() === "module") {
|
|
1188
|
+
await runModuleScript(script);
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
const src = script.getAttribute("src");
|
|
1192
|
+
let source;
|
|
1193
|
+
try {
|
|
1194
|
+
source = src
|
|
1195
|
+
? await (preloaded.get(script) ?? hooks.fetchScript(new URL(src, document.URL).href))
|
|
1196
|
+
: script.textContent ?? "";
|
|
1197
|
+
} catch (error) {
|
|
1198
|
+
reportError(error);
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
runClassic(script, source);
|
|
1202
|
+
};
|
|
1203
|
+
for (const script of immediate) await run(script);
|
|
1204
|
+
for (const script of deferred) await run(script);
|
|
1205
|
+
if (disposed) return;
|
|
1206
|
+
readyState = "interactive";
|
|
1207
|
+
runTask(() => fireLifecycle(document, new window.Event("DOMContentLoaded", { bubbles: true })));
|
|
1208
|
+
hooks.lifecycle?.("DOMContentLoaded");
|
|
1209
|
+
for (const script of asynchronous) await run(script);
|
|
1210
|
+
// Scripts inserted so far (and any they insert in turn) delay load.
|
|
1211
|
+
while (pendingLoads.size && !disposed) await Promise.allSettled([...pendingLoads]);
|
|
1212
|
+
readyState = "complete";
|
|
1213
|
+
runTask(() => fireLifecycle(window, new window.Event("load")));
|
|
1214
|
+
hooks.lifecycle?.("load");
|
|
1215
|
+
},
|
|
1216
|
+
|
|
1217
|
+
/** Dispatches a trusted-looking input event at a real element; returns whether default was prevented. */
|
|
1218
|
+
dispatch(target, event) {
|
|
1219
|
+
let prevented = false;
|
|
1220
|
+
runTask(() => {
|
|
1221
|
+
target.dispatchEvent(event);
|
|
1222
|
+
prevented = event.defaultPrevented;
|
|
1223
|
+
});
|
|
1224
|
+
return prevented;
|
|
1225
|
+
},
|
|
1226
|
+
|
|
1227
|
+
/**
|
|
1228
|
+
* Same-document navigation to a fragment: updates location and
|
|
1229
|
+
* document.URL. When the fragment changed, Happy DOM fires hashchange
|
|
1230
|
+
* (HTML §7.4.2.3.3) from a zero-delay timer; the promise settles after it.
|
|
1231
|
+
*/
|
|
1232
|
+
navigateToFragment(url) {
|
|
1233
|
+
setHref(url);
|
|
1234
|
+
window.happyDOM?.setURL?.(url);
|
|
1235
|
+
return new Promise((resolve) => hostSetTimeout(resolve, 0));
|
|
1236
|
+
},
|
|
1237
|
+
|
|
1238
|
+
/** Runs a classic script (a javascript: URL); errors are reported, not thrown. */
|
|
1239
|
+
run(source) {
|
|
1240
|
+
runTask(() => evaluate(String(source), "javascript: URL"));
|
|
1241
|
+
},
|
|
1242
|
+
|
|
1243
|
+
/** Evaluates an expression in the page (CDP Runtime.evaluate). */
|
|
1244
|
+
evaluate(source) {
|
|
1245
|
+
return runTask(() => evaluate(source));
|
|
1246
|
+
},
|
|
1247
|
+
|
|
1248
|
+
dispose() {
|
|
1249
|
+
disposed = true;
|
|
1250
|
+
// Leaving the document closes its WebSockets (1001 "going away").
|
|
1251
|
+
for (const close of openSockets) close();
|
|
1252
|
+
openSockets.clear();
|
|
1253
|
+
for (const handle of timers.values()) hostClearTimeout(handle);
|
|
1254
|
+
timers.clear();
|
|
1255
|
+
},
|
|
1256
|
+
};
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
function installGlobalAccessors(target, accessors) {
|
|
1260
|
+
for (const [name, get] of Object.entries(accessors)) {
|
|
1261
|
+
Object.defineProperty(target, name, { get, configurable: true, enumerable: true });
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
function scrollArguments(hooks, x, y, relative) {
|
|
1266
|
+
let left = x;
|
|
1267
|
+
let top = y;
|
|
1268
|
+
if (x !== null && typeof x === "object") {
|
|
1269
|
+
left = x.left;
|
|
1270
|
+
top = x.top;
|
|
1271
|
+
}
|
|
1272
|
+
const { scrollX, scrollY } = hooks.viewport();
|
|
1273
|
+
const targetX = Number.isFinite(Number(left)) ? Number(left) + (relative ? scrollX : 0) : scrollX;
|
|
1274
|
+
const targetY = Number.isFinite(Number(top)) ? Number(top) + (relative ? scrollY : 0) : scrollY;
|
|
1275
|
+
hooks.scrollTo(targetX, targetY);
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* `value.constructor` for rewritten page code (see rewriteConstructorReads).
|
|
1280
|
+
* Under SES the Function, AsyncFunction, GeneratorFunction and
|
|
1281
|
+
* AsyncGeneratorFunction constructors reached through prototypes are inert;
|
|
1282
|
+
* these stand-ins compile the same function text in the page's compartment
|
|
1283
|
+
* and share the real prototypes, so instanceof and prototype checks hold.
|
|
1284
|
+
*/
|
|
1285
|
+
function constructorHelper(compartment) {
|
|
1286
|
+
const kinds = [
|
|
1287
|
+
[function () {}, "function"],
|
|
1288
|
+
[async function () {}, "async function"],
|
|
1289
|
+
[function* () {}, "function*"],
|
|
1290
|
+
[async function* () {}, "async function*"],
|
|
1291
|
+
];
|
|
1292
|
+
const replacements = new Map();
|
|
1293
|
+
for (const [sample, keyword] of kinds) {
|
|
1294
|
+
const inert = Object.getPrototypeOf(sample).constructor;
|
|
1295
|
+
const Constructor = function (...args) {
|
|
1296
|
+
const body = args.length ? String(args[args.length - 1]) : "";
|
|
1297
|
+
const parameters = args.slice(0, -1).map(String).join(",");
|
|
1298
|
+
return compartment.evaluate(`(${keyword} anonymous(${parameters}\n) {\n${body}\n})`);
|
|
1299
|
+
};
|
|
1300
|
+
Object.defineProperty(Constructor, "prototype", { value: Object.getPrototypeOf(sample) });
|
|
1301
|
+
Object.defineProperty(Constructor, "name", { value: inert.name });
|
|
1302
|
+
replacements.set(inert, keyword === "function" ? compartment.globalThis.Function : Constructor);
|
|
1303
|
+
}
|
|
1304
|
+
// call: `value.constructor(...)`, where an ordinary constructor keeps `value` as `this`.
|
|
1305
|
+
return (value, call = false) => {
|
|
1306
|
+
const constructor = value.constructor;
|
|
1307
|
+
const replacement = replacements.get(constructor);
|
|
1308
|
+
if (replacement) return replacement;
|
|
1309
|
+
return call && typeof constructor === "function" ? (...args) => Reflect.apply(constructor, value, args) : constructor;
|
|
1310
|
+
};
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
/**
|
|
1314
|
+
* window.History and window.history for one document. The methods live on a
|
|
1315
|
+
* per-document History.prototype that pages may wrap (dev servers do, to see
|
|
1316
|
+
* client-side routing). pushState/replaceState change the URL and state
|
|
1317
|
+
* without navigating or firing events; traversal is not modelled.
|
|
1318
|
+
*/
|
|
1319
|
+
function historyBinding(location, setHref) {
|
|
1320
|
+
let state = null;
|
|
1321
|
+
let length = 1;
|
|
1322
|
+
const change = (data, url) => {
|
|
1323
|
+
if (url === undefined || url === null) return;
|
|
1324
|
+
const target = new URL(String(url), location.href);
|
|
1325
|
+
if (target.origin !== new URL(location.href).origin) {
|
|
1326
|
+
throw new DOMException(`A history state object with URL '${target.href}' cannot be created in a document with origin '${new URL(location.href).origin}'.`, "SecurityError");
|
|
1327
|
+
}
|
|
1328
|
+
setHref(target.href);
|
|
1329
|
+
};
|
|
1330
|
+
function History() {
|
|
1331
|
+
throw new TypeError("Illegal constructor");
|
|
1332
|
+
}
|
|
1333
|
+
History.prototype = {
|
|
1334
|
+
constructor: History,
|
|
1335
|
+
get length() {
|
|
1336
|
+
return length;
|
|
1337
|
+
},
|
|
1338
|
+
get state() {
|
|
1339
|
+
return state;
|
|
1340
|
+
},
|
|
1341
|
+
scrollRestoration: "auto",
|
|
1342
|
+
back() {},
|
|
1343
|
+
forward() {},
|
|
1344
|
+
go() {},
|
|
1345
|
+
pushState(data, _title, url = undefined) {
|
|
1346
|
+
change(data, url);
|
|
1347
|
+
state = data ?? null;
|
|
1348
|
+
length++;
|
|
1349
|
+
},
|
|
1350
|
+
replaceState(data, _title, url = undefined) {
|
|
1351
|
+
change(data, url);
|
|
1352
|
+
state = data ?? null;
|
|
1353
|
+
},
|
|
1354
|
+
};
|
|
1355
|
+
return { History, history: Object.create(History.prototype) };
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
/** window.location; `setHref` moves it for same-document (fragment) navigations. */
|
|
1359
|
+
function locationBinding(href, navigate) {
|
|
1360
|
+
const url = () => new URL(href);
|
|
1361
|
+
const location = {
|
|
1362
|
+
get href() {
|
|
1363
|
+
return href;
|
|
1364
|
+
},
|
|
1365
|
+
set href(value) {
|
|
1366
|
+
navigate(new URL(String(value), href).href);
|
|
1367
|
+
},
|
|
1368
|
+
get protocol() {
|
|
1369
|
+
return url().protocol;
|
|
1370
|
+
},
|
|
1371
|
+
get host() {
|
|
1372
|
+
return url().host;
|
|
1373
|
+
},
|
|
1374
|
+
get hostname() {
|
|
1375
|
+
return url().hostname;
|
|
1376
|
+
},
|
|
1377
|
+
get port() {
|
|
1378
|
+
return url().port;
|
|
1379
|
+
},
|
|
1380
|
+
get pathname() {
|
|
1381
|
+
return url().pathname;
|
|
1382
|
+
},
|
|
1383
|
+
get search() {
|
|
1384
|
+
return url().search;
|
|
1385
|
+
},
|
|
1386
|
+
get hash() {
|
|
1387
|
+
return url().hash;
|
|
1388
|
+
},
|
|
1389
|
+
set hash(value) {
|
|
1390
|
+
const next = url();
|
|
1391
|
+
next.hash = String(value);
|
|
1392
|
+
navigate(next.href);
|
|
1393
|
+
},
|
|
1394
|
+
get origin() {
|
|
1395
|
+
return url().origin;
|
|
1396
|
+
},
|
|
1397
|
+
assign: (value) => navigate(new URL(String(value), href).href),
|
|
1398
|
+
replace: (value) => navigate(new URL(String(value), href).href),
|
|
1399
|
+
reload: () => navigate(href),
|
|
1400
|
+
toString: () => href,
|
|
1401
|
+
};
|
|
1402
|
+
return { location, setHref: (value) => { href = value; } };
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
function storageBinding(map) {
|
|
1406
|
+
return {
|
|
1407
|
+
get length() {
|
|
1408
|
+
return map.size;
|
|
1409
|
+
},
|
|
1410
|
+
key: (index) => [...map.keys()][Number(index)] ?? null,
|
|
1411
|
+
getItem: (key) => map.has(String(key)) ? map.get(String(key)) : null,
|
|
1412
|
+
setItem: (key, value) => {
|
|
1413
|
+
map.set(String(key), String(value));
|
|
1414
|
+
},
|
|
1415
|
+
removeItem: (key) => {
|
|
1416
|
+
map.delete(String(key));
|
|
1417
|
+
},
|
|
1418
|
+
clear: () => map.clear(),
|
|
1419
|
+
};
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
/** A read-only snapshot of the few computed values the engine models. */
|
|
1423
|
+
function computedStyleBinding(style) {
|
|
1424
|
+
const values = style ? {
|
|
1425
|
+
display: style.display,
|
|
1426
|
+
position: style.position,
|
|
1427
|
+
color: style.color,
|
|
1428
|
+
backgroundColor: style.backgroundColor,
|
|
1429
|
+
fontSize: `${style.fontSize}px`,
|
|
1430
|
+
fontWeight: String(style.fontWeight),
|
|
1431
|
+
fontFamily: (style.fontFamily ?? []).join(", "),
|
|
1432
|
+
lineHeight: style.lineHeight == null ? "normal" : `${style.lineHeight}px`,
|
|
1433
|
+
textAlign: style.textAlign,
|
|
1434
|
+
whiteSpace: style.whiteSpace,
|
|
1435
|
+
boxSizing: style.boxSizing,
|
|
1436
|
+
zIndex: String(style.zIndex),
|
|
1437
|
+
visibility: "visible",
|
|
1438
|
+
opacity: "1",
|
|
1439
|
+
} : {};
|
|
1440
|
+
const kebab = (name) => name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
1441
|
+
const byKebab = Object.fromEntries(Object.entries(values).map(([name, value]) => [kebab(name), value]));
|
|
1442
|
+
return {
|
|
1443
|
+
...values,
|
|
1444
|
+
getPropertyValue: (name) => byKebab[String(name)] ?? "",
|
|
1445
|
+
};
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
function formatConsoleValue(value) {
|
|
1449
|
+
if (typeof value === "string") return value;
|
|
1450
|
+
try {
|
|
1451
|
+
return JSON.stringify(value) ?? String(value);
|
|
1452
|
+
} catch {
|
|
1453
|
+
return String(value);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
function safeJson(text) {
|
|
1458
|
+
try {
|
|
1459
|
+
return JSON.parse(text);
|
|
1460
|
+
} catch {
|
|
1461
|
+
return null;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
function safeOrigin(href) {
|
|
1466
|
+
try {
|
|
1467
|
+
return new URL(href).origin;
|
|
1468
|
+
} catch {
|
|
1469
|
+
return "null";
|
|
1470
|
+
}
|
|
1471
|
+
}
|