зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1252998 - StorageActivityService - part 9 - nsIStorageActivityService::moveOriginInTime() for testing, r=asuth
This commit is contained in:
Родитель
169e3c277d
Коммит
50300ecf44
|
@ -6,6 +6,7 @@
|
|||
#include "domstubs.idl"
|
||||
|
||||
interface nsIArray;
|
||||
interface nsIPrincipal;
|
||||
|
||||
/**
|
||||
* nsIStorageActivityService is a service that can be used to know which
|
||||
|
@ -27,6 +28,10 @@ interface nsIStorageActivityService : nsISupports
|
|||
// non-system principals like "moz-extension://ID", "moz-safe-about:home",
|
||||
// "about:newtab", so principals may need to be filtered before being used.
|
||||
nsIArray getActiveOrigins(in PRTime from, in PRTime to);
|
||||
|
||||
// NOTE: This method is meant to be used for testing only.
|
||||
// The activity of |origin| is moved to the specified timestamp |when|.
|
||||
void moveOriginInTime(in nsIPrincipal origin, in PRTime when);
|
||||
};
|
||||
|
||||
%{ C++
|
||||
|
|
|
@ -278,6 +278,24 @@ StorageActivityService::GetActiveOrigins(PRTime aFrom, PRTime aTo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
StorageActivityService::MoveOriginInTime(nsIPrincipal* aPrincipal,
|
||||
PRTime aWhen)
|
||||
{
|
||||
if (!XRE_IsParentProcess()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsAutoCString origin;
|
||||
nsresult rv = aPrincipal->GetOrigin(origin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mActivities.Put(origin, aWhen / PR_USEC_PER_SEC);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(StorageActivityService)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStorageActivityService)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStorageActivityService)
|
||||
|
|
Загрузка…
Ссылка в новой задаче