From a0b2d1e9123789ad2c3a6fd35b6a19e34320d714 Mon Sep 17 00:00:00 2001 From: Jennifer Shehane Date: Thu, 15 Feb 2024 13:29:40 -0500 Subject: [PATCH] fix: Add existential operators to properties before calling split in processBrowserPreRequest (#28952) * fix: Add existential operators to properties before calling split * empty commit * changelog entry * Add note about regression * remove duplicate dep in changelog * Add link to issue * Update packages/proxy/lib/http/util/service-worker-manager.ts Co-authored-by: Ryan Manuel * Update packages/proxy/lib/http/util/service-worker-manager.ts Co-authored-by: Ryan Manuel --------- Co-authored-by: Ryan Manuel --- cli/CHANGELOG.md | 12 +++++------- .../proxy/lib/http/util/service-worker-manager.ts | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index 5833ac51b9..a837752d7a 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -7,22 +7,20 @@ _Released 2/13/2024 (PENDING)_ - Fixed an issue which caused the browser to relaunch after closing the browser from the Launchpad. Fixes [#28852](https://github.com/cypress-io/cypress/issues/28852). - Fixed an issue with the unzip promise never being rejected when an empty error happens. Fixed in [#28850](https://github.com/cypress-io/cypress/pull/28850). +- Fixed a regression introduced in [`13.6.3`](https://docs.cypress.io/guides/references/changelog#13.6.3) where Cypress could crash when processing service worker requests through our proxy. Fixes [#28950](https://github.com/cypress-io/cypress/issues/28950). - Fixed incorrect type definition of `dom.getContainsSelector`. Fixed in [#28339](https://github.com/cypress-io/cypress/pull/28339). -**Dependency Updates:** - -- Upgraded `electron` from `25.8.4` to `27.1.3` -- Upgraded bundled Node.js version from `18.15.0` to `18.17.0` -- Upgraded bundled Chromium version from `114.0.5735.289` to `118.0.5993.117` -- Updated [`is-ci`](https://www.npmjs.com/package/is-ci) from `3.0.0` to `3.0.1`. Addressed in [#28933](https://github.com/cypress-io/cypress/pull/28933). - **Misc:** - Improved accessibility of the Cypress App in some areas. Addressed in [#28774](https://github.com/cypress-io/cypress/pull/28774). **Dependency Updates:** +- Upgraded `electron` from `25.8.4` to `27.1.3`. +- Upgraded bundled Node.js version from `18.15.0` to `18.17.0`. +- Upgraded bundled Chromium version from `114.0.5735.289` to `118.0.5993.117`. - Updated buffer from `5.6.0` to `5.7.1`. Addressed in [#28934](https://github.com/cypress-io/cypress/pull/28934). +- Updated [`is-ci`](https://www.npmjs.com/package/is-ci) from `3.0.0` to `3.0.1`. Addressed in [#28933](https://github.com/cypress-io/cypress/pull/28933). ## 13.6.4 diff --git a/packages/proxy/lib/http/util/service-worker-manager.ts b/packages/proxy/lib/http/util/service-worker-manager.ts index f97e6bd76b..cf4f3c9db5 100644 --- a/packages/proxy/lib/http/util/service-worker-manager.ts +++ b/packages/proxy/lib/http/util/service-worker-manager.ts @@ -118,7 +118,7 @@ export class ServiceWorkerManager { this.serviceWorkerRegistrations.forEach((registration) => { const activatedServiceWorker = registration.activatedServiceWorker - const paramlessDocumentURL = browserPreRequest.documentURL.split('?')[0] + const paramlessDocumentURL = browserPreRequest.documentURL?.split('?')[0] || '' // We are determining here if a request is controlled by a service worker. A request is controlled by a service worker if // we have an activated service worker, the request URL does not come from the service worker, and the request @@ -130,7 +130,7 @@ export class ServiceWorkerManager { return } - const paramlessURL = browserPreRequest.url.split('?')[0] + const paramlessURL = browserPreRequest.url?.split('?')[0] || '' const paramlessInitiatorURL = browserPreRequest.initiator?.url?.split('?')[0] const paramlessCallStackURL = browserPreRequest.initiator?.stack?.callFrames[0]?.url?.split('?')[0] const urlIsControlled = paramlessURL.startsWith(registration.scopeURL)