Bug 1475065 part 7. Remove nsIDOMOfflineResourceList constants. r=nika

This commit is contained in:
Boris Zbarsky 2018-07-13 15:42:06 -07:00
parent 6dfe289674
commit 054826053c
5 changed files with 18 additions and 40 deletions

View File

@ -13,28 +13,6 @@ interface nsIDOMOfflineResourceList : nsISupports
*/
readonly attribute nsISupports mozItems;
/**
* State of the application cache this object is associated with.
*/
/* This object is not associated with an application cache. */
const unsigned short UNCACHED = 0;
/* The application cache is not being updated. */
const unsigned short IDLE = 1;
/* The manifest is being fetched and checked for updates */
const unsigned short CHECKING = 2;
/* Resources are being downloaded to be added to the cache */
const unsigned short DOWNLOADING = 3;
/* There is a new version of the application cache available */
const unsigned short UPDATEREADY = 4;
/* The application cache group is now obsolete. */
const unsigned short OBSOLETE = 5;
readonly attribute unsigned short status;
/**

View File

@ -81,7 +81,7 @@ nsDOMOfflineResourceList::nsDOMOfflineResourceList(nsIURI *aManifestURI,
, mDocumentURI(aDocumentURI)
, mLoadingPrincipal(aLoadingPrincipal)
, mExposeCacheUpdateStatus(true)
, mStatus(nsIDOMOfflineResourceList::IDLE)
, mStatus(OfflineResourceList_Binding::IDLE)
, mCachedKeys(nullptr)
, mCachedKeysCount(0)
{
@ -495,7 +495,7 @@ nsDOMOfflineResourceList::GetStatus(uint16_t *aStatus)
// to an UNCACHED.
if (rv == NS_ERROR_DOM_INVALID_STATE_ERR ||
!nsContentUtils::OfflineAppAllowed(mDocumentURI)) {
*aStatus = nsIDOMOfflineResourceList::UNCACHED;
*aStatus = OfflineResourceList_Binding::UNCACHED;
return NS_OK;
}
@ -504,7 +504,7 @@ nsDOMOfflineResourceList::GetStatus(uint16_t *aStatus)
// If this object is not associated with a cache, return UNCACHED
nsCOMPtr<nsIApplicationCache> appCache = GetDocumentAppCache();
if (!appCache) {
*aStatus = nsIDOMOfflineResourceList::UNCACHED;
*aStatus = OfflineResourceList_Binding::UNCACHED;
return NS_OK;
}
@ -512,13 +512,13 @@ nsDOMOfflineResourceList::GetStatus(uint16_t *aStatus)
// If there is an update in process, use its status.
if (mCacheUpdate && mExposeCacheUpdateStatus) {
rv = mCacheUpdate->GetStatus(aStatus);
if (NS_SUCCEEDED(rv) && *aStatus != nsIDOMOfflineResourceList::IDLE) {
if (NS_SUCCEEDED(rv) && *aStatus != OfflineResourceList_Binding::IDLE) {
return NS_OK;
}
}
if (mAvailableApplicationCache) {
*aStatus = nsIDOMOfflineResourceList::UPDATEREADY;
*aStatus = OfflineResourceList_Binding::UPDATEREADY;
return NS_OK;
}
@ -576,7 +576,7 @@ nsDOMOfflineResourceList::SwapCache()
mAvailableApplicationCache->GetClientID(availClientId);
if (availClientId == currClientId)
return NS_ERROR_DOM_INVALID_STATE_ERR;
} else if (mStatus != OBSOLETE) {
} else if (mStatus != OfflineResourceList_Binding::OBSOLETE) {
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
@ -593,7 +593,7 @@ nsDOMOfflineResourceList::SwapCache()
}
mAvailableApplicationCache = nullptr;
mStatus = nsIDOMOfflineResourceList::IDLE;
mStatus = OfflineResourceList_Binding::IDLE;
return NS_OK;
}
@ -688,7 +688,7 @@ nsDOMOfflineResourceList::UpdateStateChanged(nsIOfflineCacheUpdate *aUpdate,
SendEvent(NS_LITERAL_STRING(NOUPDATE_STR));
break;
case STATE_OBSOLETE:
mStatus = nsIDOMOfflineResourceList::OBSOLETE;
mStatus = OfflineResourceList_Binding::OBSOLETE;
mAvailableApplicationCache = nullptr;
SendEvent(NS_LITERAL_STRING(OBSOLETE_STR));
break;
@ -839,7 +839,7 @@ nsDOMOfflineResourceList::UpdateCompleted(nsIOfflineCacheUpdate *aUpdate)
mCacheUpdate = nullptr;
if (NS_SUCCEEDED(rv) && succeeded && !partial) {
mStatus = nsIDOMOfflineResourceList::IDLE;
mStatus = OfflineResourceList_Binding::IDLE;
if (isUpgrade) {
SendEvent(NS_LITERAL_STRING(UPDATEREADY_STR));
} else {

View File

@ -7,6 +7,7 @@
#include "OfflineCacheUpdateChild.h"
#include "nsOfflineCacheUpdate.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/OfflineResourceListBinding.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/net/NeckoCommon.h"
@ -18,7 +19,6 @@
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeOwner.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMOfflineResourceList.h"
#include "nsIDocument.h"
#include "nsIObserverService.h"
#include "nsIURL.h"
@ -256,13 +256,13 @@ OfflineCacheUpdateChild::GetStatus(uint16_t *aStatus)
{
switch (mState) {
case STATE_CHECKING :
*aStatus = nsIDOMOfflineResourceList::CHECKING;
*aStatus = mozilla::dom::OfflineResourceList_Binding::CHECKING;
return NS_OK;
case STATE_DOWNLOADING :
*aStatus = nsIDOMOfflineResourceList::DOWNLOADING;
*aStatus = mozilla::dom::OfflineResourceList_Binding::DOWNLOADING;
return NS_OK;
default :
*aStatus = nsIDOMOfflineResourceList::IDLE;
*aStatus = mozilla::dom::OfflineResourceList_Binding::IDLE;
return NS_OK;
}

View File

@ -61,7 +61,7 @@ interface nsIOfflineCacheUpdateObserver : nsISupports {
interface nsIOfflineCacheUpdate : nsISupports {
/**
* Fetch the status of the running update. This will return a value
* defined in nsIDOMOfflineResourceList.
* defined in OfflineResourceList.webidl.
*/
readonly attribute unsigned short status;

View File

@ -13,9 +13,9 @@
#include "nsICachingChannel.h"
#include "nsIContent.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/OfflineResourceListBinding.h"
#include "nsIDocumentLoader.h"
#include "nsIDOMWindow.h"
#include "nsIDOMOfflineResourceList.h"
#include "nsIDocument.h"
#include "nsIObserverService.h"
#include "nsIURL.h"
@ -2285,13 +2285,13 @@ nsOfflineCacheUpdate::GetStatus(uint16_t *aStatus)
{
switch (mState) {
case STATE_CHECKING :
*aStatus = nsIDOMOfflineResourceList::CHECKING;
*aStatus = dom::OfflineResourceList_Binding::CHECKING;
return NS_OK;
case STATE_DOWNLOADING :
*aStatus = nsIDOMOfflineResourceList::DOWNLOADING;
*aStatus = dom::OfflineResourceList_Binding::DOWNLOADING;
return NS_OK;
default :
*aStatus = nsIDOMOfflineResourceList::IDLE;
*aStatus = dom::OfflineResourceList_Binding::IDLE;
return NS_OK;
}