Skip to content
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

Opt out of 'unload' event deprecation #29474

Closed
cacieprins opened this issue May 6, 2024 · 0 comments
Closed

Opt out of 'unload' event deprecation #29474

cacieprins opened this issue May 6, 2024 · 0 comments
Assignees
Labels
browser: chrome stage: wontfix Cypress does not regard this as an issue or will not implement this feature

Comments

@cacieprins
Copy link
Contributor

cacieprins commented May 6, 2024

What would you like?

Chrome is deprecating the unload event. (see also: #29241)

Why is this needed?

Cypress uses the unload event during AUT navigation, and emits a window:unload event that can be hooked into from tests. With unload forcibly deprecated, Cypress no longer works as expected, and the window:unload event will not fire.

Other

Background

To prevent Cypress runs from failing while we work to remove or find alternatives to using unload, we can leverage a permissions policy option added to Chrome 117 to preserve usage. This is not a permanent fix, and this permissions policy option will be removed in a future version of Chrome. This just gives us breathing room.

Potential complication: Documentation only provides a solution for single-layer cross-domain iframes. We will probably be able to make this work when the AUT is a cross-domain iframe with the App, but it is unlikely that we will be able to force unload events to be enabled when the AUT iframe includes a sub-iframe that is cross-domain with the AUT iframe.

Acceptance Criteria

  • Top level Cypress URL returns with a Permissions-Policy: unload=(self,"${AUT_URL}") header, where AUT_URL is the url that will be loaded in the AUT iframe
  • The AUT iframe has an allow="unload" property
  • Cypress' proxy sets Permissions-Policy: unload=self on AUT responses
  • Cypress' proxy modifies iframes in the AUT to include the allow="unload" property
@cacieprins cacieprins added the stage: wontfix Cypress does not regard this as an issue or will not implement this feature label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
browser: chrome stage: wontfix Cypress does not regard this as an issue or will not implement this feature
Projects
None yet
Development

No branches or pull requests

2 participants