Commit da929960 authored by Ed Morley's avatar Ed Morley
Browse files

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

parent b5a6353a
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -101,7 +101,6 @@
#include "mozilla/dom/ipc/ProcessPriorityManager.h"
#include "nsPermissionManager.h"
#include "nsCookieService.h"
#include "nsApplicationCacheService.h"

extern void NS_ShutdownChainItemPool();

@@ -258,7 +257,6 @@ nsLayoutStatics::Initialize()

  nsPermissionManager::AppUninstallObserverInit();
  nsCookieService::AppUninstallObserverInit();
  nsApplicationCacheService::AppClearDataObserverInit();

  nsDOMStorageBaseDB::Init();

+1 −15
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ interface nsILoadContext;
 * The application cache service manages the set of application cache
 * groups.
 */
[scriptable, uuid(1750F671-0170-4d3f-A836-455501141E32)]
[scriptable, uuid(F94DB1CC-AB56-480b-8F86-40748878557E)]
interface nsIApplicationCacheService : nsISupports
{
    /**
@@ -62,20 +62,6 @@ interface nsIApplicationCacheService : nsISupports
     */
    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.
     */
+0 −41
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@
#include "nsILoadContext.h"
#include "mozilla/Services.h"
#include "nsIPrivateBrowsingChannel.h"
#include "mozIApplicationClearPrivateDataParams.h"

#include <limits>

@@ -1335,46 +1334,6 @@ NS_GetAppInfo(nsIChannel *aChannel, uint32_t *aAppID, bool *aIsInBrowserElement)
    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
 * method is provided mainly for use by other methods in this file.
+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ XPIDLSRCS = \

EXPORTS = \
  nsCacheService.h \
  nsApplicationCacheService.h \
  $(NULL)

CPPSRCS = \
+1 −68
Original line number Diff line number Diff line
@@ -6,18 +6,13 @@
#include "nsDiskCacheDeviceSQL.h"
#include "nsCacheService.h"
#include "nsApplicationCacheService.h"
#include "nsCRT.h"

#include "nsNetUtil.h"
#include "nsIObserverService.h"

using namespace mozilla;

static NS_DEFINE_CID(kCacheServiceCID, NS_CACHESERVICE_CID);

//-----------------------------------------------------------------------------
// nsApplicationCacheService
//-----------------------------------------------------------------------------

NS_IMPL_ISUPPORTS1(nsApplicationCacheService, nsIApplicationCacheService)

nsApplicationCacheService::nsApplicationCacheService()
@@ -134,18 +129,6 @@ nsApplicationCacheService::CacheOpportunistically(nsIApplicationCache* cache,
    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
nsApplicationCacheService::GetGroups(uint32_t *count,
                                     char ***keys)
@@ -171,53 +154,3 @@ nsApplicationCacheService::GetGroupsTimeOrdered(uint32_t *count,
    NS_ENSURE_SUCCESS(rv, rv);
    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);
    }
}
Loading