How does HTML5 web app bypass browser permissions for local caching?
===

I have been playing around with the HTML5 offline application cache, 
running boundary tests to study browser behaviour in edge cases, specifically to find out about the cache quota.

So what I did is to generate and serve an offline app manifest and add 300 5MB JPEG files to the cache.

In the beginning, I adding 1000 JPEG files to the cache, Chrome threw an error:
it failed to commit the new cache to the storage due to quota exceeded.

I managed to get the right number by slowly reducing the number of images i uploaded,
I could add 300 JPEG files to the cache without crashing it

Investigating chrome://appcache-internals/, I was shocked to see that for 
one single web application, there is a huge cache of 2.3GB!!

It's really odd to find that the website I visited is downloading 
so much data in the background, and as a user it can get quite
disturbing. Chrome, the (17.0.963.83), desktop browser of choice at that moment 
didnt warn me or ask my permission that the site wanted to download and cache
so much data on my local storage! It's quite outrageous.

Because of the aforementioned behaviour about the browser-wide
quota being exceeded, sites stop committing data to the application cache.

Is there a way for the browser to keep track of all these in a more organized 
manner? Currently, the 'first browsed, first reserved' is quite annoying. My experience
to resolve this case is to use the applicationCache API to 
listen for quota errors, and inform the user to browse to 
chrome://appcache-internals/ and remove other caches over 
the new one. 

    public ActionResult Manifest()
    {     
        var cacheResources = new List<string>();
        var n = 300; 
    
        for (var i = 0; i < n; i++)
            cacheResources.Add("Content/" + Url.Content("collage.jpeg?" + i));
    
        var manifestResult = new ManifestResult("1")
        {
            NetworkResources = new string[] { "*" },
            CacheResources = cacheResources
        };
    
        return manifestResult;
    }