From dc16aef8c46cbd423a1b2dfdb37b764cba76944d Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Mon, 10 Nov 2025 09:48:04 -0500 Subject: [PATCH 01/18] fix: Browser will freeze when sync request is intercepted --- packages/net-stubbing/lib/server/intercepted-request.ts | 2 +- packages/proxy/lib/http/request-middleware.ts | 5 +++++ packages/proxy/lib/types.ts | 1 + packages/runner/injection/main.js | 8 ++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/net-stubbing/lib/server/intercepted-request.ts b/packages/net-stubbing/lib/server/intercepted-request.ts index 9b80816f54b..43230a85398 100644 --- a/packages/net-stubbing/lib/server/intercepted-request.ts +++ b/packages/net-stubbing/lib/server/intercepted-request.ts @@ -173,7 +173,7 @@ export class InterceptedRequest { const _emit = () => emit(this.socket, eventName, eventFrame) - if (!subscription.await) { + if (!subscription.await || this.req.isSyncRequest) { _emit() return diff --git a/packages/proxy/lib/http/request-middleware.ts b/packages/proxy/lib/http/request-middleware.ts index 8eeaebae11b..6620864e53c 100644 --- a/packages/proxy/lib/http/request-middleware.ts +++ b/packages/proxy/lib/http/request-middleware.ts @@ -34,11 +34,16 @@ const ExtractCypressMetadataHeaders: RequestMiddleware = function () { this.req.isAUTFrame = !!this.req.headers['x-cypress-is-aut-frame'] this.req.isFromExtraTarget = !!this.req.headers['x-cypress-is-from-extra-target'] + this.req.isSyncRequest = !!this.req.headers['x-cypress-is-sync-request'] if (this.req.headers['x-cypress-is-aut-frame']) { delete this.req.headers['x-cypress-is-aut-frame'] } + if (this.req.headers['x-cypress-is-sync-request']) { + delete this.req.headers['x-cypress-is-sync-request'] + } + span?.setAttributes({ isAUTFrame: this.req.isAUTFrame, isFromExtraTarget: this.req.isFromExtraTarget, diff --git a/packages/proxy/lib/types.ts b/packages/proxy/lib/types.ts index aecbac28a39..598350d4452 100644 --- a/packages/proxy/lib/types.ts +++ b/packages/proxy/lib/types.ts @@ -28,6 +28,7 @@ export type CypressIncomingRequest = Request & { * Stack-ordered list of `cy.intercept()`s matching this request. */ matchingRoutes?: BackendRoute[] + isSyncRequest: boolean } export type RequestCredentialLevel = 'same-origin' | 'include' | 'omit' | boolean diff --git a/packages/runner/injection/main.js b/packages/runner/injection/main.js index ad3eb91de45..5065f036a8d 100644 --- a/packages/runner/injection/main.js +++ b/packages/runner/injection/main.js @@ -32,3 +32,11 @@ Cypress.on('app:timers:pause', timers.pause) timers.wrap() Cypress.action('app:window:before:load', window) + +const originalXmlHttpRequestOpen = window.XMLHttpRequest.prototype.open +window.XMLHttpRequest.prototype.open = function (...args) { + originalXmlHttpRequestOpen.apply(this, args) + if (args[2] === false) { + this.setRequestHeader('x-cypress-is-sync-request', 'true') + } +} From 9182b4e4039a84bd71661c57c01f09ed8340925c Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Mon, 10 Nov 2025 10:28:55 -0500 Subject: [PATCH 02/18] Update CHANGELOG.md --- cli/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index a7418bedce8..b0f8aaca4ec 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -6,6 +6,7 @@ _Released 11/18/2025 (PENDING)_ **Bugfixes:** - Fixed an issue where top changes on test retries could cause attempt numbers to show up more than one time in the reporter and cause attempts to be lost in Test Replay. Addressed in [#32888](https://github.com/cypress-io/cypress/pull/32888). +- Fixed an issue where the browser will freeze when Cypress intercepts a synchronous request where a routeHandler is used. Addressed in [#32925](https://github.com/cypress-io/cypress/pull/32925). **Misc:** From 4801766d61ce1ea1410b56a950f9c9e696f6096f Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Mon, 10 Nov 2025 10:30:55 -0500 Subject: [PATCH 03/18] Update CHANGELOG.md --- cli/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.md index b0f8aaca4ec..9da0011869c 100644 --- a/cli/CHANGELOG.md +++ b/cli/CHANGELOG.md @@ -6,7 +6,7 @@ _Released 11/18/2025 (PENDING)_ **Bugfixes:** - Fixed an issue where top changes on test retries could cause attempt numbers to show up more than one time in the reporter and cause attempts to be lost in Test Replay. Addressed in [#32888](https://github.com/cypress-io/cypress/pull/32888). -- Fixed an issue where the browser will freeze when Cypress intercepts a synchronous request where a routeHandler is used. Addressed in [#32925](https://github.com/cypress-io/cypress/pull/32925). +- Fixed an issue where the browser will freeze when Cypress intercepts a synchronous request and a routeHandler is used. Fixes [#32874](https://github.com/cypress-io/cypress/issues/32874). Addressed in [#32925](https://github.com/cypress-io/cypress/pull/32925). **Misc:** From 7b4f2e75ce1099585c806e0ae906f1bfeab18931 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 11 Nov 2025 16:25:45 -0500 Subject: [PATCH 04/18] prevent cross origin cookies from breaking sync requests --- .../proxy/lib/http/response-middleware.ts | 5 +++ packages/runner/injection/main.js | 3 +- .../injection/patches/xmlHttpRequest.ts | 35 ++++++++++++------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/packages/proxy/lib/http/response-middleware.ts b/packages/proxy/lib/http/response-middleware.ts index 930495d1e42..16a0914519f 100644 --- a/packages/proxy/lib/http/response-middleware.ts +++ b/packages/proxy/lib/http/response-middleware.ts @@ -719,6 +719,11 @@ const MaybeCopyCookiesFromIncomingRes: ResponseMiddleware = async function () { return this.next() } + if (this.req.isSyncRequest) { + span?.end() + return this.next() + } + // we want to set the cookies via automation so they exist in the browser // itself. however, firefox will hang if we try to use the extension // to set cookies on a url that's in-flight, so we send the cookies down to diff --git a/packages/runner/injection/main.js b/packages/runner/injection/main.js index 5065f036a8d..c5900235aa2 100644 --- a/packages/runner/injection/main.js +++ b/packages/runner/injection/main.js @@ -35,8 +35,9 @@ Cypress.action('app:window:before:load', window) const originalXmlHttpRequestOpen = window.XMLHttpRequest.prototype.open window.XMLHttpRequest.prototype.open = function (...args) { - originalXmlHttpRequestOpen.apply(this, args) + const result = originalXmlHttpRequestOpen.apply(this, args) if (args[2] === false) { this.setRequestHeader('x-cypress-is-sync-request', 'true') } + return result } diff --git a/packages/runner/injection/patches/xmlHttpRequest.ts b/packages/runner/injection/patches/xmlHttpRequest.ts index f1dfdb69b89..7913d18e046 100644 --- a/packages/runner/injection/patches/xmlHttpRequest.ts +++ b/packages/runner/injection/patches/xmlHttpRequest.ts @@ -13,22 +13,33 @@ export const patchXmlHttpRequest = (window: Window) => { // we need to store a reference here to what we need in the send method this._url = captureFullRequestUrl(args[1], window) } finally { - return originalXmlHttpRequestOpen.apply(this, args as any) + const result = originalXmlHttpRequestOpen.apply(this, args as any) + if (args[2] === false) { + this.setRequestHeader('x-cypress-is-sync-request', 'true') + this._isSyncRequest = true + } + return result } } - window.XMLHttpRequest.prototype.send = async function (...args) { - try { - // if the option is specified, communicate it to the the server to the proxy can make the request aware if it needs to potentially apply cross origin cookies - // if the option isn't set, we can imply the default as we know the "resourceType" in the proxy - await requestSentWithCredentials({ - url: this._url, - resourceType: 'xhr', - credentialStatus: this.withCredentials, - }) - } finally { - // if our internal logic errors for whatever reason, do NOT block the end user and continue the request + window.XMLHttpRequest.prototype.send = function (...args) { + if (this._isSyncRequest) { return originalXmlHttpRequestSend.apply(this, args) } + + return (async () => { + try { + // if the option is specified, communicate it to the the server to the proxy can make the request aware if it needs to potentially apply cross origin cookies + // if the option isn't set, we can imply the default as we know the "resourceType" in the proxy + await requestSentWithCredentials({ + url: this._url, + resourceType: 'xhr', + credentialStatus: this.withCredentials, + }) + } finally { + // if our internal logic errors for whatever reason, do NOT block the end user and continue the request + return originalXmlHttpRequestSend.apply(this, args) + } + })() } } From 02f6105909205252f360f75ae8948ba60e8baf6a Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 11 Nov 2025 21:54:51 -0500 Subject: [PATCH 05/18] Update xmlHttpRequest.ts --- packages/runner/injection/patches/xmlHttpRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runner/injection/patches/xmlHttpRequest.ts b/packages/runner/injection/patches/xmlHttpRequest.ts index 7913d18e046..276892327f4 100644 --- a/packages/runner/injection/patches/xmlHttpRequest.ts +++ b/packages/runner/injection/patches/xmlHttpRequest.ts @@ -13,7 +13,7 @@ export const patchXmlHttpRequest = (window: Window) => { // we need to store a reference here to what we need in the send method this._url = captureFullRequestUrl(args[1], window) } finally { - const result = originalXmlHttpRequestOpen.apply(this, args as any) + const result = originalXmlHttpRequestOpen.apply(this, args) if (args[2] === false) { this.setRequestHeader('x-cypress-is-sync-request', 'true') this._isSyncRequest = true From 7f0d6c6506395e97bd1fa51d802c50e9abbf50c0 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Wed, 12 Nov 2025 14:11:19 -0500 Subject: [PATCH 06/18] Update xmlHttpRequest.ts --- packages/runner/injection/patches/xmlHttpRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runner/injection/patches/xmlHttpRequest.ts b/packages/runner/injection/patches/xmlHttpRequest.ts index 276892327f4..7913d18e046 100644 --- a/packages/runner/injection/patches/xmlHttpRequest.ts +++ b/packages/runner/injection/patches/xmlHttpRequest.ts @@ -13,7 +13,7 @@ export const patchXmlHttpRequest = (window: Window) => { // we need to store a reference here to what we need in the send method this._url = captureFullRequestUrl(args[1], window) } finally { - const result = originalXmlHttpRequestOpen.apply(this, args) + const result = originalXmlHttpRequestOpen.apply(this, args as any) if (args[2] === false) { this.setRequestHeader('x-cypress-is-sync-request', 'true') this._isSyncRequest = true From 12a25e440c01d9e7cad03ebe070947b9f51cf1e3 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Wed, 12 Nov 2025 14:17:44 -0500 Subject: [PATCH 07/18] fix lint --- packages/proxy/lib/http/response-middleware.ts | 1 + packages/runner/injection/main.js | 3 +++ packages/runner/injection/patches/xmlHttpRequest.ts | 2 ++ 3 files changed, 6 insertions(+) diff --git a/packages/proxy/lib/http/response-middleware.ts b/packages/proxy/lib/http/response-middleware.ts index 16a0914519f..a4e8d001a77 100644 --- a/packages/proxy/lib/http/response-middleware.ts +++ b/packages/proxy/lib/http/response-middleware.ts @@ -721,6 +721,7 @@ const MaybeCopyCookiesFromIncomingRes: ResponseMiddleware = async function () { if (this.req.isSyncRequest) { span?.end() + return this.next() } diff --git a/packages/runner/injection/main.js b/packages/runner/injection/main.js index c5900235aa2..9d50b184be0 100644 --- a/packages/runner/injection/main.js +++ b/packages/runner/injection/main.js @@ -34,10 +34,13 @@ timers.wrap() Cypress.action('app:window:before:load', window) const originalXmlHttpRequestOpen = window.XMLHttpRequest.prototype.open + window.XMLHttpRequest.prototype.open = function (...args) { const result = originalXmlHttpRequestOpen.apply(this, args) + if (args[2] === false) { this.setRequestHeader('x-cypress-is-sync-request', 'true') } + return result } diff --git a/packages/runner/injection/patches/xmlHttpRequest.ts b/packages/runner/injection/patches/xmlHttpRequest.ts index 7913d18e046..2353c7ef38d 100644 --- a/packages/runner/injection/patches/xmlHttpRequest.ts +++ b/packages/runner/injection/patches/xmlHttpRequest.ts @@ -14,10 +14,12 @@ export const patchXmlHttpRequest = (window: Window) => { this._url = captureFullRequestUrl(args[1], window) } finally { const result = originalXmlHttpRequestOpen.apply(this, args as any) + if (args[2] === false) { this.setRequestHeader('x-cypress-is-sync-request', 'true') this._isSyncRequest = true } + return result } } From a837527ba678d935df8f3b4b2234af4e5f54bdda Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 18 Nov 2025 12:02:35 -0500 Subject: [PATCH 08/18] Update intercepted-request.ts --- packages/net-stubbing/lib/server/intercepted-request.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/net-stubbing/lib/server/intercepted-request.ts b/packages/net-stubbing/lib/server/intercepted-request.ts index 43230a85398..0f9a11f0395 100644 --- a/packages/net-stubbing/lib/server/intercepted-request.ts +++ b/packages/net-stubbing/lib/server/intercepted-request.ts @@ -72,6 +72,12 @@ export class InterceptedRequest { return } + if (this.req.isSyncRequest) { + console.warn('WARNING: Sync Request not intercepted') + + return + } + for (const route of this.req.matchingRoutes) { if (route.disabled) { continue @@ -173,7 +179,7 @@ export class InterceptedRequest { const _emit = () => emit(this.socket, eventName, eventFrame) - if (!subscription.await || this.req.isSyncRequest) { + if (!subscription.await) { _emit() return From 3cdaa5f5b32ae21deb9a6fe8a42b44dcf358a8b6 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 18 Nov 2025 12:08:43 -0500 Subject: [PATCH 09/18] Update response-middleware.ts --- packages/proxy/lib/http/response-middleware.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/proxy/lib/http/response-middleware.ts b/packages/proxy/lib/http/response-middleware.ts index a4e8d001a77..d6ed98552b1 100644 --- a/packages/proxy/lib/http/response-middleware.ts +++ b/packages/proxy/lib/http/response-middleware.ts @@ -720,6 +720,8 @@ const MaybeCopyCookiesFromIncomingRes: ResponseMiddleware = async function () { } if (this.req.isSyncRequest) { + console.warn('WARNING: Cross-origin cookies may not have been applied') + span?.end() return this.next() From 247da309ab00a7e9f7fdf9278e724ceecb4d4681 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 18 Nov 2025 12:22:46 -0500 Subject: [PATCH 10/18] grammar fix --- packages/net-stubbing/lib/server/intercepted-request.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/net-stubbing/lib/server/intercepted-request.ts b/packages/net-stubbing/lib/server/intercepted-request.ts index 0f9a11f0395..371077e9337 100644 --- a/packages/net-stubbing/lib/server/intercepted-request.ts +++ b/packages/net-stubbing/lib/server/intercepted-request.ts @@ -73,7 +73,7 @@ export class InterceptedRequest { } if (this.req.isSyncRequest) { - console.warn('WARNING: Sync Request not intercepted') + console.warn('WARNING: Sync Request was not intercepted') return } From 66647564788fa92a71a1bd584bffd925a87eca8a Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 18 Nov 2025 16:30:21 -0500 Subject: [PATCH 11/18] better warning --- packages/net-stubbing/lib/server/intercepted-request.ts | 3 ++- packages/proxy/lib/http/response-middleware.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/net-stubbing/lib/server/intercepted-request.ts b/packages/net-stubbing/lib/server/intercepted-request.ts index 371077e9337..87efafa02f9 100644 --- a/packages/net-stubbing/lib/server/intercepted-request.ts +++ b/packages/net-stubbing/lib/server/intercepted-request.ts @@ -13,6 +13,7 @@ import type { BackendRoute, NetStubbingState } from './types' import { emit, sendStaticResponse } from './util' import type CyServer from '@packages/server' import type { BackendStaticResponse } from '../internal-types' +import chalk from 'chalk' export class InterceptedRequest { id: string @@ -73,7 +74,7 @@ export class InterceptedRequest { } if (this.req.isSyncRequest) { - console.warn('WARNING: Sync Request was not intercepted') + process.stdout.write(chalk.yellow('WARNING: sync request was not intercepted\n')) return } diff --git a/packages/proxy/lib/http/response-middleware.ts b/packages/proxy/lib/http/response-middleware.ts index d6ed98552b1..11dadf211e1 100644 --- a/packages/proxy/lib/http/response-middleware.ts +++ b/packages/proxy/lib/http/response-middleware.ts @@ -15,6 +15,7 @@ import { hasServiceWorkerHeader, isVerboseTelemetry as isVerbose } from '.' import { CookiesHelper } from './util/cookies' import * as rewriter from './util/rewriter' import { doesTopNeedToBeSimulated } from './util/top-simulation' +import chalk from 'chalk' import type Debug from 'debug' import type { CookieOptions } from 'express' @@ -720,7 +721,7 @@ const MaybeCopyCookiesFromIncomingRes: ResponseMiddleware = async function () { } if (this.req.isSyncRequest) { - console.warn('WARNING: Cross-origin cookies may not have been applied') + process.stdout.write(chalk.yellow('WARNING: cross-origin cookies may not have been applied\n')) span?.end() From a9e67e10f66457a63bf59d2143ed28e6d390eb38 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 18 Nov 2025 17:39:25 -0500 Subject: [PATCH 12/18] Blank From 5a65b0cd69fdf7fba95767dca4bcf779a2b399b1 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 18 Nov 2025 17:54:57 -0500 Subject: [PATCH 13/18] Update intercepted-request.ts --- packages/net-stubbing/lib/server/intercepted-request.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/net-stubbing/lib/server/intercepted-request.ts b/packages/net-stubbing/lib/server/intercepted-request.ts index 87efafa02f9..6ed48906fb5 100644 --- a/packages/net-stubbing/lib/server/intercepted-request.ts +++ b/packages/net-stubbing/lib/server/intercepted-request.ts @@ -13,7 +13,6 @@ import type { BackendRoute, NetStubbingState } from './types' import { emit, sendStaticResponse } from './util' import type CyServer from '@packages/server' import type { BackendStaticResponse } from '../internal-types' -import chalk from 'chalk' export class InterceptedRequest { id: string @@ -74,7 +73,7 @@ export class InterceptedRequest { } if (this.req.isSyncRequest) { - process.stdout.write(chalk.yellow('WARNING: sync request was not intercepted\n')) + process.stdout.write('WARNING: sync request was not intercepted\n') return } From 7d4a48bb37d87e39636e86efeb83f5bb0499f66d Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 18 Nov 2025 17:55:14 -0500 Subject: [PATCH 14/18] Update response-middleware.ts --- packages/proxy/lib/http/response-middleware.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/proxy/lib/http/response-middleware.ts b/packages/proxy/lib/http/response-middleware.ts index 11dadf211e1..b99df056bad 100644 --- a/packages/proxy/lib/http/response-middleware.ts +++ b/packages/proxy/lib/http/response-middleware.ts @@ -15,7 +15,6 @@ import { hasServiceWorkerHeader, isVerboseTelemetry as isVerbose } from '.' import { CookiesHelper } from './util/cookies' import * as rewriter from './util/rewriter' import { doesTopNeedToBeSimulated } from './util/top-simulation' -import chalk from 'chalk' import type Debug from 'debug' import type { CookieOptions } from 'express' @@ -721,7 +720,7 @@ const MaybeCopyCookiesFromIncomingRes: ResponseMiddleware = async function () { } if (this.req.isSyncRequest) { - process.stdout.write(chalk.yellow('WARNING: cross-origin cookies may not have been applied\n')) + process.stdout.write('WARNING: cross-origin cookies may not have been applied\n') span?.end() From 88c83e1e734db0bf6fd765e2bf7bf5c99baf5147 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Tue, 18 Nov 2025 18:12:07 -0500 Subject: [PATCH 15/18] Update xmlHttpRequest.ts --- packages/runner/injection/patches/xmlHttpRequest.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/runner/injection/patches/xmlHttpRequest.ts b/packages/runner/injection/patches/xmlHttpRequest.ts index 2353c7ef38d..a72227fc714 100644 --- a/packages/runner/injection/patches/xmlHttpRequest.ts +++ b/packages/runner/injection/patches/xmlHttpRequest.ts @@ -15,10 +15,7 @@ export const patchXmlHttpRequest = (window: Window) => { } finally { const result = originalXmlHttpRequestOpen.apply(this, args as any) - if (args[2] === false) { - this.setRequestHeader('x-cypress-is-sync-request', 'true') - this._isSyncRequest = true - } + this._isSyncRequest = args[2] === false return result } From 775edee7eb36efca6a999da97c422b869cb8f17d Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Wed, 19 Nov 2025 11:57:26 -0500 Subject: [PATCH 16/18] Alexsch01 patch 1 --- packages/net-stubbing/lib/server/intercepted-request.ts | 3 ++- packages/proxy/lib/http/response-middleware.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/net-stubbing/lib/server/intercepted-request.ts b/packages/net-stubbing/lib/server/intercepted-request.ts index 6ed48906fb5..1abbc0fa6a0 100644 --- a/packages/net-stubbing/lib/server/intercepted-request.ts +++ b/packages/net-stubbing/lib/server/intercepted-request.ts @@ -13,6 +13,7 @@ import type { BackendRoute, NetStubbingState } from './types' import { emit, sendStaticResponse } from './util' import type CyServer from '@packages/server' import type { BackendStaticResponse } from '../internal-types' +import { styleText } from 'util' export class InterceptedRequest { id: string @@ -73,7 +74,7 @@ export class InterceptedRequest { } if (this.req.isSyncRequest) { - process.stdout.write('WARNING: sync request was not intercepted\n') + process.stdout.write(styleText('yellow', 'WARNING: sync request was not intercepted\n')) return } diff --git a/packages/proxy/lib/http/response-middleware.ts b/packages/proxy/lib/http/response-middleware.ts index b99df056bad..14dff71797a 100644 --- a/packages/proxy/lib/http/response-middleware.ts +++ b/packages/proxy/lib/http/response-middleware.ts @@ -15,6 +15,7 @@ import { hasServiceWorkerHeader, isVerboseTelemetry as isVerbose } from '.' import { CookiesHelper } from './util/cookies' import * as rewriter from './util/rewriter' import { doesTopNeedToBeSimulated } from './util/top-simulation' +import { styleText } from 'util' import type Debug from 'debug' import type { CookieOptions } from 'express' @@ -720,7 +721,7 @@ const MaybeCopyCookiesFromIncomingRes: ResponseMiddleware = async function () { } if (this.req.isSyncRequest) { - process.stdout.write('WARNING: cross-origin cookies may not have been applied\n') + process.stdout.write(styleText('yellow', 'WARNING: cross-origin cookies may not have been applied\n')) span?.end() From 844904d31a1a6b2ee792f3669b92aea37f9c4a24 Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Wed, 19 Nov 2025 13:05:36 -0500 Subject: [PATCH 17/18] Update xmlHttpRequest.ts --- packages/runner/injection/patches/xmlHttpRequest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runner/injection/patches/xmlHttpRequest.ts b/packages/runner/injection/patches/xmlHttpRequest.ts index a72227fc714..f182681cf83 100644 --- a/packages/runner/injection/patches/xmlHttpRequest.ts +++ b/packages/runner/injection/patches/xmlHttpRequest.ts @@ -15,7 +15,7 @@ export const patchXmlHttpRequest = (window: Window) => { } finally { const result = originalXmlHttpRequestOpen.apply(this, args as any) - this._isSyncRequest = args[2] === false + this._isSyncRequest = args.length > 2 && !args[2] return result } From be6a22f413e99400f71df5b35e357b2d3688566d Mon Sep 17 00:00:00 2001 From: Alex Schwartz Date: Wed, 19 Nov 2025 13:05:48 -0500 Subject: [PATCH 18/18] Update main.js --- packages/runner/injection/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runner/injection/main.js b/packages/runner/injection/main.js index 9d50b184be0..e89dc7d2a7d 100644 --- a/packages/runner/injection/main.js +++ b/packages/runner/injection/main.js @@ -38,7 +38,7 @@ const originalXmlHttpRequestOpen = window.XMLHttpRequest.prototype.open window.XMLHttpRequest.prototype.open = function (...args) { const result = originalXmlHttpRequestOpen.apply(this, args) - if (args[2] === false) { + if (args.length > 2 && !args[2]) { this.setRequestHeader('x-cypress-is-sync-request', 'true') }