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: firefox 93 error issues #20695

Merged

Conversation

AtofStryker
Copy link
Contributor

@AtofStryker AtofStryker commented Mar 18, 2022

  • Closes N/A

User facing changelog

N/A

Additional details

The goal of this PR is to fix a bug that was discovered in #20561 through some of the serialization changes introduced earlier. This error only occurs in Firefox 93 and below in run mode. There are two fixes here:

a) don't fail serialization if object prototype accessors throw a TypeError due to some caveats of certain data types (ex: DOMException. Fixing this yields the following, which serialize the security error back to the primary:

image

b) Because of the issues discovered with fixing a), the next step was to make sure commands fail gracefully in the spec bridge even after we leave the domain. This is accomplished by resetting document and window state in the specbridge after unload to prevent any type of stale DOM cross-origin errors. This yields the expected result:
image (1)

It's a bit of a mystery to me why this only happens in Firefox in run mode. I would think stale DOM references after the spec bridge exits would be common security errors in other browsers. I think this might bring up another area of concerns as to where document and window state are being used elsewhere, and if there is any need to persist any of this state between invocations of the spec bridge

How has the user experience changed?

N/A

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 18, 2022

Thanks for taking the time to open a PR!

@AtofStryker AtofStryker changed the title Multi domain fix firefox error issues fix: firefox 93 error issues Mar 18, 2022
@cypress
Copy link

cypress bot commented Mar 18, 2022



Test summary

20503 0 294 4Flakiness 3


Run details

Project cypress
Status Passed
Commit 86a710c
Started Mar 21, 2022 9:37 PM
Ended Mar 21, 2022 9:51 PM
Duration 14:30 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

reporter.hooks.spec.js Flakiness
1 hooks > can rerun without timeout error leaking into next run (due to run restart)
2 hooks > can rerun without timeout error leaking into next run (due to run restart)
cy/timers_spec.js Flakiness
1 driver/src/cy/timers > can cancel setIntervals paused or unpaused

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@AtofStryker AtofStryker marked this pull request as ready for review March 18, 2022 21:24
@AtofStryker AtofStryker requested a review from a team as a code owner March 18, 2022 21:24
@AtofStryker AtofStryker removed the request for review from a team March 18, 2022 21:24
@mschile
Copy link
Contributor

mschile commented Mar 21, 2022

Since we are clearing the window now, I believe we can remove this try...catch

@AtofStryker
Copy link
Contributor Author

Since we are clearing the window now, I believe we can remove this try...catch

@mschile are you referring to the try/catch here?

Since we are clearing the window now, I believe we can remove this try...catch

I think we still need this. Removing the try/catch consistently fails the window:before:load test. My guess is the spec bridge is created with state('window') populated, which then onLoad is fired which then causes the cross origin failure since it happens before we even unload the spec bridge which would unset the window 😢

@AtofStryker AtofStryker merged commit 89c0091 into feature-multidomain Mar 22, 2022
@AtofStryker AtofStryker deleted the multi_domain_fix_firefox_error_issues branch March 22, 2022 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants