Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: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
andwindow
state in the specbridge after unload to prevent any type of stale DOM cross-origin errors. This yields the expected result: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
andwindow
state are being used elsewhere, and if there is any need to persist any of this state between invocations of the spec bridgeHow has the user experience changed?
N/A
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?