mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-28 10:49:48 -05:00
695dd275bc
* chore: enforce strict origin spec bridges chore: refactor spec bridges to strictly enforce same origin fix: wrap fullCrossOrigin injection around feature flag inside buffered response * fix: do NOT set the initial cypress cookie inside the spec bridge as it is sending unecessary cookies * chore: simplify the finding cypress in the injection code * chore: change order in which callback fn is declared * chore: add spec bridge performance issue to validation tests
15 lines
635 B
TypeScript
15 lines
635 B
TypeScript
import type { HttpMiddlewareThis } from '../index'
|
|
|
|
export const doesTopNeedToBeSimulated = <T>(ctx: HttpMiddlewareThis<T>): boolean => {
|
|
const currentAUTUrl = ctx.getAUTUrl()
|
|
|
|
// if the AUT url is undefined for whatever reason, return false as we do not want to complicate top simulation
|
|
if (!currentAUTUrl) {
|
|
return false
|
|
}
|
|
|
|
// only simulate top if the AUT is NOT the primary super domain origin, meaning that we should treat the AUT as top
|
|
// or the request is the AUT frame, which is common for redirects and navigations.
|
|
return !ctx.remoteStates.isPrimarySuperDomainOrigin(currentAUTUrl) || ctx.req.isAUTFrame
|
|
}
|