-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace x.top, x.parent accessors with correct reference (at runtime) #5271
Comments
The code for this is done in cypress-io/cypress#5273, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
This fix is available starting in {
"experimentalSourceRewriting": true
} The fix is experimental, so there may be some situations where the this is not fixed. If you're still this issue while setting the |
PR: #5273
Current behavior:
window.top and window.parent references are naively corrected like so:
cypress/packages/server/lib/util/security.js
Lines 7 to 38 in 4ec77e3
Desired behavior:
/(.*)\.(top|parent)/
with(window.top.Cypress.resolveWindowReference($1, "$2"))
using AST parser or regexeswindow.top.Cypress.resolveWindowReference(maybeWindow, prop)
is a function that checks ifmaybeWindow
is aWindow
and, if so, corrects the property access to be 1 level deeper than it would've been (to skipwindow.top
).maybeWindow
is not aWindow
, and ifmaybeWindow[prop]
is aFunction
, it will bindmaybeWindow[prop]
tomaybeWindow
and return it.maybeWindow[prop]
.The text was updated successfully, but these errors were encountered: