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

fix: preserve navigation functionality when unload event is deprecated #29525

Merged
merged 23 commits into from
May 22, 2024

Conversation

cacieprins
Copy link
Contributor

Additional details

In order to prepare for Chrome's removal of the unload event, we are migrating to using pagehide as a proxy for internal navigation detection. In order to preserve window:unload, for now, this event is also triggered on pagehide. Because the event emitted on pagehide is a superset of Event, which is emitted on unload, this is not a breaking change.

Future steps to support deprecation of unload:

  • Add window:pageshow and window:pagehide events
  • Warn when window:unload is used

Steps to test

Existing tests should pass with the flags removed. To test full unload removal, uncomment the indicated flags in packages/server/lib/util/chromium_flags.ts.

How has the user experience changed?

window:unload may fire both more reliably and at a slightly different point in the page lifecycle timeline. Otherwise, it should not be impacted.

PR Tasks

@cacieprins cacieprins changed the title Cacie/investigate/deprecate unload event fix: preserve navigation functionality when unload event is deprecated May 15, 2024
@cacieprins cacieprins marked this pull request as ready for review May 15, 2024 21:10
Copy link
Member

@jennifer-shehane jennifer-shehane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cacieprins I'm not sure I would even advocate for exposing page:show and page:hide until users directly ask for it.

Shouldn't we update the onUpload callback to onPageHide?

Copy link

cypress bot commented May 21, 2024

1 flaky test on run #55532 ↗︎

0 5557 77 0 Flakiness 1

Details:

changelog
Project: cypress Commit: 25fd58050d
Status: Passed Duration: 15:48 💡
Started: May 22, 2024 5:49 PM Ended: May 22, 2024 6:04 PM
Flakiness  cypress/e2e/commands/querying/querying.cy.js • 1 flaky test • 5x-driver-chrome:beta

View Output

Test Artifacts
... > throws when alias property isnt a digit or `all` Test Replay

Review all test suite changes for PR #29525 ↗︎

@@ -344,7 +344,9 @@ export class EventManager {
// when we actually unload then
// nuke all of the cookies again
// so we clear out unload
$window.on('unload', () => {
const unloadEvent = this.isBrowser({ family: 'chromium' }) ? 'pagehide' : 'unload'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cacieprins Can you add a note about why we decided to only target chromium here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in a64d262

@cacieprins cacieprins merged commit c8ec30c into develop May 22, 2024
81 of 82 checks passed
@cacieprins cacieprins deleted the cacie/investigate/deprecate-unload-event branch May 22, 2024 18:06
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jun 4, 2024

Released in 13.11.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.11.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Jun 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Understand/fix any implications of unload event deprecation within Chrome
3 participants