Encapsule-Annex / schema

A single-page HTML5 application for creating, visualizing, and editing JSON-encoded Soft Circuit Description Language (SCDL) system models.
Other
5 stars 0 forks source link

Missed appcache events breaks bootstrapping #2

Closed ChrisRus closed 11 years ago

ChrisRus commented 11 years ago

I notice that on an extremely fast machine with an extremely fast Internet connection that it's possible to load the Schema application and get stuck at phase 2 bootstrap waiting on app cache events.

This definitely feels like a race condition. Likely there's a way to query the app cache for its current status and explicitly actuate the function in the bootstrap chain if the app cache has already reached a terminal state.

ChrisRus commented 11 years ago

https://developer.mozilla.org/en-US/docs/HTML/Using_the_application_cache?redirectlocale=en-US&redirectslug=Offline_resources_in_Firefox#Enabling_the_application_cache

Since a cache manifest file may have been updated before a script attaches event listeners to test for updates, scripts should always test window.applicationCache.status.

function onUpdateReady() { alert('found new version!'); } window.applicationCache.addEventListener('updateready', onUpdateReady); if(window.applicationCache.status === window.applicationCache.UPDATEREADY) { onUpdateReady(); } To manually start testing for a new manifest file, you can use window.applicationCache.update().

ChrisRus commented 11 years ago

Fixed this over the weekend.