Skip to content

Instantly share code, notes, and snippets.

@ConradIrwin
Created February 3, 2017 07:48
Show Gist options
  • Save ConradIrwin/d1f30f90cb5e9f77856e8600bac07583 to your computer and use it in GitHub Desktop.
Save ConradIrwin/d1f30f90cb5e9f77856e8600bac07583 to your computer and use it in GitHub Desktop.
<script>
function fillCache() {
caches.open('test').then(function (cache) {
for (var i = 0; i < 30000; i++) {
cache.put('https://example.com/probably-crash-' + i, new Response('ok')).then(function() {
filled.innerText = i;
})
}
});
}
function readCache() {
caches.open('test').then(function (cache) {
cache.keys().then(function(keys) {
console.log('success')
}).catch(function (e) {
alert(e);
});
});
}
</script>
<div>
Filling <span id="filled">...</span>
<button onclick="fillCache();readCache()">Crash!</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment