Backout bec7e68cad9a & a6228bc28958 (bug 786299) for Windows compilation errors on a CLOSED TREE

This commit is contained in:
Ed Morley 2012-09-29 01:44:30 +01:00
Родитель b5a6353aab
Коммит da9299600b
8 изменённых файлов: 10 добавлений и 196 удалений

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

@ -101,7 +101,6 @@
#include "mozilla/dom/ipc/ProcessPriorityManager.h" #include "mozilla/dom/ipc/ProcessPriorityManager.h"
#include "nsPermissionManager.h" #include "nsPermissionManager.h"
#include "nsCookieService.h" #include "nsCookieService.h"
#include "nsApplicationCacheService.h"
extern void NS_ShutdownChainItemPool(); extern void NS_ShutdownChainItemPool();
@ -258,7 +257,6 @@ nsLayoutStatics::Initialize()
nsPermissionManager::AppUninstallObserverInit(); nsPermissionManager::AppUninstallObserverInit();
nsCookieService::AppUninstallObserverInit(); nsCookieService::AppUninstallObserverInit();
nsApplicationCacheService::AppClearDataObserverInit();
nsDOMStorageBaseDB::Init(); nsDOMStorageBaseDB::Init();

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

@ -15,7 +15,7 @@ interface nsILoadContext;
* The application cache service manages the set of application cache * The application cache service manages the set of application cache
* groups. * groups.
*/ */
[scriptable, uuid(1750F671-0170-4d3f-A836-455501141E32)] [scriptable, uuid(F94DB1CC-AB56-480b-8F86-40748878557E)]
interface nsIApplicationCacheService : nsISupports interface nsIApplicationCacheService : nsISupports
{ {
/** /**
@ -62,20 +62,6 @@ interface nsIApplicationCacheService : nsISupports
*/ */
void deactivateGroup(in ACString group); void deactivateGroup(in ACString group);
/**
* Deletes some or all of an application's cache entries.
*
* @param appId
* The mozIApplication.localId of the application.
*
* @param discardOnlyBrowserEntries
* If true, only entries marked as 'inBrowserElement' are deleted
* (this is used by browser applications to delete user browsing
* data/history.). If false, *all* entries for the given appId are
* deleted (this is used for application uninstallation).
*/
void discardByAppId(in int32_t appID, in boolean discardOnlyBrowserEntries);
/** /**
* Try to find the best application cache to serve a resource. * Try to find the best application cache to serve a resource.
*/ */

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

@ -77,7 +77,6 @@
#include "nsILoadContext.h" #include "nsILoadContext.h"
#include "mozilla/Services.h" #include "mozilla/Services.h"
#include "nsIPrivateBrowsingChannel.h" #include "nsIPrivateBrowsingChannel.h"
#include "mozIApplicationClearPrivateDataParams.h"
#include <limits> #include <limits>
@ -1335,46 +1334,6 @@ NS_GetAppInfo(nsIChannel *aChannel, uint32_t *aAppID, bool *aIsInBrowserElement)
return true; return true;
} }
#define TOPIC_WEB_APP_CLEAR_DATA "webapps-clear-data"
/**
* Gets appId and browserOnly parameters from the TOPIC_WEB_APP_CLEAR_DATA
* nsIObserverService notification. Used when clearing user data or
* uninstalling web apps.
*/
inline nsresult
NS_GetAppInfoFromClearDataNotification(nsISupports *aSubject,
uint32_t *aAppID, bool* aBrowserOnly)
{
nsresult rv;
nsCOMPtr<mozIApplicationClearPrivateDataParams>
clearParams(do_QueryInterface(aSubject));
MOZ_ASSERT(clearParams);
if (!clearParams) {
return NS_ERROR_UNEXPECTED;
}
uint32_t appId;
rv = clearParams->GetAppId(&appId);
MOZ_ASSERT(NS_SUCCEEDED(rv));
MOZ_ASSERT(appId != NECKO_NO_APP_ID);
MOZ_ASSERT(appId != NECKO_UNKNOWN_APP_ID);
NS_ENSURE_SUCCESS(rv, rv);
if (appId == NECKO_NO_APP_ID || appId == NECKO_UNKNOWN_APP_ID) {
return NS_ERROR_UNEXPECTED;
}
bool browserOnly = false;
rv = clearParams->GetBrowserOnly(&browserOnly);
MOZ_ASSERT(NS_SUCCEEDED(rv));
NS_ENSURE_SUCCESS(rv, rv);
*aAppID = appId;
*aBrowserOnly = browserOnly;
return NS_OK;
}
/** /**
* Wraps an nsIAuthPrompt so that it can be used as an nsIAuthPrompt2. This * Wraps an nsIAuthPrompt so that it can be used as an nsIAuthPrompt2. This
* method is provided mainly for use by other methods in this file. * method is provided mainly for use by other methods in this file.

1
netwerk/cache/Makefile.in поставляемый
Просмотреть файл

@ -30,7 +30,6 @@ XPIDLSRCS = \
EXPORTS = \ EXPORTS = \
nsCacheService.h \ nsCacheService.h \
nsApplicationCacheService.h \
$(NULL) $(NULL)
CPPSRCS = \ CPPSRCS = \

69
netwerk/cache/nsApplicationCacheService.cpp поставляемый
Просмотреть файл

@ -6,18 +6,13 @@
#include "nsDiskCacheDeviceSQL.h" #include "nsDiskCacheDeviceSQL.h"
#include "nsCacheService.h" #include "nsCacheService.h"
#include "nsApplicationCacheService.h" #include "nsApplicationCacheService.h"
#include "nsCRT.h"
#include "nsNetUtil.h" #include "nsNetUtil.h"
#include "nsIObserverService.h"
using namespace mozilla; using namespace mozilla;
static NS_DEFINE_CID(kCacheServiceCID, NS_CACHESERVICE_CID); static NS_DEFINE_CID(kCacheServiceCID, NS_CACHESERVICE_CID);
//-----------------------------------------------------------------------------
// nsApplicationCacheService
//-----------------------------------------------------------------------------
NS_IMPL_ISUPPORTS1(nsApplicationCacheService, nsIApplicationCacheService) NS_IMPL_ISUPPORTS1(nsApplicationCacheService, nsIApplicationCacheService)
nsApplicationCacheService::nsApplicationCacheService() nsApplicationCacheService::nsApplicationCacheService()
@ -134,18 +129,6 @@ nsApplicationCacheService::CacheOpportunistically(nsIApplicationCache* cache,
return device->CacheOpportunistically(cache, key); return device->CacheOpportunistically(cache, key);
} }
NS_IMETHODIMP
nsApplicationCacheService::DiscardByAppId(int32_t appID, bool isInBrowser)
{
if (!mCacheService)
return NS_ERROR_UNEXPECTED;
nsRefPtr<nsOfflineCacheDevice> device;
nsresult rv = mCacheService->GetOfflineDevice(getter_AddRefs(device));
NS_ENSURE_SUCCESS(rv, rv);
return device->DiscardByAppId(appID, isInBrowser);
}
NS_IMETHODIMP NS_IMETHODIMP
nsApplicationCacheService::GetGroups(uint32_t *count, nsApplicationCacheService::GetGroups(uint32_t *count,
char ***keys) char ***keys)
@ -171,53 +154,3 @@ nsApplicationCacheService::GetGroupsTimeOrdered(uint32_t *count,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return device->GetGroupsTimeOrdered(count, keys); return device->GetGroupsTimeOrdered(count, keys);
} }
//-----------------------------------------------------------------------------
// AppCacheClearDataObserver: handles clearing appcache data for app uninstall
// and clearing user data events.
//-----------------------------------------------------------------------------
namespace {
class AppCacheClearDataObserver MOZ_FINAL : public nsIObserver {
public:
NS_DECL_ISUPPORTS
// nsIObserver implementation.
NS_IMETHODIMP
Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
{
MOZ_ASSERT(!nsCRT::strcmp(aTopic, TOPIC_WEB_APP_CLEAR_DATA));
uint32_t appId = NECKO_UNKNOWN_APP_ID;
bool browserOnly = false;
nsresult rv = NS_GetAppInfoFromClearDataNotification(aSubject, &appId,
&browserOnly);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIApplicationCacheService> cacheService =
do_GetService(NS_APPLICATIONCACHESERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return cacheService->DiscardByAppId(appId, browserOnly);
}
};
NS_IMPL_ISUPPORTS1(AppCacheClearDataObserver, nsIObserver)
} // anonymous namespace
// Instantiates and registers AppCacheClearDataObserver for notifications
void
nsApplicationCacheService::AppClearDataObserverInit()
{
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
if (observerService) {
nsRefPtr<AppCacheClearDataObserver> obs
= new AppCacheClearDataObserver();
observerService->AddObserver(obs, TOPIC_WEB_APP_CLEAR_DATA,
/*holdsWeak=*/ false);
}
}

6
netwerk/cache/nsApplicationCacheService.h поставляемый
Просмотреть файл

@ -5,11 +5,8 @@
#ifndef _nsApplicationCacheService_h_ #ifndef _nsApplicationCacheService_h_
#define _nsApplicationCacheService_h_ #define _nsApplicationCacheService_h_
#include "nsIApplicationCacheService.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
class nsCacheService;
class nsApplicationCacheService MOZ_FINAL : public nsIApplicationCacheService class nsApplicationCacheService MOZ_FINAL : public nsIApplicationCacheService
{ {
public: public:
@ -17,9 +14,6 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIAPPLICATIONCACHESERVICE NS_DECL_NSIAPPLICATIONCACHESERVICE
static void AppClearDataObserverInit();
private: private:
nsresult GetJARIdentifier(nsIURI *aURI, nsresult GetJARIdentifier(nsIURI *aURI,
nsILoadContext *aLoadContext, nsILoadContext *aLoadContext,

68
netwerk/cache/nsDiskCacheDeviceSQL.cpp поставляемый
Просмотреть файл

@ -1215,7 +1215,6 @@ nsOfflineCacheDevice::Init()
" AND NameSpace <= ?2 AND ?2 GLOB NameSpace || '*'" " AND NameSpace <= ?2 AND ?2 GLOB NameSpace || '*'"
" ORDER BY NameSpace DESC;"), " ORDER BY NameSpace DESC;"),
StatementSql ( mStatement_InsertNamespaceEntry, "INSERT INTO moz_cache_namespaces (ClientID, NameSpace, Data, ItemType) VALUES(?, ?, ?, ?);"), StatementSql ( mStatement_InsertNamespaceEntry, "INSERT INTO moz_cache_namespaces (ClientID, NameSpace, Data, ItemType) VALUES(?, ?, ?, ?);"),
StatementSql ( mStatement_EnumerateApps, "SELECT GroupID, ActiveClientID FROM moz_cache_groups WHERE GroupID LIKE ?1;"),
StatementSql ( mStatement_EnumerateGroups, "SELECT GroupID, ActiveClientID FROM moz_cache_groups;"), StatementSql ( mStatement_EnumerateGroups, "SELECT GroupID, ActiveClientID FROM moz_cache_groups;"),
StatementSql ( mStatement_EnumerateGroupsTimeOrder, "SELECT GroupID, ActiveClientID FROM moz_cache_groups ORDER BY ActivateTimeStamp;") StatementSql ( mStatement_EnumerateGroupsTimeOrder, "SELECT GroupID, ActiveClientID FROM moz_cache_groups ORDER BY ActivateTimeStamp;")
}; };
@ -1246,17 +1245,6 @@ GetGroupForCache(const nsCSubstring &clientID, nsCString &group)
return NS_OK; return NS_OK;
} }
nsresult
AppendJARIdentifier(nsACString &_result, int32_t appId, bool isInBrowserElement)
{
_result.Append('#');
_result.AppendInt(appId);
_result.Append('+');
_result.Append(isInBrowserElement ? 't' : 'f');
return NS_OK;
}
nsresult nsresult
GetJARIdentifier(nsIURI *aURI, GetJARIdentifier(nsIURI *aURI,
nsILoadContext *aLoadContext, nsILoadContext *aLoadContext,
@ -1283,7 +1271,11 @@ GetJARIdentifier(nsIURI *aURI,
return NS_OK; return NS_OK;
// This load context has some special attributes, create a jar identifier // This load context has some special attributes, create a jar identifier
return AppendJARIdentifier(_result, appId, isInBrowserElement); _result.AppendInt(appId);
_result.Append('+');
_result.Append(isInBrowserElement ? 't' : 'f');
return NS_OK;
} }
} // anon namespace } // anon namespace
@ -1309,8 +1301,10 @@ nsOfflineCacheDevice::BuildApplicationCacheGroupID(nsIURI *aManifestURL,
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
// Include JAR ID, i.e. the extended origin if present. // Include JAR ID, i.e. the extended origin if present.
if (!jarid.IsEmpty()) if (!jarid.IsEmpty()) {
_result.Append('#');
_result.Append(jarid); _result.Append(jarid);
}
return NS_OK; return NS_OK;
} }
@ -2368,52 +2362,6 @@ nsOfflineCacheDevice::DeactivateGroup(const nsACString &group)
return NS_OK; return NS_OK;
} }
nsresult
nsOfflineCacheDevice::DiscardByAppId(int32_t appID, bool browserEntriesOnly)
{
nsresult rv;
nsAutoCString jaridsuffix;
jaridsuffix.Append('%');
rv = AppendJARIdentifier(jaridsuffix, appID, browserEntriesOnly);
NS_ENSURE_SUCCESS(rv, rv);
AutoResetStatement statement(mStatement_EnumerateApps);
rv = statement->BindUTF8StringByIndex(0, jaridsuffix);
NS_ENSURE_SUCCESS(rv, rv);
bool hasRows;
rv = statement->ExecuteStep(&hasRows);
NS_ENSURE_SUCCESS(rv, rv);
while (hasRows) {
nsAutoCString group;
rv = statement->GetUTF8String(0, group);
NS_ENSURE_SUCCESS(rv, rv);
nsCString clientID;
rv = statement->GetUTF8String(1, clientID);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIRunnable> ev =
new nsOfflineCacheDiscardCache(this, group, clientID);
rv = nsCacheService::DispatchToCacheIOThread(ev);
NS_ENSURE_SUCCESS(rv, rv);
rv = statement->ExecuteStep(&hasRows);
NS_ENSURE_SUCCESS(rv, rv);
}
if (!browserEntriesOnly) {
// If deleting app, delete any 'inBrowserElement' entries too
rv = DiscardByAppId(appID, true);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
bool bool
nsOfflineCacheDevice::CanUseCache(nsIURI *keyURI, nsOfflineCacheDevice::CanUseCache(nsIURI *keyURI,
const nsACString &clientID, const nsACString &clientID,

3
netwerk/cache/nsDiskCacheDeviceSQL.h поставляемый
Просмотреть файл

@ -158,8 +158,6 @@ public:
nsresult CacheOpportunistically(nsIApplicationCache* cache, nsresult CacheOpportunistically(nsIApplicationCache* cache,
const nsACString &key); const nsACString &key);
nsresult DiscardByAppId(int32_t appID, bool isInBrowser);
nsresult GetGroups(uint32_t *count,char ***keys); nsresult GetGroups(uint32_t *count,char ***keys);
nsresult GetGroupsTimeOrdered(uint32_t *count, nsresult GetGroupsTimeOrdered(uint32_t *count,
@ -259,7 +257,6 @@ private:
nsCOMPtr<mozIStorageStatement> mStatement_DeactivateGroup; nsCOMPtr<mozIStorageStatement> mStatement_DeactivateGroup;
nsCOMPtr<mozIStorageStatement> mStatement_FindClient; nsCOMPtr<mozIStorageStatement> mStatement_FindClient;
nsCOMPtr<mozIStorageStatement> mStatement_FindClientByNamespace; nsCOMPtr<mozIStorageStatement> mStatement_FindClientByNamespace;
nsCOMPtr<mozIStorageStatement> mStatement_EnumerateApps;
nsCOMPtr<mozIStorageStatement> mStatement_EnumerateGroups; nsCOMPtr<mozIStorageStatement> mStatement_EnumerateGroups;
nsCOMPtr<mozIStorageStatement> mStatement_EnumerateGroupsTimeOrder; nsCOMPtr<mozIStorageStatement> mStatement_EnumerateGroupsTimeOrder;