Bug 1329668 Handle partial initialized when ScriptLoader is canceled. r=baku

This commit is contained in:
Ben Kelly 2017-01-10 08:20:16 -08:00
Родитель 095ebc2535
Коммит b54fac30f3
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -1579,13 +1579,17 @@ CacheCreator::DeleteCache()
{ {
AssertIsOnMainThread(); AssertIsOnMainThread();
ErrorResult rv; // This is called when the load is canceled which can occur before
// mCacheStorage is initialized.
if (!mCacheStorage) {
return;
}
// It's safe to do this while Cache::Match() and Cache::Put() calls are // It's safe to do this while Cache::Match() and Cache::Put() calls are
// running. // running.
IgnoredErrorResult rv;
RefPtr<Promise> promise = mCacheStorage->Delete(mCacheName, rv); RefPtr<Promise> promise = mCacheStorage->Delete(mCacheName, rv);
if (NS_WARN_IF(rv.Failed())) { if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return; return;
} }