@speedkit/cli 4.51.0 → 4.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +1426 -14
- package/dist/base/run-control-command.d.ts +15 -0
- package/dist/base/run-control-command.js +20 -0
- package/dist/build-info.json +6 -0
- package/dist/commands/diff.d.ts +7 -1
- package/dist/commands/diff.js +9 -3
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.js +14 -3
- package/dist/commands/onboarding/browser/click.d.ts +75 -0
- package/dist/commands/onboarding/browser/click.js +19 -0
- package/dist/commands/onboarding/browser/emulate.d.ts +105 -0
- package/dist/commands/onboarding/browser/emulate.js +26 -0
- package/dist/commands/onboarding/browser/navigate.d.ts +75 -0
- package/dist/commands/onboarding/browser/navigate.js +19 -0
- package/dist/commands/onboarding/browser/panel.d.ts +63 -0
- package/dist/commands/onboarding/browser/panel.js +12 -0
- package/dist/commands/onboarding/browser/reinstall-sw.d.ts +63 -0
- package/dist/commands/onboarding/browser/reinstall-sw.js +14 -0
- package/dist/commands/onboarding/browser/reset.d.ts +71 -0
- package/dist/commands/onboarding/browser/reset.js +18 -0
- package/dist/commands/onboarding/browser/screenshot.d.ts +77 -0
- package/dist/commands/onboarding/browser/screenshot.js +19 -0
- package/dist/commands/onboarding/browser/state.d.ts +63 -0
- package/dist/commands/onboarding/browser/state.js +12 -0
- package/dist/commands/onboarding/browser/tabs.d.ts +58 -0
- package/dist/commands/onboarding/browser/tabs.js +16 -0
- package/dist/commands/onboarding/cache/clear.d.ts +58 -0
- package/dist/commands/onboarding/cache/clear.js +12 -0
- package/dist/commands/onboarding/cache/errors.d.ts +58 -0
- package/dist/commands/onboarding/cache/errors.js +12 -0
- package/dist/commands/onboarding/cache/evict.d.ts +62 -0
- package/dist/commands/onboarding/cache/evict.js +15 -0
- package/dist/commands/onboarding/cache/get.d.ts +85 -0
- package/dist/commands/onboarding/cache/get.js +17 -0
- package/dist/commands/onboarding/cache/list.d.ts +58 -0
- package/dist/commands/onboarding/cache/list.js +15 -0
- package/dist/commands/onboarding/cache/prewarm.d.ts +73 -0
- package/dist/commands/onboarding/cache/prewarm.js +20 -0
- package/dist/commands/onboarding/cache/refresh.d.ts +62 -0
- package/dist/commands/onboarding/cache/refresh.js +18 -0
- package/dist/commands/onboarding/cdp.d.ts +81 -0
- package/dist/commands/onboarding/cdp.js +18 -0
- package/dist/commands/onboarding/debug/arm.d.ts +83 -0
- package/dist/commands/onboarding/debug/arm.js +19 -0
- package/dist/commands/onboarding/debug/await.d.ts +71 -0
- package/dist/commands/onboarding/debug/await.js +18 -0
- package/dist/commands/onboarding/debug/disarm.d.ts +63 -0
- package/dist/commands/onboarding/debug/disarm.js +12 -0
- package/dist/commands/onboarding/debug/eval.d.ts +75 -0
- package/dist/commands/onboarding/debug/eval.js +16 -0
- package/dist/commands/onboarding/debug/release.d.ts +63 -0
- package/dist/commands/onboarding/debug/release.js +12 -0
- package/dist/commands/onboarding/debug/resume.d.ts +63 -0
- package/dist/commands/onboarding/debug/resume.js +12 -0
- package/dist/commands/onboarding/debug/status.d.ts +63 -0
- package/dist/commands/onboarding/debug/status.js +12 -0
- package/dist/commands/onboarding/debug/step.d.ts +67 -0
- package/dist/commands/onboarding/debug/step.js +15 -0
- package/dist/commands/onboarding/files/list.d.ts +58 -0
- package/dist/commands/onboarding/files/list.js +12 -0
- package/dist/commands/onboarding/files/read.d.ts +73 -0
- package/dist/commands/onboarding/files/read.js +16 -0
- package/dist/commands/onboarding/files/rebuild.d.ts +63 -0
- package/dist/commands/onboarding/files/rebuild.js +18 -0
- package/dist/commands/onboarding/files/validate.d.ts +58 -0
- package/dist/commands/onboarding/files/validate.js +12 -0
- package/dist/commands/onboarding/fouc.d.ts +77 -0
- package/dist/commands/onboarding/fouc.js +16 -0
- package/dist/commands/onboarding/inject/add.d.ts +89 -0
- package/dist/commands/onboarding/inject/add.js +17 -0
- package/dist/commands/onboarding/inject/clear.d.ts +63 -0
- package/dist/commands/onboarding/inject/clear.js +12 -0
- package/dist/commands/onboarding/inject/list.d.ts +63 -0
- package/dist/commands/onboarding/inject/list.js +12 -0
- package/dist/commands/onboarding/inject/read.d.ts +75 -0
- package/dist/commands/onboarding/inject/read.js +18 -0
- package/dist/commands/onboarding/inject/recipes.d.ts +63 -0
- package/dist/commands/onboarding/inject/recipes.js +12 -0
- package/dist/commands/onboarding/inject/remove.d.ts +67 -0
- package/dist/commands/onboarding/inject/remove.js +15 -0
- package/dist/commands/onboarding/list.d.ts +13 -0
- package/dist/commands/onboarding/list.js +12 -0
- package/dist/commands/onboarding/logs.d.ts +41 -0
- package/dist/commands/onboarding/logs.js +257 -0
- package/dist/commands/onboarding/navwalk.d.ts +95 -0
- package/dist/commands/onboarding/navwalk.js +19 -0
- package/dist/commands/onboarding/response.d.ts +67 -0
- package/dist/commands/onboarding/response.js +18 -0
- package/dist/commands/onboarding/rum/beacons.d.ts +75 -0
- package/dist/commands/onboarding/rum/beacons.js +16 -0
- package/dist/commands/onboarding/rum/get.d.ts +77 -0
- package/dist/commands/onboarding/rum/get.js +18 -0
- package/dist/commands/onboarding/rum/key.d.ts +67 -0
- package/dist/commands/onboarding/rum/key.js +13 -0
- package/dist/commands/onboarding/rum/previous.d.ts +63 -0
- package/dist/commands/onboarding/rum/previous.js +12 -0
- package/dist/commands/onboarding/status.d.ts +13 -0
- package/dist/commands/onboarding/status.js +17 -0
- package/dist/commands/onboarding/stop.d.ts +13 -0
- package/dist/commands/onboarding/stop.js +17 -0
- package/dist/commands/onboarding/todo.d.ts +58 -0
- package/dist/commands/onboarding/todo.js +12 -0
- package/dist/commands/onboarding/viewport.d.ts +101 -0
- package/dist/commands/onboarding/viewport.js +18 -0
- package/dist/commands/onboarding/watch.d.ts +93 -0
- package/dist/commands/onboarding/watch.js +16 -0
- package/dist/commands/onboarding.d.ts +26 -0
- package/dist/commands/onboarding.js +221 -4
- package/dist/commands/origin-request.d.ts +4 -0
- package/dist/commands/origin-request.js +4 -0
- package/dist/commands/spec/onboarding.spec.d.ts +1 -0
- package/dist/commands/spec/onboarding.spec.js +127 -0
- package/dist/services/browser-fetch/device-emulation.d.ts +11 -0
- package/dist/services/browser-fetch/device-emulation.js +14 -0
- package/dist/services/cli/build-info.d.ts +33 -0
- package/dist/services/cli/build-info.js +63 -0
- package/dist/services/cli/cli-environment-factory.d.ts +3 -0
- package/dist/services/cli/cli-environment-factory.js +1 -0
- package/dist/services/cli/cli-service-build-context.d.ts +3 -0
- package/dist/services/cli/cli-service-factory.js +1 -1
- package/dist/services/cli/cli-service-model.d.ts +29 -10
- package/dist/services/cli/cli-service.d.ts +60 -11
- package/dist/services/cli/cli-service.js +196 -32
- package/dist/services/cli/index.d.ts +2 -0
- package/dist/services/cli/index.js +2 -0
- package/dist/services/cli/sink.d.ts +47 -0
- package/dist/services/cli/sink.js +31 -0
- package/dist/services/cli/spec/build-identity.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-identity.spec.js +85 -0
- package/dist/services/cli/spec/build-info.spec.d.ts +1 -0
- package/dist/services/cli/spec/build-info.spec.js +10 -0
- package/dist/services/cli/spec/cli-service-log.spec.d.ts +1 -0
- package/dist/services/cli/spec/cli-service-log.spec.js +133 -0
- package/dist/services/cli/spec/cli-service.spec.js +113 -50
- package/dist/services/cli/spec/memory-cli.d.ts +9 -0
- package/dist/services/cli/spec/memory-cli.js +9 -0
- package/dist/services/diff/config-at-ref.d.ts +20 -0
- package/dist/services/diff/config-at-ref.js +33 -0
- package/dist/services/diff/diff-service-build-context.d.ts +12 -0
- package/dist/services/diff/diff-service-build-context.js +45 -1
- package/dist/services/diff/diff-service-factory.d.ts +2 -0
- package/dist/services/diff/diff-service-factory.js +65 -25
- package/dist/services/diff/diff-service.d.ts +11 -0
- package/dist/services/diff/diff-service.js +37 -11
- package/dist/services/diff/page-source.d.ts +12 -0
- package/dist/services/diff/page-source.js +16 -11
- package/dist/services/diff/run-runtime-config.d.ts +33 -0
- package/dist/services/diff/run-runtime-config.js +74 -0
- package/dist/services/diff/sinks/tool-diff-sink.d.ts +3 -2
- package/dist/services/diff/sinks/tool-diff-sink.js +3 -2
- package/dist/services/diff/spec/config-at-ref.spec.d.ts +1 -0
- package/dist/services/diff/spec/config-at-ref.spec.js +46 -0
- package/dist/services/diff/spec/diff-service-build-context.spec.js +19 -0
- package/dist/services/diff/spec/diff-service.spec.js +95 -0
- package/dist/services/diff/spec/run-runtime-config.spec.d.ts +1 -0
- package/dist/services/diff/spec/run-runtime-config.spec.js +87 -0
- package/dist/services/git/git-repository.d.ts +2 -0
- package/dist/services/git/git-repository.js +6 -0
- package/dist/services/integration-api/customer-config-flags.js +1 -0
- package/dist/services/onboarding/browse/browse-service.d.ts +13 -1
- package/dist/services/onboarding/browse/browse-service.js +43 -7
- package/dist/services/onboarding/browser/answer-dialogs.d.ts +12 -0
- package/dist/services/onboarding/browser/answer-dialogs.js +25 -0
- package/dist/services/onboarding/browser/baqend-response.d.ts +17 -1
- package/dist/services/onboarding/browser/baqend-response.js +23 -0
- package/dist/services/onboarding/browser/console-log.d.ts +9 -0
- package/dist/services/onboarding/browser/console-log.js +27 -0
- package/dist/services/onboarding/browser/emulate-device.d.ts +12 -1
- package/dist/services/onboarding/browser/emulate-device.js +68 -13
- package/dist/services/onboarding/browser/executable/executable-validator.js +4 -2
- package/dist/services/onboarding/browser/extension/extension-bridge.js +5 -3
- package/dist/services/onboarding/browser/extension/extension-downloader.js +17 -8
- package/dist/services/onboarding/browser/extension/extension-validator.js +9 -4
- package/dist/services/onboarding/browser/launch-browser.d.ts +2 -1
- package/dist/services/onboarding/browser/launch-browser.js +6 -1
- package/dist/services/onboarding/browser/resume-restarted-workers.d.ts +14 -0
- package/dist/services/onboarding/browser/resume-restarted-workers.js +26 -0
- package/dist/services/onboarding/control/body-inspect.d.ts +24 -0
- package/dist/services/onboarding/control/body-inspect.js +106 -0
- package/dist/services/onboarding/control/browser-session.d.ts +547 -0
- package/dist/services/onboarding/control/browser-session.js +1337 -0
- package/dist/services/onboarding/control/config-validation.d.ts +17 -0
- package/dist/services/onboarding/control/config-validation.js +46 -0
- package/dist/services/onboarding/control/control-protocol.d.ts +1430 -0
- package/dist/services/onboarding/control/control-protocol.js +58 -0
- package/dist/services/onboarding/control/control-server.d.ts +292 -0
- package/dist/services/onboarding/control/control-server.js +1629 -0
- package/dist/services/onboarding/control/debug-session.d.ts +219 -0
- package/dist/services/onboarding/control/debug-session.js +897 -0
- package/dist/services/onboarding/control/fouc.d.ts +23 -0
- package/dist/services/onboarding/control/fouc.js +151 -0
- package/dist/services/onboarding/control/index.d.ts +4 -0
- package/dist/services/onboarding/control/index.js +4 -0
- package/dist/services/onboarding/control/navigate-wait.d.ts +33 -0
- package/dist/services/onboarding/control/navigate-wait.js +56 -0
- package/dist/services/onboarding/control/navwalk.d.ts +65 -0
- package/dist/services/onboarding/control/navwalk.js +248 -0
- package/dist/services/onboarding/control/preload-registry.d.ts +150 -0
- package/dist/services/onboarding/control/preload-registry.js +829 -0
- package/dist/services/onboarding/control/response-explainer.d.ts +24 -0
- package/dist/services/onboarding/control/response-explainer.js +257 -0
- package/dist/services/onboarding/control/rum.d.ts +8 -0
- package/dist/services/onboarding/control/rum.js +220 -0
- package/dist/services/onboarding/control/service-worker-tracker.d.ts +68 -0
- package/dist/services/onboarding/control/service-worker-tracker.js +120 -0
- package/dist/services/onboarding/control/viewport.d.ts +45 -0
- package/dist/services/onboarding/control/viewport.js +344 -0
- package/dist/services/onboarding/control/watch.d.ts +26 -0
- package/dist/services/onboarding/control/watch.js +157 -0
- package/dist/services/onboarding/dashboard/diff-against-current-page.js +3 -1
- package/dist/services/onboarding/dashboard/index.js +7 -2
- package/dist/services/onboarding/fetch-event-handler.d.ts +24 -5
- package/dist/services/onboarding/fetch-event-handler.js +103 -32
- package/dist/services/onboarding/fetch-events/spec/speed-kit-install-js.spec.d.ts +1 -0
- package/dist/services/onboarding/fetch-events/spec/speed-kit-install-js.spec.js +59 -0
- package/dist/services/onboarding/fetch-events/speed-kit-install-js.js +16 -5
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.d.ts +14 -0
- package/dist/services/onboarding/fetch-events/speed-kit-rum-pi-request.js +30 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.d.ts +13 -0
- package/dist/services/onboarding/fetch-events/speed-kit-service-worker-js.js +28 -1
- package/dist/services/onboarding/file-events/file-watcher.d.ts +42 -1
- package/dist/services/onboarding/file-events/file-watcher.js +117 -12
- package/dist/services/onboarding/inject/inject-service.js +1 -1
- package/dist/services/onboarding/onboarding-model.d.ts +40 -7
- package/dist/services/onboarding/onboarding-model.js +20 -9
- package/dist/services/onboarding/onboarding-service-build-context.d.ts +4 -0
- package/dist/services/onboarding/onboarding-service-build-context.js +7 -1
- package/dist/services/onboarding/onboarding-service-factory.d.ts +17 -1
- package/dist/services/onboarding/onboarding-service-factory.js +150 -23
- package/dist/services/onboarding/onboarding-service.d.ts +40 -1
- package/dist/services/onboarding/onboarding-service.js +139 -23
- package/dist/services/onboarding/request-cache/asset-key.d.ts +61 -0
- package/dist/services/onboarding/request-cache/asset-key.js +115 -0
- package/dist/services/onboarding/request-cache/cache.d.ts +62 -5
- package/dist/services/onboarding/request-cache/cache.js +128 -17
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/answer-dialogs.spec.js +66 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/console-log.spec.js +42 -0
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/browser/resume-restarted-workers.spec.js +45 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/browser-session.spec.js +753 -0
- package/dist/services/onboarding/spec/control/control-server.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/control-server.spec.js +371 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/debug-session.spec.js +751 -0
- package/dist/services/onboarding/spec/control/fakes.d.ts +31 -0
- package/dist/services/onboarding/spec/control/fakes.js +67 -0
- package/dist/services/onboarding/spec/control/fouc.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/fouc.spec.js +167 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navigate-wait.spec.js +47 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/navwalk.spec.js +222 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/preload-registry.spec.js +432 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/response-explainer.spec.js +324 -0
- package/dist/services/onboarding/spec/control/rum.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/rum.spec.js +222 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/service-worker-tracker.spec.js +193 -0
- package/dist/services/onboarding/spec/control/viewport.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/viewport.spec.js +200 -0
- package/dist/services/onboarding/spec/control/watch.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/control/watch.spec.js +187 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-event-handler.spec.js +219 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/fetch-events/speed-kit-service-worker-js.spec.js +41 -0
- package/dist/services/onboarding/spec/onboarding-model.spec.js +39 -3
- package/dist/services/onboarding/spec/onboarding-service-factory.spec.js +25 -1
- package/dist/services/onboarding/spec/request-cache/cache.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/request-cache/cache.spec.js +107 -0
- package/dist/services/onboarding/spec/todo-collector.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/todo-collector.spec.js +136 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.d.ts +1 -0
- package/dist/services/onboarding/spec/virtual-orestes-app/virtual-orestes-app.spec.js +65 -0
- package/dist/services/onboarding/todo-collector.d.ts +7 -2
- package/dist/services/onboarding/todo-collector.js +49 -12
- package/dist/services/onboarding/virtual-orestes-app/index.d.ts +38 -0
- package/dist/services/onboarding/virtual-orestes-app/index.js +113 -27
- package/dist/services/origin-request/asset-variations.d.ts +14 -0
- package/dist/services/origin-request/asset-variations.js +11 -4
- package/dist/services/origin-request/origin-fetcher.d.ts +7 -0
- package/dist/services/origin-request/origin-fetcher.js +43 -5
- package/dist/services/origin-request/origin-request-service-build-context.d.ts +17 -0
- package/dist/services/origin-request/origin-request-service-build-context.js +8 -0
- package/dist/services/origin-request/origin-request-service-factory.d.ts +0 -5
- package/dist/services/origin-request/origin-request-service-factory.js +2 -30
- package/dist/services/origin-request/origin-request-service.d.ts +121 -6
- package/dist/services/origin-request/origin-request-service.js +273 -49
- package/dist/services/origin-request/runtime-config-source.d.ts +6 -0
- package/dist/services/origin-request/runtime-config-source.js +15 -4
- package/dist/services/origin-request/spec/asset-variations.spec.js +20 -0
- package/dist/services/origin-request/spec/origin-request-service.spec.js +329 -6
- package/dist/services/query-builder/rules/rule-match.d.ts +35 -0
- package/dist/services/query-builder/rules/rule-match.js +70 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.d.ts +1 -0
- package/dist/services/query-builder/spec/rules/rule-match.spec.js +121 -0
- package/dist/services/run-control/browser/run-browser-contexts.d.ts +557 -0
- package/dist/services/run-control/browser/run-browser-contexts.js +91 -0
- package/dist/services/run-control/browser/run-browser-service-factory.d.ts +5 -0
- package/dist/services/run-control/browser/run-browser-service-factory.js +7 -0
- package/dist/services/run-control/browser/run-browser-service.d.ts +68 -0
- package/dist/services/run-control/browser/run-browser-service.js +206 -0
- package/dist/services/run-control/cache/run-cache-contexts.d.ts +349 -0
- package/dist/services/run-control/cache/run-cache-contexts.js +51 -0
- package/dist/services/run-control/cache/run-cache-service-factory.d.ts +6 -0
- package/dist/services/run-control/cache/run-cache-service-factory.js +12 -0
- package/dist/services/run-control/cache/run-cache-service.d.ts +35 -0
- package/dist/services/run-control/cache/run-cache-service.js +151 -0
- package/dist/services/run-control/control-client.d.ts +36 -0
- package/dist/services/run-control/control-client.js +147 -0
- package/dist/services/run-control/debug/run-debug-contexts.d.ts +416 -0
- package/dist/services/run-control/debug/run-debug-contexts.js +47 -0
- package/dist/services/run-control/debug/run-debug-service-factory.d.ts +5 -0
- package/dist/services/run-control/debug/run-debug-service-factory.js +7 -0
- package/dist/services/run-control/debug/run-debug-service.d.ts +39 -0
- package/dist/services/run-control/debug/run-debug-service.js +164 -0
- package/dist/services/run-control/files/run-files-contexts.d.ts +238 -0
- package/dist/services/run-control/files/run-files-contexts.js +26 -0
- package/dist/services/run-control/files/run-files-service-factory.d.ts +5 -0
- package/dist/services/run-control/files/run-files-service-factory.js +7 -0
- package/dist/services/run-control/files/run-files-service.d.ts +29 -0
- package/dist/services/run-control/files/run-files-service.js +120 -0
- package/dist/services/run-control/index.d.ts +32 -0
- package/dist/services/run-control/index.js +31 -0
- package/dist/services/run-control/inject/run-inject-contexts.d.ts +319 -0
- package/dist/services/run-control/inject/run-inject-contexts.js +38 -0
- package/dist/services/run-control/inject/run-inject-service-factory.d.ts +5 -0
- package/dist/services/run-control/inject/run-inject-service-factory.js +7 -0
- package/dist/services/run-control/inject/run-inject-service.d.ts +31 -0
- package/dist/services/run-control/inject/run-inject-service.js +227 -0
- package/dist/services/run-control/live-run.d.ts +37 -0
- package/dist/services/run-control/live-run.js +56 -0
- package/dist/services/run-control/probe/run-probe-contexts.d.ts +333 -0
- package/dist/services/run-control/probe/run-probe-contexts.js +73 -0
- package/dist/services/run-control/probe/run-probe-service-factory.d.ts +5 -0
- package/dist/services/run-control/probe/run-probe-service-factory.js +7 -0
- package/dist/services/run-control/probe/run-probe-service.d.ts +54 -0
- package/dist/services/run-control/probe/run-probe-service.js +194 -0
- package/dist/services/run-control/rum/run-rum-contexts.d.ts +216 -0
- package/dist/services/run-control/rum/run-rum-contexts.js +34 -0
- package/dist/services/run-control/rum/run-rum-service-factory.d.ts +5 -0
- package/dist/services/run-control/rum/run-rum-service-factory.js +7 -0
- package/dist/services/run-control/rum/run-rum-service.d.ts +36 -0
- package/dist/services/run-control/rum/run-rum-service.js +122 -0
- package/dist/services/run-control/run-answer.d.ts +28 -0
- package/dist/services/run-control/run-answer.js +58 -0
- package/dist/services/run-control/run-control-context.d.ts +102 -0
- package/dist/services/run-control/run-control-context.js +36 -0
- package/dist/services/run-control/run-control-flags.d.ts +12 -0
- package/dist/services/run-control/run-control-flags.js +22 -0
- package/dist/services/run-control/run-control-model.d.ts +9 -0
- package/dist/services/run-control/run-control-model.js +1 -0
- package/dist/services/run-control/run-control-service-factory.d.ts +14 -0
- package/dist/services/run-control/run-control-service-factory.js +26 -0
- package/dist/services/run-control/session/run-session-contexts.d.ts +25 -0
- package/dist/services/run-control/session/run-session-contexts.js +20 -0
- package/dist/services/run-control/session/run-session-service-factory.d.ts +8 -0
- package/dist/services/run-control/session/run-session-service-factory.js +18 -0
- package/dist/services/run-control/session/run-session-service.d.ts +32 -0
- package/dist/services/run-control/session/run-session-service.js +151 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/browser/run-browser-service.spec.js +328 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/cache/run-cache-service.spec.js +454 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/debug/run-debug-service.spec.js +113 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/files/run-files-service.spec.js +234 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/inject/run-inject-service.spec.js +251 -0
- package/dist/services/run-control/spec/live-run-fixture.d.ts +32 -0
- package/dist/services/run-control/spec/live-run-fixture.js +109 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/probe/run-probe-service.spec.js +108 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/rum/run-rum-service.spec.js +47 -0
- package/dist/services/run-control/spec/run-answer.spec.d.ts +1 -0
- package/dist/services/run-control/spec/run-answer.spec.js +57 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.d.ts +1 -0
- package/dist/services/run-control/spec/session/run-session-service.spec.js +150 -0
- package/dist/services/run-log/crash-mirror.d.ts +31 -0
- package/dist/services/run-log/crash-mirror.js +69 -0
- package/dist/services/run-log/index.d.ts +11 -0
- package/dist/services/run-log/index.js +11 -0
- package/dist/services/run-log/jsonl-appender.d.ts +46 -0
- package/dist/services/run-log/jsonl-appender.js +91 -0
- package/dist/services/run-log/log-event-model.d.ts +104 -0
- package/dist/services/run-log/log-event-model.js +56 -0
- package/dist/services/run-log/log-query-service-factory.d.ts +11 -0
- package/dist/services/run-log/log-query-service-factory.js +14 -0
- package/dist/services/run-log/log-query-service.d.ts +59 -0
- package/dist/services/run-log/log-query-service.js +111 -0
- package/dist/services/run-log/log-reader.d.ts +84 -0
- package/dist/services/run-log/log-reader.js +180 -0
- package/dist/services/run-log/log-summary.d.ts +72 -0
- package/dist/services/run-log/log-summary.js +208 -0
- package/dist/services/run-log/redaction.d.ts +34 -0
- package/dist/services/run-log/redaction.js +124 -0
- package/dist/services/run-log/request-log.d.ts +82 -0
- package/dist/services/run-log/request-log.js +69 -0
- package/dist/services/run-log/request-summary.d.ts +76 -0
- package/dist/services/run-log/request-summary.js +0 -0
- package/dist/services/run-log/run-log.d.ts +61 -0
- package/dist/services/run-log/run-log.js +102 -0
- package/dist/services/run-log/spec/log-query-service.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-query-service.spec.js +197 -0
- package/dist/services/run-log/spec/log-reader.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-reader.spec.js +109 -0
- package/dist/services/run-log/spec/log-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/log-summary.spec.js +153 -0
- package/dist/services/run-log/spec/redaction.spec.d.ts +1 -0
- package/dist/services/run-log/spec/redaction.spec.js +61 -0
- package/dist/services/run-log/spec/request-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-log.spec.js +101 -0
- package/dist/services/run-log/spec/request-summary.spec.d.ts +1 -0
- package/dist/services/run-log/spec/request-summary.spec.js +171 -0
- package/dist/services/run-log/spec/run-log.spec.d.ts +1 -0
- package/dist/services/run-log/spec/run-log.spec.js +122 -0
- package/dist/services/run-registry/exit-classification.d.ts +39 -0
- package/dist/services/run-registry/exit-classification.js +42 -0
- package/dist/services/run-registry/index.d.ts +3 -0
- package/dist/services/run-registry/index.js +3 -0
- package/dist/services/run-registry/process-identity.d.ts +28 -0
- package/dist/services/run-registry/process-identity.js +80 -0
- package/dist/services/run-registry/run-registry-model.d.ts +128 -0
- package/dist/services/run-registry/run-registry-model.js +16 -0
- package/dist/services/run-registry/run-registry.d.ts +155 -0
- package/dist/services/run-registry/run-registry.js +430 -0
- package/dist/services/run-registry/spec/exit-classification.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/exit-classification.spec.js +82 -0
- package/dist/services/run-registry/spec/run-registry.spec.d.ts +1 -0
- package/dist/services/run-registry/spec/run-registry.spec.js +526 -0
- package/dist/services/setup/os/tool-registry.js +2 -2
- package/oclif.manifest.json +3479 -358
- package/package.json +20 -2
|
@@ -0,0 +1,751 @@
|
|
|
1
|
+
import { expect } from "chai";
|
|
2
|
+
import { describe, it } from "mocha";
|
|
3
|
+
import { DebugSession, NoSuchBreakpointError, NotArmedError, NotPausedError, } from "../../control/debug-session.js";
|
|
4
|
+
import { PreloadRegistry, } from "../../control/preload-registry.js";
|
|
5
|
+
/** chai here has no promise plugin, so a rejection is caught rather than matched. */
|
|
6
|
+
async function rejection(work) {
|
|
7
|
+
try {
|
|
8
|
+
await work;
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
return error;
|
|
12
|
+
}
|
|
13
|
+
throw new Error("expected a rejection, but the call resolved");
|
|
14
|
+
}
|
|
15
|
+
class FakeTransport {
|
|
16
|
+
pageAvailable = true;
|
|
17
|
+
sent = [];
|
|
18
|
+
added = [];
|
|
19
|
+
removed = [];
|
|
20
|
+
/** The marks the page reports as written. */
|
|
21
|
+
marks = [];
|
|
22
|
+
/** Whether the document came from the SSR pass. */
|
|
23
|
+
prerendered = false;
|
|
24
|
+
/** How the document loaded, as `PerformanceNavigationTiming.type`. */
|
|
25
|
+
navigationType = "navigate";
|
|
26
|
+
/** Which breakpoint the page reports as the one that stopped it. */
|
|
27
|
+
lastBp = "BP3";
|
|
28
|
+
/** What an evaluation answers, by the expression it recognises. */
|
|
29
|
+
evalValue = null;
|
|
30
|
+
/**
|
|
31
|
+
* Whether V8 is stopped. An awaited evaluation never settles then — the
|
|
32
|
+
* microtask queue is frozen — so {@link evaluate} hangs, as Chrome's does.
|
|
33
|
+
*/
|
|
34
|
+
v8Paused = false;
|
|
35
|
+
/**
|
|
36
|
+
* What the thread probe answers, in order; the last one repeats. Empty means
|
|
37
|
+
* a transport that cannot probe, which answers null.
|
|
38
|
+
*/
|
|
39
|
+
threads = [];
|
|
40
|
+
/** The devtools panel's switches in the page's sessionStorage. */
|
|
41
|
+
panelFlags = [];
|
|
42
|
+
handlers = new Map();
|
|
43
|
+
counter = 0;
|
|
44
|
+
async send(method, params) {
|
|
45
|
+
this.sent.push({ method, params });
|
|
46
|
+
if (method === "Debugger.resume") {
|
|
47
|
+
this.v8Paused = false;
|
|
48
|
+
}
|
|
49
|
+
if (method === "Runtime.evaluate" ||
|
|
50
|
+
method === "Debugger.evaluateOnCallFrame") {
|
|
51
|
+
const expression = params?.expression ?? "";
|
|
52
|
+
if (expression.includes("sessionStorage.key(")) {
|
|
53
|
+
const set = [...this.panelFlags].sort();
|
|
54
|
+
if (expression.includes("sessionStorage.removeItem(key)")) {
|
|
55
|
+
this.panelFlags = [];
|
|
56
|
+
}
|
|
57
|
+
return { result: { value: JSON.stringify(set) } };
|
|
58
|
+
}
|
|
59
|
+
if (expression.includes("getEntriesByType('mark')") &&
|
|
60
|
+
!expression.includes("htmlClass")) {
|
|
61
|
+
return {
|
|
62
|
+
result: {
|
|
63
|
+
value: JSON.stringify({
|
|
64
|
+
marks: this.marks,
|
|
65
|
+
prerendered: this.prerendered,
|
|
66
|
+
navigationType: this.navigationType,
|
|
67
|
+
}),
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (expression.includes("htmlClass")) {
|
|
72
|
+
return {
|
|
73
|
+
result: {
|
|
74
|
+
value: JSON.stringify({
|
|
75
|
+
href: "https://shop.example.com/",
|
|
76
|
+
htmlClass: "sk-ready",
|
|
77
|
+
skGroup: "A",
|
|
78
|
+
marks: this.marks.map((name) => ({ name, t: 1 })),
|
|
79
|
+
lastBp: this.lastBp,
|
|
80
|
+
}),
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return { result: { value: this.evalValue } };
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
url() {
|
|
89
|
+
return "https://shop.example.com/";
|
|
90
|
+
}
|
|
91
|
+
async threadState() {
|
|
92
|
+
const [next, ...rest] = this.threads;
|
|
93
|
+
if (rest.length > 0)
|
|
94
|
+
this.threads = rest;
|
|
95
|
+
return next ?? null;
|
|
96
|
+
}
|
|
97
|
+
onCdp(event, handler) {
|
|
98
|
+
this.handlers.set(event, handler);
|
|
99
|
+
}
|
|
100
|
+
emit(event, payload) {
|
|
101
|
+
this.handlers.get(event)?.(payload);
|
|
102
|
+
}
|
|
103
|
+
async addScript(source) {
|
|
104
|
+
this.added.push(source);
|
|
105
|
+
this.counter += 1;
|
|
106
|
+
return `cdp-${this.counter}`;
|
|
107
|
+
}
|
|
108
|
+
async removeScript(identifier) {
|
|
109
|
+
this.removed.push(identifier);
|
|
110
|
+
}
|
|
111
|
+
async evaluate() {
|
|
112
|
+
if (this.v8Paused) {
|
|
113
|
+
return new Promise(() => undefined);
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
methods() {
|
|
118
|
+
return this.sent.map(({ method }) => method);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function build(extensionArms = false) {
|
|
122
|
+
const transport = new FakeTransport();
|
|
123
|
+
const session = new DebugSession(transport, new PreloadRegistry(transport), () => extensionArms);
|
|
124
|
+
return { session, transport };
|
|
125
|
+
}
|
|
126
|
+
/** A `Debugger.paused` payload in the shape Chrome sends one. */
|
|
127
|
+
function pausedPayload() {
|
|
128
|
+
return {
|
|
129
|
+
reason: "other",
|
|
130
|
+
callFrames: [
|
|
131
|
+
{
|
|
132
|
+
callFrameId: "frame-1",
|
|
133
|
+
// The script's url, not the page's — and the wrapper's script has none.
|
|
134
|
+
url: "",
|
|
135
|
+
location: { lineNumber: 12, columnNumber: 3 },
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
describe("DebugSession", () => {
|
|
141
|
+
describe("status", () => {
|
|
142
|
+
it("answers within one CDP budget when the page does not answer", async () => {
|
|
143
|
+
// Each read times out after its budget on a stuck page. In sequence they
|
|
144
|
+
// outlasted the client's 5 s, which saw only CONTROL_TIMEOUT.
|
|
145
|
+
const { session, transport } = build();
|
|
146
|
+
const slow = () => new Promise((_, reject) => setTimeout(() => reject(new Error("CDP_TIMEOUT")), 150));
|
|
147
|
+
transport.send = slow;
|
|
148
|
+
transport.threadState = slow;
|
|
149
|
+
const started = Date.now();
|
|
150
|
+
const status = await session.status();
|
|
151
|
+
expect(Date.now() - started).to.be.below(290);
|
|
152
|
+
expect(status.paused).to.equal(null);
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
describe("arming", () => {
|
|
156
|
+
it("should hold the debugger open and install the hooks", async () => {
|
|
157
|
+
// Holding Debugger.enable is the whole trick: an injected `debugger;` is
|
|
158
|
+
// a no-op unless a debugger is attached, which is why this works with
|
|
159
|
+
// DevTools closed.
|
|
160
|
+
const { session, transport } = build();
|
|
161
|
+
const status = await session.arm([1, 3], "reload");
|
|
162
|
+
expect(transport.methods()).to.include("Debugger.enable");
|
|
163
|
+
// A navigation, not Page.reload: Speed Kit does not serve a reload from
|
|
164
|
+
// its cache, so a reload is not the load the breakpoints are for.
|
|
165
|
+
expect(transport.methods()).to.not.include("Page.reload");
|
|
166
|
+
expect(transport.sent.find(({ method }) => method === "Page.navigate")?.params).to.deep.equal({ url: "https://shop.example.com/" });
|
|
167
|
+
expect(status.armed).to.deep.equal([1, 3]);
|
|
168
|
+
expect(status.attached).to.equal(true);
|
|
169
|
+
expect(transport.added[0]).to.contain("debugger;");
|
|
170
|
+
});
|
|
171
|
+
it("should arm all four when asked for none in particular", async () => {
|
|
172
|
+
const { session } = build();
|
|
173
|
+
const status = await session.arm(undefined);
|
|
174
|
+
expect(status.armed).to.deep.equal([1, 2, 3, 4]);
|
|
175
|
+
});
|
|
176
|
+
it("should refuse a breakpoint that does not exist", async () => {
|
|
177
|
+
const { session } = build();
|
|
178
|
+
const error = await rejection(session.arm([7]));
|
|
179
|
+
expect(error).to.be.instanceOf(NoSuchBreakpointError);
|
|
180
|
+
expect(error.breakpoints).to.deep.equal([
|
|
181
|
+
1, 2, 3, 4,
|
|
182
|
+
]);
|
|
183
|
+
});
|
|
184
|
+
it("should list the hooks as a reserved preload", async () => {
|
|
185
|
+
// An agent that reads `sk onboarding inject list`, sees nothing, and concludes the
|
|
186
|
+
// page is unmodified while the debugger has hooks in it has been misled
|
|
187
|
+
// by the tool built to prevent exactly that.
|
|
188
|
+
const transport = new FakeTransport();
|
|
189
|
+
const preloads = new PreloadRegistry(transport);
|
|
190
|
+
const session = new DebugSession(transport, preloads);
|
|
191
|
+
await session.arm([1]);
|
|
192
|
+
const listed = await preloads.list();
|
|
193
|
+
expect(listed.preloads).to.have.length(1);
|
|
194
|
+
expect(listed.preloads[0].reserved).to.equal(true);
|
|
195
|
+
expect(listed.preloads[0].origin).to.equal("debug");
|
|
196
|
+
});
|
|
197
|
+
it("should leave the hooks alone when a caller clears their own preloads", async () => {
|
|
198
|
+
const transport = new FakeTransport();
|
|
199
|
+
const preloads = new PreloadRegistry(transport);
|
|
200
|
+
const session = new DebugSession(transport, preloads);
|
|
201
|
+
await session.arm([1]);
|
|
202
|
+
await preloads.add({ source: "record(1)" });
|
|
203
|
+
const cleared = await preloads.clear();
|
|
204
|
+
expect(cleared.removed).to.deep.equal(["p1"]);
|
|
205
|
+
expect((await preloads.list()).preloads).to.have.length(1);
|
|
206
|
+
});
|
|
207
|
+
it("should re-arm by replacing the set rather than stacking a wrapper", async () => {
|
|
208
|
+
// Two wrappers would pause twice and attribute the second one's
|
|
209
|
+
// breakpoint to the first one's frame.
|
|
210
|
+
const { session, transport } = build();
|
|
211
|
+
await session.arm([1]);
|
|
212
|
+
await session.arm([2]);
|
|
213
|
+
expect(transport.removed).to.have.length(1);
|
|
214
|
+
expect(transport.added.at(-1)).to.contain("baqend-blocking-script-end");
|
|
215
|
+
expect(transport.added.at(-1)).to.not.contain("baqend-blocking-script-start");
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
describe("which tier arms the breakpoints", () => {
|
|
219
|
+
it("wraps performance.mark when no extension is there to do better", async () => {
|
|
220
|
+
const { session, transport } = build(false);
|
|
221
|
+
await session.arm([1]);
|
|
222
|
+
expect(transport.added[0]).to.contain("performance.mark = function");
|
|
223
|
+
expect(transport.added[0]).to.contain("debugger;");
|
|
224
|
+
});
|
|
225
|
+
it("only sets the extension's flags when the extension is loaded", async () => {
|
|
226
|
+
// Both sides can arm and installing both gets two pauses for one
|
|
227
|
+
// breakpoint, reporting the second one's frame for the first.
|
|
228
|
+
const { session, transport } = build(true);
|
|
229
|
+
await session.arm([1, 3]);
|
|
230
|
+
// The wrapper is the thing that must not be installed. `debugger;` itself
|
|
231
|
+
// appears in a comment explaining the hook, so the absence of the
|
|
232
|
+
// statement is checked by the absence of what carries it.
|
|
233
|
+
expect(transport.added[0]).to.not.contain("performance.mark = function");
|
|
234
|
+
expect(transport.added[0]).to.contain('setItem("sk-devtools-bp1", "on")');
|
|
235
|
+
expect(transport.added[0]).to.contain('setItem("sk-devtools-bp3", "on")');
|
|
236
|
+
});
|
|
237
|
+
it("touches only the flags it is arming, on a first arm", async () => {
|
|
238
|
+
// It owns what it set and nothing else. A flag it never wrote belongs to
|
|
239
|
+
// whoever did — the panel, and therefore a person — so a fresh arm has no
|
|
240
|
+
// business clearing it.
|
|
241
|
+
const { session, transport } = build(true);
|
|
242
|
+
await session.arm([2]);
|
|
243
|
+
expect(transport.added[0]).to.contain('setItem("sk-devtools-bp2", "on")');
|
|
244
|
+
expect(transport.added[0]).to.not.contain("sk-devtools-bp1");
|
|
245
|
+
expect(transport.added[0]).to.not.contain("sk-devtools-bp3");
|
|
246
|
+
});
|
|
247
|
+
it("chains the extension's pause hook rather than replacing it", async () => {
|
|
248
|
+
// It is how the CLI learns which breakpoint stopped the page without
|
|
249
|
+
// wrapping anything — and clobbering it would put out the panel's own
|
|
250
|
+
// pill, which tells the human the same thing.
|
|
251
|
+
const { session, transport } = build(true);
|
|
252
|
+
await session.arm([1]);
|
|
253
|
+
expect(transport.added[0]).to.contain("__skDevtoolsBpPause");
|
|
254
|
+
expect(transport.added[0]).to.contain("previousHook.apply");
|
|
255
|
+
});
|
|
256
|
+
it("also sets the flags on the fallback tier", async () => {
|
|
257
|
+
// A panel opened later should find the same breakpoints armed as the
|
|
258
|
+
// ones actually pausing the page.
|
|
259
|
+
const { session, transport } = build(false);
|
|
260
|
+
await session.arm([4]);
|
|
261
|
+
expect(transport.added[0]).to.contain('setItem("sk-devtools-bp4", "on")');
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
describe("arm --compared", () => {
|
|
265
|
+
it("wraps the comparison marks even when the extension is loaded", async () => {
|
|
266
|
+
const { session, transport } = build(true);
|
|
267
|
+
await session.arm([1, 3], "none", true);
|
|
268
|
+
expect(transport.added[0]).to.contain("performance.mark = function");
|
|
269
|
+
expect(transport.added[0]).to.contain('"skChangeDetectionStart":1');
|
|
270
|
+
expect(transport.added[0]).to.contain('"sk-prerender-change-detection-start":3');
|
|
271
|
+
expect(transport.added[0]).to.contain('removeItem("sk-devtools-bp1")');
|
|
272
|
+
expect(transport.added[0]).to.not.contain('setItem("sk-devtools-bp1"');
|
|
273
|
+
});
|
|
274
|
+
it("copies the sides from BP1's calling frame", async () => {
|
|
275
|
+
const { session, transport } = build();
|
|
276
|
+
transport.lastBp = "BP1";
|
|
277
|
+
transport.evalValue = { pass: "regular", legacy: false, rules: 2 };
|
|
278
|
+
await session.arm([1], "none", true);
|
|
279
|
+
const waiting = session.awaitPause(2000);
|
|
280
|
+
const payload = pausedPayload();
|
|
281
|
+
payload.callFrames.push({
|
|
282
|
+
...payload.callFrames[0],
|
|
283
|
+
callFrameId: "frame-2",
|
|
284
|
+
});
|
|
285
|
+
transport.emit("Debugger.paused", payload);
|
|
286
|
+
const result = await waiting;
|
|
287
|
+
const capture = transport.sent.find(({ params }) => params?.expression?.includes("__skCD = "));
|
|
288
|
+
expect(capture?.params).to.include({ callFrameId: "frame-2" });
|
|
289
|
+
expect(result.pause?.compared).to.deep.equal(transport.evalValue);
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
describe("what the panel is told", () => {
|
|
293
|
+
it("reports the armed set so the panel's switches can mirror it", async () => {
|
|
294
|
+
// The panel's switches are backed by extension storage rather than read
|
|
295
|
+
// back from the page — an eval during a navigation races the document
|
|
296
|
+
// swap and queues behind a paused thread, which is exactly what an armed
|
|
297
|
+
// breakpoint produces. So the arming has to reach it by another route.
|
|
298
|
+
const { session } = build(true);
|
|
299
|
+
await session.arm([1, 3]);
|
|
300
|
+
expect(session.armedBreakpoints).to.deep.equal([1, 3]);
|
|
301
|
+
});
|
|
302
|
+
it("reports an empty set once disarmed", async () => {
|
|
303
|
+
// A mirror that only updated on the way in would leave a switch lit for
|
|
304
|
+
// a breakpoint that is no longer armed.
|
|
305
|
+
const { session } = build(true);
|
|
306
|
+
await session.arm([1]);
|
|
307
|
+
await session.disarm();
|
|
308
|
+
expect(session.armedBreakpoints).to.deep.equal([]);
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
describe("pause control", () => {
|
|
312
|
+
it("should refuse to resume or step a page that is not paused", async () => {
|
|
313
|
+
const { session } = build();
|
|
314
|
+
await session.arm([1]);
|
|
315
|
+
expect(await rejection(session.resume())).to.be.instanceOf(NotPausedError);
|
|
316
|
+
expect(await rejection(session.step("over"))).to.be.instanceOf(NotPausedError);
|
|
317
|
+
});
|
|
318
|
+
it("should blame a reload for an unaccelerated document, not the cache", async () => {
|
|
319
|
+
// Speed Kit's worker does not serve a reload from its cache, and a
|
|
320
|
+
// reading that said "not accelerated" sent the caller after the cache.
|
|
321
|
+
const { session, transport } = build();
|
|
322
|
+
transport.navigationType = "reload";
|
|
323
|
+
await session.arm([2]);
|
|
324
|
+
const result = await session.awaitPause(20);
|
|
325
|
+
expect(result.navigationType).to.equal("reload");
|
|
326
|
+
expect(result.diagnosis).to.contain("was a reload");
|
|
327
|
+
});
|
|
328
|
+
it("should always answer with paused and pause, paused or not", async () => {
|
|
329
|
+
// An answer without them was read as a pause. JSON drops what is
|
|
330
|
+
// undefined, so the contract is checked after a round trip.
|
|
331
|
+
const { session, transport } = build();
|
|
332
|
+
await session.arm([3]);
|
|
333
|
+
const quiet = JSON.parse(JSON.stringify(await session.awaitPause(10)));
|
|
334
|
+
expect(quiet).to.include({ paused: false, pause: null, fired: false });
|
|
335
|
+
// `paused` is set at once, the pause itself once its frame is read.
|
|
336
|
+
const send = transport.send.bind(transport);
|
|
337
|
+
transport.send = (method, params) => method === "Debugger.evaluateOnCallFrame"
|
|
338
|
+
? new Promise(() => undefined)
|
|
339
|
+
: send(method, params);
|
|
340
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
341
|
+
const result = JSON.parse(JSON.stringify(await session.awaitPause(10)));
|
|
342
|
+
expect(result).to.include({ paused: true, pause: null, fired: false });
|
|
343
|
+
});
|
|
344
|
+
it("should refuse to wait when nothing is armed", async () => {
|
|
345
|
+
const { session } = build();
|
|
346
|
+
expect(await rejection(session.awaitPause(10))).to.be.instanceOf(NotArmedError);
|
|
347
|
+
});
|
|
348
|
+
it("should hand back the state at the pause", async () => {
|
|
349
|
+
const { session, transport } = build();
|
|
350
|
+
transport.marks = ["sk-prerender-change-detection-end"];
|
|
351
|
+
await session.arm([3]);
|
|
352
|
+
const waiting = session.awaitPause(2000);
|
|
353
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
354
|
+
const result = await waiting;
|
|
355
|
+
expect(result.fired).to.equal(true);
|
|
356
|
+
expect(result.timedOut).to.equal(false);
|
|
357
|
+
expect(result.pause?.bp).to.equal("BP3");
|
|
358
|
+
expect(result.pause?.url).to.equal("https://shop.example.com/");
|
|
359
|
+
expect(result.pause?.scriptUrl).to.equal(null);
|
|
360
|
+
expect(result.pause?.state.skGroup).to.equal("A");
|
|
361
|
+
expect(result.pause?.state).not.to.have.property("href");
|
|
362
|
+
});
|
|
363
|
+
it("should keep the script a pause is in apart from the page", async () => {
|
|
364
|
+
const { session, transport } = build();
|
|
365
|
+
await session.arm([3]);
|
|
366
|
+
const waiting = session.awaitPause(2000);
|
|
367
|
+
const payload = pausedPayload();
|
|
368
|
+
payload.callFrames[0].url = "https://shop.example.com/speed-kit-dom.js";
|
|
369
|
+
transport.emit("Debugger.paused", payload);
|
|
370
|
+
const result = await waiting;
|
|
371
|
+
expect(result.pause?.url).to.equal("https://shop.example.com/");
|
|
372
|
+
expect(result.pause?.scriptUrl).to.equal("https://shop.example.com/speed-kit-dom.js");
|
|
373
|
+
});
|
|
374
|
+
it("should answer immediately when it is already paused", async () => {
|
|
375
|
+
const { session, transport } = build();
|
|
376
|
+
await session.arm([3]);
|
|
377
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
378
|
+
// The handler is async; let it settle before asking.
|
|
379
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
380
|
+
const result = await session.awaitPause(2000);
|
|
381
|
+
expect(result.fired).to.equal(true);
|
|
382
|
+
expect(result.waitedMs).to.equal(0);
|
|
383
|
+
});
|
|
384
|
+
it("should resume, and stop claiming to be paused", async () => {
|
|
385
|
+
const { session, transport } = build();
|
|
386
|
+
await session.arm([1]);
|
|
387
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
388
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
389
|
+
const resumed = await session.resume();
|
|
390
|
+
expect(resumed.paused).to.equal(false);
|
|
391
|
+
expect(transport.methods()).to.include("Debugger.resume");
|
|
392
|
+
});
|
|
393
|
+
it("should stop reporting a pause once the page resumed", async () => {
|
|
394
|
+
// A `pause` beside `paused: false` reads like a page still stopped.
|
|
395
|
+
const { session, transport } = build();
|
|
396
|
+
await session.arm([1]);
|
|
397
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
398
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
399
|
+
expect((await session.status()).pause?.bp).to.equal("BP3");
|
|
400
|
+
transport.emit("Debugger.resumed", {});
|
|
401
|
+
const status = await session.status();
|
|
402
|
+
expect(status.paused).to.equal(false);
|
|
403
|
+
expect(status.pause).to.equal(null);
|
|
404
|
+
});
|
|
405
|
+
it("should map each step to its own CDP method", async () => {
|
|
406
|
+
const { session, transport } = build();
|
|
407
|
+
await session.arm([1]);
|
|
408
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
409
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
410
|
+
await session.step("into");
|
|
411
|
+
expect(transport.methods()).to.include("Debugger.stepInto");
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
describe("the diagnosis, which is the point of the timeout", () => {
|
|
415
|
+
it("should call out a skipped SSR comparison as the expected outcome", async () => {
|
|
416
|
+
const { session, transport } = build();
|
|
417
|
+
await session.arm([3]);
|
|
418
|
+
transport.emit("Runtime.consoleAPICalled", {
|
|
419
|
+
args: [{ value: "__SK_DEBUG_CD_SKIPPED__device-mismatch" }],
|
|
420
|
+
});
|
|
421
|
+
const result = await session.awaitPause(10);
|
|
422
|
+
expect(result.timedOut).to.equal(true);
|
|
423
|
+
expect(result.changeDetectionSkipped).to.equal("device-mismatch");
|
|
424
|
+
expect(result.diagnosis).to.contain("expected outcome");
|
|
425
|
+
});
|
|
426
|
+
it("should say the hooks are missing when the mark was written anyway", async () => {
|
|
427
|
+
// The mark happened and nothing paused, so the preload is not in this
|
|
428
|
+
// document — a reload is the fix, not a longer wait.
|
|
429
|
+
const { session, transport } = build();
|
|
430
|
+
transport.marks = ["baqend-blocking-script-start"];
|
|
431
|
+
await session.arm([1]);
|
|
432
|
+
const result = await session.awaitPause(10);
|
|
433
|
+
expect(result.diagnosis).to.contain("hooks are not in this document");
|
|
434
|
+
expect(result.breakpoints.find((one) => one.bp === 1)?.seen).to.equal(true);
|
|
435
|
+
});
|
|
436
|
+
it("should not blame a breakpoint that already paused on this load", async () => {
|
|
437
|
+
// The bug this replaced: a breakpoint that fired and was resumed leaves
|
|
438
|
+
// the same trace as one whose hook was never installed — mark written,
|
|
439
|
+
// nothing paused now — so the diagnosis accused the two that had just
|
|
440
|
+
// worked and said nothing about the two being waited on.
|
|
441
|
+
const { session, transport } = build();
|
|
442
|
+
transport.marks = ["baqend-blocking-script-start"];
|
|
443
|
+
transport.lastBp = "BP1";
|
|
444
|
+
await session.arm([1]);
|
|
445
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
446
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
447
|
+
await session.resume();
|
|
448
|
+
const result = await session.awaitPause(10);
|
|
449
|
+
expect(result.diagnosis).to.not.contain("hooks are not in this document");
|
|
450
|
+
expect(result.breakpoints.find((one) => one.bp === 1)?.fired).to.equal(true);
|
|
451
|
+
});
|
|
452
|
+
it("should name the SSR pass when the document was not pre-rendered", async () => {
|
|
453
|
+
// The reading the caller can act on: no amount of re-arming makes BP3 or
|
|
454
|
+
// BP4 fire on a document that never went through the SSR pass.
|
|
455
|
+
const { session, transport } = build();
|
|
456
|
+
transport.marks = ["baqend-blocking-script-start"];
|
|
457
|
+
transport.prerendered = false;
|
|
458
|
+
await session.arm([3, 4]);
|
|
459
|
+
const result = await session.awaitPause(10);
|
|
460
|
+
expect(result.diagnosis).to.contain("not pre-rendered");
|
|
461
|
+
expect(result.diagnosis).to.contain("BP3, BP4");
|
|
462
|
+
expect(result.prerendered).to.equal(false);
|
|
463
|
+
});
|
|
464
|
+
it("should forget what fired once the page navigates", async () => {
|
|
465
|
+
// "Already had its turn" is a fact about one document.
|
|
466
|
+
const { session, transport } = build();
|
|
467
|
+
transport.lastBp = "BP1";
|
|
468
|
+
await session.arm([1]);
|
|
469
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
470
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
471
|
+
expect((await session.status()).breakpoints.find((one) => one.bp === 1)?.fired).to.equal(true);
|
|
472
|
+
transport.emit("Page.frameNavigated", { frame: { id: "main" } });
|
|
473
|
+
expect((await session.status()).breakpoints.find((one) => one.bp === 1)?.fired).to.equal(false);
|
|
474
|
+
});
|
|
475
|
+
it("should ignore a subframe navigating", async () => {
|
|
476
|
+
// An iframe loading does not replace the document the breakpoints are in.
|
|
477
|
+
const { session, transport } = build();
|
|
478
|
+
transport.lastBp = "BP1";
|
|
479
|
+
await session.arm([1]);
|
|
480
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
481
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
482
|
+
transport.emit("Page.frameNavigated", {
|
|
483
|
+
frame: { id: "child", parentId: "main" },
|
|
484
|
+
});
|
|
485
|
+
expect((await session.status()).breakpoints.find((one) => one.bp === 1)?.fired).to.equal(true);
|
|
486
|
+
});
|
|
487
|
+
it("should say the page was never accelerated when no mark exists at all", async () => {
|
|
488
|
+
const { session } = build();
|
|
489
|
+
await session.arm([1, 2]);
|
|
490
|
+
const result = await session.awaitPause(10);
|
|
491
|
+
expect(result.diagnosis).to.contain("not accelerated");
|
|
492
|
+
});
|
|
493
|
+
});
|
|
494
|
+
describe("eval", () => {
|
|
495
|
+
it("should use the paused call frame when the page is paused", async () => {
|
|
496
|
+
// An ordinary evaluation against a paused page sees globals and not one
|
|
497
|
+
// local, which is most of the reason to have paused.
|
|
498
|
+
const { session, transport } = build();
|
|
499
|
+
await session.arm([1]);
|
|
500
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
501
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
502
|
+
transport.evalValue = 42;
|
|
503
|
+
const result = await session.evaluate("someLocal");
|
|
504
|
+
expect(result.onCallFrame).to.equal(true);
|
|
505
|
+
expect(result.value).to.equal(42);
|
|
506
|
+
expect(transport.methods()).to.include("Debugger.evaluateOnCallFrame");
|
|
507
|
+
});
|
|
508
|
+
it("should wrap a top-level await, which a classic script cannot have", async () => {
|
|
509
|
+
// `await x` in a plain evaluation is a SyntaxError, not a slow answer,
|
|
510
|
+
// and that reads as a broken tool rather than as "wrap it yourself".
|
|
511
|
+
const { session, transport } = build();
|
|
512
|
+
transport.evalValue = "registrations";
|
|
513
|
+
const result = await session.evaluate("await navigator.serviceWorker.getRegistrations()");
|
|
514
|
+
const sent = transport.sent.find((call) => call.method === "Runtime.evaluate");
|
|
515
|
+
expect(sent?.params).to.include({ replMode: true });
|
|
516
|
+
expect(result.value).to.equal("registrations");
|
|
517
|
+
});
|
|
518
|
+
it("should refuse an await on a paused frame rather than hang", async () => {
|
|
519
|
+
// The microtask queue is frozen while the inspector is paused, so an
|
|
520
|
+
// awaited promise can never settle: wrapping it would hang instead of
|
|
521
|
+
// failing, and resuming first is the only thing that can work.
|
|
522
|
+
const { session, transport } = build();
|
|
523
|
+
await session.arm([1]);
|
|
524
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
525
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
526
|
+
const result = await session.evaluate("await somePromise");
|
|
527
|
+
expect(result.exception).to.contain("resume");
|
|
528
|
+
// The pause itself reads state on the call frame, so the assertion is
|
|
529
|
+
// that *this* expression never reached the page, not that the method was
|
|
530
|
+
// never used.
|
|
531
|
+
expect(transport.sent.some((call) => JSON.stringify(call.params ?? {}).includes("somePromise"))).to.equal(false);
|
|
532
|
+
});
|
|
533
|
+
it("should evaluate an awaiting probe file as it is, in REPL mode", async () => {
|
|
534
|
+
const { session, transport } = build();
|
|
535
|
+
const probe = "(async () => {\n return await fetch('/');\n})();\n";
|
|
536
|
+
await session.evaluate(probe);
|
|
537
|
+
const call = transport.sent.find(({ method }) => method === "Runtime.evaluate");
|
|
538
|
+
expect(call?.params).to.include({ expression: probe, replMode: true });
|
|
539
|
+
});
|
|
540
|
+
it("should fall back to an ordinary evaluation, and say so", async () => {
|
|
541
|
+
const { session, transport } = build();
|
|
542
|
+
transport.evalValue = "here";
|
|
543
|
+
const result = await session.evaluate("document.title");
|
|
544
|
+
expect(result.onCallFrame).to.equal(false);
|
|
545
|
+
expect(result.value).to.equal("here");
|
|
546
|
+
});
|
|
547
|
+
});
|
|
548
|
+
describe("a pause this run did not cause", () => {
|
|
549
|
+
it("should see it, and say it is not this run's", async () => {
|
|
550
|
+
// Nothing armed, nothing attached: the pause is a switch lit in the
|
|
551
|
+
// panel, or a breakpoint in the Sources panel. It is invisible to
|
|
552
|
+
// Debugger.paused from here, and measured instead.
|
|
553
|
+
const { session, transport } = build();
|
|
554
|
+
transport.threads = ["paused"];
|
|
555
|
+
const status = await session.status();
|
|
556
|
+
expect(status.paused).to.equal(true);
|
|
557
|
+
expect(status.pausedBy).to.equal("elsewhere");
|
|
558
|
+
expect(status.thread).to.equal("paused");
|
|
559
|
+
expect(status.pause).to.equal(null);
|
|
560
|
+
});
|
|
561
|
+
it("should name the panel switches set in the page", async () => {
|
|
562
|
+
// The extension arms from these whoever wrote them, so `armed: []` next
|
|
563
|
+
// to a lit switch is a page that pauses on its next load.
|
|
564
|
+
const { session, transport } = build();
|
|
565
|
+
transport.panelFlags = ["sk-devtools-bp1", "sk-devtools-bp-config"];
|
|
566
|
+
const status = await session.status();
|
|
567
|
+
expect(status.armed).to.deep.equal([]);
|
|
568
|
+
expect(status.pageArmed).to.deep.equal([
|
|
569
|
+
"sk-devtools-bp-config",
|
|
570
|
+
"sk-devtools-bp1",
|
|
571
|
+
]);
|
|
572
|
+
});
|
|
573
|
+
});
|
|
574
|
+
describe("release", () => {
|
|
575
|
+
it("should resume a pause held elsewhere, and only just attach for it", async () => {
|
|
576
|
+
const { session, transport } = build();
|
|
577
|
+
transport.threads = ["paused", "running"];
|
|
578
|
+
const result = await session.release();
|
|
579
|
+
const methods = transport.methods();
|
|
580
|
+
expect(methods.indexOf("Debugger.enable")).to.be.lessThan(methods.indexOf("Debugger.resume"));
|
|
581
|
+
expect(methods.indexOf("Debugger.resume")).to.be.lessThan(methods.lastIndexOf("Debugger.disable"));
|
|
582
|
+
expect(result.resumedForeignPause).to.equal(true);
|
|
583
|
+
expect(result.thread).to.equal("running");
|
|
584
|
+
expect((await session.status()).attached).to.equal(false);
|
|
585
|
+
});
|
|
586
|
+
it("should take every panel switch out of the page, the ones it does not number too", async () => {
|
|
587
|
+
// `bp-config` has no number on this side. A prefix match is what gets it.
|
|
588
|
+
const { session, transport } = build();
|
|
589
|
+
transport.threads = ["running"];
|
|
590
|
+
transport.panelFlags = ["sk-devtools-bp-config", "sk-devtools-bp2"];
|
|
591
|
+
const result = await session.release();
|
|
592
|
+
expect(result.cleared).to.deep.equal([
|
|
593
|
+
"sk-devtools-bp-config",
|
|
594
|
+
"sk-devtools-bp2",
|
|
595
|
+
]);
|
|
596
|
+
expect(transport.panelFlags).to.deep.equal([]);
|
|
597
|
+
});
|
|
598
|
+
it("should disarm this run on the way", async () => {
|
|
599
|
+
const { session, transport } = build();
|
|
600
|
+
transport.threads = ["running"];
|
|
601
|
+
await session.arm([1, 3]);
|
|
602
|
+
const result = await session.release();
|
|
603
|
+
expect(result.disarmed).to.deep.equal([1, 3]);
|
|
604
|
+
expect(session.armedBreakpoints).to.deep.equal([]);
|
|
605
|
+
});
|
|
606
|
+
it("should tell the panel, because clearing the page does not last", async () => {
|
|
607
|
+
// The panel writes a lit switch back into sessionStorage on every page
|
|
608
|
+
// start. Only the panel dropping it makes the release stick.
|
|
609
|
+
const transport = new FakeTransport();
|
|
610
|
+
transport.threads = ["running"];
|
|
611
|
+
let released = 0;
|
|
612
|
+
const session = new DebugSession(transport, new PreloadRegistry(transport), () => false, () => (released += 1));
|
|
613
|
+
await session.release();
|
|
614
|
+
expect(released).to.equal(1);
|
|
615
|
+
});
|
|
616
|
+
it("should say plainly when the page stopped again, and why it cannot help", async () => {
|
|
617
|
+
// A Sources-panel breakpoint lives in that DevTools session; V8 keeps
|
|
618
|
+
// breakpoints per session, so it re-pauses whatever this run resumes.
|
|
619
|
+
const { session, transport } = build();
|
|
620
|
+
transport.threads = ["paused"];
|
|
621
|
+
const result = await session.release();
|
|
622
|
+
expect(result.thread).to.equal("paused");
|
|
623
|
+
expect(result.did).to.contain("Sources panel");
|
|
624
|
+
});
|
|
625
|
+
it("should say plainly when nothing was holding the page", async () => {
|
|
626
|
+
const { session, transport } = build();
|
|
627
|
+
transport.threads = ["running"];
|
|
628
|
+
const result = await session.release();
|
|
629
|
+
expect(result.did).to.contain("nothing was holding the page");
|
|
630
|
+
expect(transport.methods()).to.not.include("Debugger.resume");
|
|
631
|
+
});
|
|
632
|
+
});
|
|
633
|
+
describe("disarm", () => {
|
|
634
|
+
it("should unwrite the flags from the document that is loaded now", async () => {
|
|
635
|
+
// Releasing the preload only stops the *next* load being armed. With the
|
|
636
|
+
// extension tier the arming lives in the page's sessionStorage, which
|
|
637
|
+
// survives reloads for the life of the tab — so without this the
|
|
638
|
+
// injector re-arms every load for ever while the server reports
|
|
639
|
+
// `armed: []`.
|
|
640
|
+
const { session, transport } = build(true);
|
|
641
|
+
await session.arm([1, 3]);
|
|
642
|
+
await session.disarm();
|
|
643
|
+
const cleared = transport.sent.find((call) => call.method === "Runtime.evaluate" &&
|
|
644
|
+
JSON.stringify(call.params ?? {}).includes("removeItem"));
|
|
645
|
+
expect(cleared).to.not.equal(undefined);
|
|
646
|
+
const expression = (cleared?.params).expression;
|
|
647
|
+
expect(expression).to.contain("sk-devtools-bp1");
|
|
648
|
+
expect(expression).to.contain("sk-devtools-bp3");
|
|
649
|
+
});
|
|
650
|
+
it("should empty the fallback tier's own global too", async () => {
|
|
651
|
+
// Masked by `Debugger.disable` — a `debugger;` with nothing attached is a
|
|
652
|
+
// no-op — right up until someone opens DevTools.
|
|
653
|
+
const { session, transport } = build(false);
|
|
654
|
+
await session.arm([1]);
|
|
655
|
+
await session.disarm();
|
|
656
|
+
const cleared = transport.sent.find((call) => call.method === "Runtime.evaluate" &&
|
|
657
|
+
JSON.stringify(call.params ?? {}).includes("__SK_DEBUG_ARMED = {}"));
|
|
658
|
+
expect(cleared).to.not.equal(undefined);
|
|
659
|
+
});
|
|
660
|
+
it("should leave a flag it never set alone", async () => {
|
|
661
|
+
// The panel's switches are a person's. An arm that cleared them would be
|
|
662
|
+
// the silent state change every guardrail here exists to prevent.
|
|
663
|
+
const { session, transport } = build(true);
|
|
664
|
+
await session.arm([1]);
|
|
665
|
+
await session.disarm();
|
|
666
|
+
const touched = transport.sent
|
|
667
|
+
.concat(transport.added.map((source) => ({
|
|
668
|
+
method: "add",
|
|
669
|
+
params: { source },
|
|
670
|
+
})))
|
|
671
|
+
.map((call) => JSON.stringify(call.params ?? {}))
|
|
672
|
+
.join(" ");
|
|
673
|
+
expect(touched).to.not.contain("sk-devtools-bp2");
|
|
674
|
+
expect(touched).to.not.contain("sk-devtools-bp4");
|
|
675
|
+
});
|
|
676
|
+
it("should release only the breakpoints it is giving up on a re-arm", async () => {
|
|
677
|
+
const { session, transport } = build(true);
|
|
678
|
+
await session.arm([1, 2]);
|
|
679
|
+
await session.arm([2]);
|
|
680
|
+
const source = transport.added.at(-1) ?? "";
|
|
681
|
+
expect(source).to.contain('removeItem("sk-devtools-bp1")');
|
|
682
|
+
expect(source).to.contain('setItem("sk-devtools-bp2", "on")');
|
|
683
|
+
expect(source).to.not.contain("sk-devtools-bp3");
|
|
684
|
+
});
|
|
685
|
+
it("should resume a paused page rather than leave the run wedged", async () => {
|
|
686
|
+
// Nobody else would know why the page had stopped, or what to call to
|
|
687
|
+
// start it again.
|
|
688
|
+
const { session, transport } = build();
|
|
689
|
+
await session.arm([1]);
|
|
690
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
691
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
692
|
+
const result = await session.disarm();
|
|
693
|
+
expect(transport.methods()).to.include("Debugger.resume");
|
|
694
|
+
expect(transport.methods()).to.include("Debugger.disable");
|
|
695
|
+
expect(result.did).to.contain("disarmed");
|
|
696
|
+
expect((await session.status()).armed).to.deep.equal([]);
|
|
697
|
+
});
|
|
698
|
+
it("should answer while the page is paused", async () => {
|
|
699
|
+
// Releasing the preload switches off the copy in the page with an awaited
|
|
700
|
+
// evaluation, which a paused V8 never settles. Resuming after it meant
|
|
701
|
+
// the disarm sat out the evaluation's whole timeout.
|
|
702
|
+
const { session, transport } = build();
|
|
703
|
+
await session.arm([1]);
|
|
704
|
+
transport.v8Paused = true;
|
|
705
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
706
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
707
|
+
const result = await Promise.race([
|
|
708
|
+
session.disarm(),
|
|
709
|
+
new Promise((resolve) => setTimeout(() => resolve(null), 500)),
|
|
710
|
+
]);
|
|
711
|
+
expect(result, "disarm hung on the paused page").to.not.equal(null);
|
|
712
|
+
const methods = transport.methods();
|
|
713
|
+
expect(methods.indexOf("Debugger.setSkipAllPauses")).to.be.lessThan(methods.lastIndexOf("Debugger.resume"));
|
|
714
|
+
});
|
|
715
|
+
it("should not claim to know about a pause once detached", async () => {
|
|
716
|
+
const { session, transport } = build();
|
|
717
|
+
await session.arm([1]);
|
|
718
|
+
transport.emit("Debugger.paused", pausedPayload());
|
|
719
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
720
|
+
await session.disarm();
|
|
721
|
+
const status = await session.status();
|
|
722
|
+
expect(status.attached).to.equal(false);
|
|
723
|
+
expect(status.paused).to.equal(null);
|
|
724
|
+
expect(status.pause).to.equal(null);
|
|
725
|
+
});
|
|
726
|
+
it("should let pauses through again on the next arm", async () => {
|
|
727
|
+
const { session, transport } = build();
|
|
728
|
+
await session.arm([1]);
|
|
729
|
+
await session.disarm();
|
|
730
|
+
await session.arm([1]);
|
|
731
|
+
const skips = transport.sent.filter(({ method }) => method === "Debugger.setSkipAllPauses");
|
|
732
|
+
expect(skips.at(-1)?.params).to.deep.equal({ skip: false });
|
|
733
|
+
});
|
|
734
|
+
it("should report the emptied set to the panel, not the old one", async () => {
|
|
735
|
+
// The release is what reports to the panel, and nothing reports after
|
|
736
|
+
// it. A report naming the old set leaves the panel's switches lit, and
|
|
737
|
+
// the panel re-arms every load from them.
|
|
738
|
+
const transport = new FakeTransport();
|
|
739
|
+
const reported = [];
|
|
740
|
+
// The callback runs during `arm`, after `session` is initialised.
|
|
741
|
+
const session = new DebugSession(transport, new PreloadRegistry(transport, () => reported.push(session.armedBreakpoints)));
|
|
742
|
+
await session.arm([1, 2]);
|
|
743
|
+
await session.disarm();
|
|
744
|
+
expect(reported.at(-1)).to.deep.equal([]);
|
|
745
|
+
});
|
|
746
|
+
it("should say plainly when there was nothing to disarm", async () => {
|
|
747
|
+
const { session } = build();
|
|
748
|
+
expect((await session.disarm()).did).to.contain("nothing was armed");
|
|
749
|
+
});
|
|
750
|
+
});
|
|
751
|
+
});
|