mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 730424 - window.applicationCache.status not getting updated when resources finish loading, r=michal
This commit is contained in:
parent
27a0068bcb
commit
433cb50458
@ -86,6 +86,7 @@ nsDOMOfflineResourceList::nsDOMOfflineResourceList(nsIURI *aManifestURI,
|
||||
, mManifestURI(aManifestURI)
|
||||
, mDocumentURI(aDocumentURI)
|
||||
, mExposeCacheUpdateStatus(true)
|
||||
, mDontSetDocumentCache(false)
|
||||
, mStatus(nsIDOMOfflineResourceList::IDLE)
|
||||
, mCachedKeys(nullptr)
|
||||
, mCachedKeysCount(0)
|
||||
@ -449,6 +450,10 @@ nsDOMOfflineResourceList::Update()
|
||||
window, getter_AddRefs(update));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Since we are invoking the cache update, cache on the document must not
|
||||
// be updated until swapCache() method is called on applicationCache object.
|
||||
mDontSetDocumentCache = true;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -620,6 +625,15 @@ NS_IMETHODIMP
|
||||
nsDOMOfflineResourceList::ApplicationCacheAvailable(nsIApplicationCache *aApplicationCache)
|
||||
{
|
||||
mAvailableApplicationCache = aApplicationCache;
|
||||
|
||||
if (!mDontSetDocumentCache) {
|
||||
nsCOMPtr<nsIApplicationCacheContainer> appCacheContainer =
|
||||
GetDocumentAppCacheContainer();
|
||||
|
||||
if (appCacheContainer)
|
||||
appCacheContainer->SetApplicationCache(aApplicationCache);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -718,6 +732,7 @@ nsDOMOfflineResourceList::UpdateCompleted(nsIOfflineCacheUpdate *aUpdate)
|
||||
|
||||
mCacheUpdate->RemoveObserver(this);
|
||||
mCacheUpdate = nullptr;
|
||||
mDontSetDocumentCache = false;
|
||||
|
||||
if (NS_SUCCEEDED(rv) && succeeded && !partial) {
|
||||
if (isUpgrade) {
|
||||
|
@ -79,6 +79,7 @@ private:
|
||||
nsCOMPtr<nsIApplicationCache> mAvailableApplicationCache;
|
||||
nsCOMPtr<nsIOfflineCacheUpdate> mCacheUpdate;
|
||||
bool mExposeCacheUpdateStatus;
|
||||
bool mDontSetDocumentCache;
|
||||
uint16_t mStatus;
|
||||
|
||||
// The set of dynamic keys for this application cache object.
|
||||
|
@ -502,6 +502,14 @@ nsOfflineCacheUpdateService::Schedule(nsIURI *aManifestURI,
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (aWindow) {
|
||||
// Ensure there is window.applicationCache object that is
|
||||
// responsible for association of the new applicationCache
|
||||
// with the corresponding document. Just ignore the result.
|
||||
nsCOMPtr<nsIDOMOfflineResourceList> appCacheWindowObject;
|
||||
aWindow->GetApplicationCache(getter_AddRefs(appCacheWindowObject));
|
||||
}
|
||||
|
||||
rv = update->Init(aManifestURI, aDocumentURI, aDocument,
|
||||
aCustomProfileDir, aAppID, aInBrowser);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
Loading…
Reference in New Issue
Block a user