mozilla/browserid — pull request #3877 by seanmonstar (2013-09-11 04:45:43+00:00)
Title: groups simultaneous requests to the same resource

If we ever make more than 1 GET request to the same resource (including GET params), this will group them together into a single request. While the request is mid-flight, additional requests to the same resource will not start a new one, but add their listeners to the existing request.

This may not happen often, but when it does, we most likely never want the requests to be separate.

This likely fixes #3872, since right now, the dialog can sometimes call `/wsapi/session_context` twice at the start, one for `interaction_data`, and one for `cookie_check`. This is the likely cause of a race condition where both pass their empty session cookie, both requests generate a CSRF token, and then after one returns, we start a new request using the first token, but by then the second request finished and changed our cookie. Gross!