We will deal with reconnects with session resumption someday, but it will not be
using this dead code which has bitrotted in our repository for months on end.
It was never fully implemented, and what we had was a sketch that causes bugs
(and extra cpu usage).
Some Android browser versions of JSON.parse can crash when passed null
(https://code.google.com/p/android/issues/detail?id=11973), so it's
better not to pass on a non-string argument to JSON.parse.
Thanks to @raix for raising the issue in #1401.
Instead, using a friendlier error message for bad login tokens, and preferring
localStorage tokens to the result of login method in onReconnect (since
onReconnect doesn't get cleared because we don't have a disconnected message to
know when to clean it). Also tried to make tests a little cleaner.
accounts-password will not try to auto-login with (and will clear) a login token
that is going to expire within an hour, to try to avoid abrupt disconnects from
an expiring token. Login handlers return a new tokenExpires field to help the
client do this. Made tokenExpires a separate field on the login handlers' result
object instead of just returning the whole token (token + when fields) in the
result to avoid breaking code that assumes that login handlers return a string
as the token field. The tokenExpires field is optional, so other login handlers
that don't set it aren't broken.
When a login token expires, all open connections associated with that token will
be closed. It will be up to client code to avoid trying to connect with a login
token that is set to expire soon.
Gives other tabs sharing a token with the caller time to find the new token in
localStorage. This is sort of a hack for now; one possibility for making it less
hacky is to add a DDP disconnect message to allow the server to tell clients
that they are being disconnected but can reconnect with the provided token.
In minimongo, we support various types as _id fields; the most important are
strings and ObjectIds. We have a special encoding that we use when we need to
represent them as strings, but we had a few bugs with using it.
minimongo: The duplicate-ID check in insert needed to check using the encoded
string.
spark OrderedDict: due to linker changes, it was not successfully finding
LocalCollection._idStringify, and so it fell back to the identity
function. Fixed to use weak dependencies. Also, later refactorings have removed
the need for idStringify(null) === null so that special case is removed.
spark branch labels: use idStringify in various places where _id is used as a
branch label.
Tested by:
- run unit tests
- create an app, add stylus package.
- add foo.style file that uses nib and a background gradient
- see appropriate css generated in app with web inspector.