This commit is contained in:
Kyle Huey 2012-05-28 00:53:57 -07:00
Родитель 6aade7d74c
Коммит 3ab011f0e6
6 изменённых файлов: 11 добавлений и 30 удалений

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

@ -394,15 +394,12 @@ IDBFactory::OpenCommon(const nsAString& aName,
nsCOMPtr<nsPIDOMWindow> window; nsCOMPtr<nsPIDOMWindow> window;
nsCOMPtr<nsIScriptGlobalObject> sgo; nsCOMPtr<nsIScriptGlobalObject> sgo;
JSObject* scriptOwner = nsnull; JSObject* scriptOwner = nsnull;
FactoryPrivilege privilege;
if (mWindow) { if (mWindow) {
window = mWindow; window = mWindow;
privilege = Content;
} }
else { else {
scriptOwner = mOwningObject; scriptOwner = mOwningObject;
privilege = Chrome;
} }
nsCString origin; nsCString origin;
@ -415,8 +412,7 @@ IDBFactory::OpenCommon(const nsAString& aName,
NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); NS_ENSURE_TRUE(request, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
nsRefPtr<OpenDatabaseHelper> openHelper = nsRefPtr<OpenDatabaseHelper> openHelper =
new OpenDatabaseHelper(request, aName, origin, aVersion, aDeleting, new OpenDatabaseHelper(request, aName, origin, aVersion, aDeleting);
privilege);
rv = openHelper->Init(); rv = openHelper->Init();
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);

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

@ -32,11 +32,6 @@ BEGIN_INDEXEDDB_NAMESPACE
class FileInfo; class FileInfo;
enum FactoryPrivilege {
Content,
Chrome
};
struct StructuredCloneReadInfo { struct StructuredCloneReadInfo {
void Swap(StructuredCloneReadInfo& aCloneReadInfo) { void Swap(StructuredCloneReadInfo& aCloneReadInfo) {
mCloneBuffer.swap(aCloneReadInfo.mCloneBuffer); mCloneBuffer.swap(aCloneReadInfo.mCloneBuffer);

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

@ -623,7 +623,6 @@ IndexedDatabaseManager::GetIndexedDBQuotaMB()
nsresult nsresult
IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin, IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
FactoryPrivilege mPrivilege,
nsIFile** aDirectory) nsIFile** aDirectory)
{ {
#ifdef DEBUG #ifdef DEBUG
@ -671,17 +670,15 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
rv = patternFile->GetNativePath(pattern); rv = patternFile->GetNativePath(pattern);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
// Now tell SQLite to start tracking this pattern for content. // Now tell SQLite to start tracking this pattern.
nsCOMPtr<mozIStorageServiceQuotaManagement> ss = nsCOMPtr<mozIStorageServiceQuotaManagement> ss =
do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID); do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(ss, NS_ERROR_FAILURE); NS_ENSURE_TRUE(ss, NS_ERROR_FAILURE);
if (mPrivilege != Chrome) {
rv = ss->SetQuotaForFilenamePattern(pattern, rv = ss->SetQuotaForFilenamePattern(pattern,
GetIndexedDBQuotaMB() * 1024 * 1024, GetIndexedDBQuotaMB() * 1024 * 1024,
mQuotaCallbackSingleton, nsnull); mQuotaCallbackSingleton, nsnull);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
}
// We need to see if there are any files in the directory already. If they // We need to see if there are any files in the directory already. If they
// are database files then we need to create file managers for them and also // are database files then we need to create file managers for them and also
@ -769,10 +766,8 @@ IndexedDatabaseManager::EnsureOriginIsInitialized(const nsACString& aOrigin,
fileManagers->AppendElement(fileManager); fileManagers->AppendElement(fileManager);
if (mPrivilege != Chrome) {
rv = ss->UpdateQuotaInformationForFile(file); rv = ss->UpdateQuotaInformationForFile(file);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
}
validSubdirs.PutEntry(dbBaseFilename); validSubdirs.PutEntry(dbBaseFilename);
} }

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

@ -120,7 +120,6 @@ public:
GetIndexedDBQuotaMB(); GetIndexedDBQuotaMB();
nsresult EnsureOriginIsInitialized(const nsACString& aOrigin, nsresult EnsureOriginIsInitialized(const nsACString& aOrigin,
FactoryPrivilege aPrivilege,
nsIFile** aDirectory); nsIFile** aDirectory);
// Determine if the quota is lifted for the Window the current thread is // Determine if the quota is lifted for the Window the current thread is

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

@ -1589,7 +1589,6 @@ OpenDatabaseHelper::DoDatabaseWork()
NS_ASSERTION(mgr, "This should never be null!"); NS_ASSERTION(mgr, "This should never be null!");
nsresult rv = mgr->EnsureOriginIsInitialized(mASCIIOrigin, nsresult rv = mgr->EnsureOriginIsInitialized(mASCIIOrigin,
mPrivilege,
getter_AddRefs(dbDirectory)); getter_AddRefs(dbDirectory));
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);

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

@ -23,12 +23,10 @@ public:
const nsAString& aName, const nsAString& aName,
const nsACString& aASCIIOrigin, const nsACString& aASCIIOrigin,
PRUint64 aRequestedVersion, PRUint64 aRequestedVersion,
bool aForDeletion, bool aForDeletion)
FactoryPrivilege aPrivilege)
: HelperBase(aRequest), mOpenDBRequest(aRequest), mName(aName), : HelperBase(aRequest), mOpenDBRequest(aRequest), mName(aName),
mASCIIOrigin(aASCIIOrigin), mRequestedVersion(aRequestedVersion), mASCIIOrigin(aASCIIOrigin), mRequestedVersion(aRequestedVersion),
mForDeletion(aForDeletion), mPrivilege(aPrivilege), mForDeletion(aForDeletion), mDatabaseId(nsnull), mCurrentVersion(0),
mDatabaseId(nsnull), mCurrentVersion(0),
mLastObjectStoreId(0), mLastIndexId(0), mState(eCreated), mLastObjectStoreId(0), mLastIndexId(0), mState(eCreated),
mResultCode(NS_OK), mLoadDBMetadata(false) mResultCode(NS_OK), mLoadDBMetadata(false)
{ {
@ -97,7 +95,6 @@ private:
nsCString mASCIIOrigin; nsCString mASCIIOrigin;
PRUint64 mRequestedVersion; PRUint64 mRequestedVersion;
bool mForDeletion; bool mForDeletion;
FactoryPrivilege mPrivilege;
nsCOMPtr<nsIAtom> mDatabaseId; nsCOMPtr<nsIAtom> mDatabaseId;
// Out-params. // Out-params.