diff options
author | Alan Kligman <ack@mozilla.com> | 2013-04-25 00:53:43 -0400 |
---|---|---|
committer | Alan Kligman <ack@mozilla.com> | 2013-04-25 00:58:26 -0400 |
commit | 76961c5b522fb7b598a1ec1ae8ae152d0354a635 (patch) | |
tree | 093f64a871a5998967e1838c5dd05a0d82755b92 /tools/file_packager.py | |
parent | 87ce53bcc7a9385a71901f3750db9fd7a25de077 (diff) |
If there's a problem, fall back to default non-cache loading from remote.
Diffstat (limited to 'tools/file_packager.py')
-rw-r--r-- | tools/file_packager.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/file_packager.py b/tools/file_packager.py index 2ad65499..425995d7 100644 --- a/tools/file_packager.py +++ b/tools/file_packager.py @@ -526,6 +526,12 @@ if has_preloaded: if use_preload_cache: code += r''' + function preloadFallback(error) { + console.error(error); + console.error('falling back to default preload behavior'); + fetchRemotePackage(REMOTE_PACKAGE_NAME, processPackageData, handleError); + }; + openDatabase( function(db) { checkCachedPackage(db, PACKAGE_PATH + PACKAGE_NAME, @@ -533,19 +539,19 @@ if has_preloaded: Module.preloadResults[PACKAGE_NAME] = {fromCache: useCached}; if (useCached) { console.info('loading ' + PACKAGE_NAME + ' from cache'); - fetchCachedPackage(db, PACKAGE_PATH + PACKAGE_NAME, processPackageData, handleError); + fetchCachedPackage(db, PACKAGE_PATH + PACKAGE_NAME, processPackageData, preloadFallback); } else { console.info('loading ' + PACKAGE_NAME + ' from remote'); fetchRemotePackage(REMOTE_PACKAGE_NAME, function(packageData) { cacheRemotePackage(db, PACKAGE_PATH + PACKAGE_NAME, packageData, {uuid:PACKAGE_UUID}, processPackageData, handleError); } - , handleError); + , preloadFallback); } } - , handleError); + , preloadFallback); } - , handleError); + , preloadFallback); if (Module['setStatus']) Module['setStatus']('Downloading...'); ''' |