nodeca / tabex

Cross-tab message bus for browsers.
http://nodeca.github.io/tabex/
MIT License
219 stars 19 forks source link

Bug when calling localStorage.clear() #10

Closed kesne closed 8 years ago

kesne commented 8 years ago

When the clear method is called, the corresponding StorageEvent has a key property set to null. See here: https://developer.mozilla.org/en-US/docs/Web/API/StorageEvent

This causes an exception to be thrown at this line because it attempts to call indexOf on null: https://github.com/nodeca/tabex/blob/93feb7d020b8294d09af1c8ed862059fb6b5259e/lib/router.js#L310

puzrin commented 8 years ago

Do you mean direct .clear() call from external code?

jimrhoskins commented 8 years ago

Yes, localStorage.clear() will cause this error. Also clearing Local Storage via the chrome content settings will also cause this error.

puzrin commented 8 years ago

Good catch, thanks for report!

Is it urgent or can wait 2 weeks?

kesne commented 8 years ago

@puzrin No worries, it can totally wait a few weeks.

kesne commented 8 years ago

@puzrin Any updates on this? Sadly we've had this error keep showing up in production.

puzrin commented 8 years ago

Marked to fix tomorrow

puzrin commented 8 years ago

Could you check files from master for sure prior i do release?

puzrin commented 8 years ago

Published 1.0.5 with fix