On Fri, Dec 9, 2011 at 3:04 PM, Brion Vibber <bvibber@wikimedia.org> wrote:
On Fri, Dec 9, 2011 at 2:40 PM, Brion Vibber <bvibber@wikimedia.org> wrote:

However, any loading that *fails* (such as a page that hasn't been cached) triggers an application-fatal error, as far as I can tell because DroidGap assumes that iframes don't exist and the only thing that might fail to load is the entire application. :P This may just have to be hacked around by modifying the phonegap infrastructure. :P

Found this was easy to fix in WikipediaActivity by overriding onReceivedError to do nothing. We get the generic Android browser error page on fail instead, nice!

Work in progress:
https://github.com/brion/Wikipedia/commits/cache-setcachemode

Using setCacheMode to set it to load from cache works nicely, but for only a limited amount of data. It seems that pages get pushed out of cache very quickly -- only a few megabytes seem to be stored and there's no obvious way to increase it.

To ensure that bookmarked or 'saved' pages are consistently available, either a homebrew loader cache with some smarts or something like the existing URLCache should help; but it'd need to be changed to handle images better etc.

I prefer the homebrew loader cache, since it allows standard HTML security separations to stay in effect (assuming PhoneGap doesn't disable them all, which it might considering that the file: pages can do anything to the iframe).


The error fix definitely needs to be kept so things don't esplode ridiculously, or else covered with an alternate error return.

-- brion