Skip to content

[bug] The XHR server breaks code that relies on multiple readyStateChanges with the same readyState (3) #1150

@meDavid

Description

@meDavid

Symptoms
I tried to make a Cypress test on a Firebase Firestore project, but it would take around 30sec to load the data inside the test runner, while outside the testrunner it would load instant. After some investigation I found out this was due to some kind of long-poll system they use to retrieve the data streams from the server. When I disabled the the XHR server inside the cypress_runner.js the issue was no longer observed.

The XHR server overrides the onreadystatechange listener and will only invoke the original listener if it hasn't already seen the readyState. But having the readyState 3 (loading) multiple times, each time with the additional responseText is perfectly legal and relied upon in the Firebase SDK for Firestore.

The specific line of code that needs to be removed or allow for multiple readystate 3 calls:

return if readyStates[@readyState]

I don't have a limited example right now, but my guess is that any Firestore project will work.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions