mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 17cfad44e12b (bug 1155963) for breaking b2g builds
This commit is contained in:
parent
5019e17cd7
commit
d65ee4fe20
@ -361,12 +361,13 @@ dbus_done:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//check gconf-2 setting
|
//check gconf-2 setting
|
||||||
#define GCONF_A11Y_KEY "/desktop/gnome/interface/accessibility"
|
static const char sGconfAccessibilityKey[] =
|
||||||
|
"/desktop/gnome/interface/accessibility";
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIGConfService> gconf =
|
nsCOMPtr<nsIGConfService> gconf =
|
||||||
do_GetService(NS_GCONFSERVICE_CONTRACTID, &rv);
|
do_GetService(NS_GCONFSERVICE_CONTRACTID, &rv);
|
||||||
if (NS_SUCCEEDED(rv) && gconf)
|
if (NS_SUCCEEDED(rv) && gconf)
|
||||||
gconf->GetBool(NS_LITERAL_CSTRING(GCONF_A11Y_KEY), &sShouldEnable);
|
gconf->GetBool(NS_LITERAL_CSTRING(sGconfAccessibilityKey), &sShouldEnable);
|
||||||
|
|
||||||
return sShouldEnable;
|
return sShouldEnable;
|
||||||
}
|
}
|
||||||
|
@ -790,7 +790,7 @@ nsPrincipal::IsOnCSSUnprefixingWhitelist()
|
|||||||
|
|
||||||
/************************************************************************************************************************/
|
/************************************************************************************************************************/
|
||||||
|
|
||||||
#define EXPANDED_PRINCIPAL_SPEC "[Expanded Principal]"
|
static const char EXPANDED_PRINCIPAL_SPEC[] = "[Expanded Principal]";
|
||||||
|
|
||||||
NS_IMPL_CLASSINFO(nsExpandedPrincipal, nullptr, nsIClassInfo::MAIN_THREAD_ONLY,
|
NS_IMPL_CLASSINFO(nsExpandedPrincipal, nullptr, nsIClassInfo::MAIN_THREAD_ONLY,
|
||||||
NS_EXPANDEDPRINCIPAL_CID)
|
NS_EXPANDEDPRINCIPAL_CID)
|
||||||
@ -1015,7 +1015,8 @@ nsExpandedPrincipal::IsOnCSSUnprefixingWhitelist()
|
|||||||
void
|
void
|
||||||
nsExpandedPrincipal::GetScriptLocation(nsACString& aStr)
|
nsExpandedPrincipal::GetScriptLocation(nsACString& aStr)
|
||||||
{
|
{
|
||||||
aStr.AssignLiteral(EXPANDED_PRINCIPAL_SPEC " (");
|
aStr.Assign(EXPANDED_PRINCIPAL_SPEC);
|
||||||
|
aStr.AppendLiteral(" (");
|
||||||
|
|
||||||
for (size_t i = 0; i < mPrincipals.Length(); ++i) {
|
for (size_t i = 0; i < mPrincipals.Length(); ++i) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
|
@ -51,12 +51,12 @@ nsSystemPrincipal::Release()
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SYSTEM_PRINCIPAL_SPEC "[System Principal]"
|
static const char SYSTEM_PRINCIPAL_SPEC[] = "[System Principal]";
|
||||||
|
|
||||||
void
|
void
|
||||||
nsSystemPrincipal::GetScriptLocation(nsACString &aStr)
|
nsSystemPrincipal::GetScriptLocation(nsACString &aStr)
|
||||||
{
|
{
|
||||||
aStr.AssignLiteral(SYSTEM_PRINCIPAL_SPEC);
|
aStr.Assign(SYSTEM_PRINCIPAL_SPEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -1527,7 +1527,7 @@ FetchBody<Derived>::ContinueConsumeBody(nsresult aStatus, uint32_t aResultLength
|
|||||||
data.Adopt(reinterpret_cast<char*>(aResult), aResultLength);
|
data.Adopt(reinterpret_cast<char*>(aResult), aResultLength);
|
||||||
autoFree.Reset();
|
autoFree.Reset();
|
||||||
|
|
||||||
NS_NAMED_LITERAL_CSTRING(formDataMimeType, "multipart/form-data");
|
NS_NAMED_LITERAL_CSTRING(formDataMimeType, NS_LITERAL_CSTRING("multipart/form-data"));
|
||||||
|
|
||||||
// Allow semicolon separated boundary/encoding suffix like multipart/form-data; boundary=
|
// Allow semicolon separated boundary/encoding suffix like multipart/form-data; boundary=
|
||||||
// but disallow multipart/form-datafoobar.
|
// but disallow multipart/form-datafoobar.
|
||||||
@ -1550,7 +1550,7 @@ FetchBody<Derived>::ContinueConsumeBody(nsresult aStatus, uint32_t aResultLength
|
|||||||
MOZ_ASSERT(fd);
|
MOZ_ASSERT(fd);
|
||||||
localPromise->MaybeResolve(fd);
|
localPromise->MaybeResolve(fd);
|
||||||
} else {
|
} else {
|
||||||
NS_NAMED_LITERAL_CSTRING(urlDataMimeType, "application/x-www-form-urlencoded");
|
NS_NAMED_LITERAL_CSTRING(urlDataMimeType, NS_LITERAL_CSTRING("application/x-www-form-urlencoded"));
|
||||||
bool isValidUrlEncodedMimeType = StringBeginsWith(mMimeType, urlDataMimeType);
|
bool isValidUrlEncodedMimeType = StringBeginsWith(mMimeType, urlDataMimeType);
|
||||||
|
|
||||||
if (isValidUrlEncodedMimeType && mMimeType.Length() > urlDataMimeType.Length()) {
|
if (isValidUrlEncodedMimeType && mMimeType.Length() > urlDataMimeType.Length()) {
|
||||||
|
@ -216,11 +216,11 @@ const uint32_t kConnectionIdleCloseMS = 10 * 1000; // 10 seconds
|
|||||||
// The length of time that idle threads will stay alive before being shut down.
|
// The length of time that idle threads will stay alive before being shut down.
|
||||||
const uint32_t kConnectionThreadIdleMS = 30 * 1000; // 30 seconds
|
const uint32_t kConnectionThreadIdleMS = 30 * 1000; // 30 seconds
|
||||||
|
|
||||||
#define SAVEPOINT_CLAUSE "SAVEPOINT sp;"
|
const char kSavepointClause[] = "SAVEPOINT sp;";
|
||||||
|
|
||||||
const uint32_t kFileCopyBufferSize = 32768;
|
const uint32_t kFileCopyBufferSize = 32768;
|
||||||
|
|
||||||
#define JOURNAL_DIRECTORY_NAME "journals"
|
const char kJournalDirectoryName[] = "journals";
|
||||||
|
|
||||||
const char kFileManagerDirectoryNameSuffix[] = ".files";
|
const char kFileManagerDirectoryNameSuffix[] = ".files";
|
||||||
const char kSQLiteJournalSuffix[] = ".sqlite-journal";
|
const char kSQLiteJournalSuffix[] = ".sqlite-journal";
|
||||||
@ -231,9 +231,15 @@ const char kPrefIndexedDBEnabled[] = "dom.indexedDB.enabled";
|
|||||||
|
|
||||||
#define IDB_PREFIX "indexedDB"
|
#define IDB_PREFIX "indexedDB"
|
||||||
|
|
||||||
#define PERMISSION_STRING_CHROME_BASE IDB_PREFIX "-chrome-"
|
#ifdef MOZ_CHILD_PERMISSIONS
|
||||||
#define PERMISSION_STRING_CHROME_READ_SUFFIX "-read"
|
const char kPermissionString[] = IDB_PREFIX;
|
||||||
#define PERMISSION_STRING_CHROME_WRITE_SUFFIX "-write"
|
#endif // MOZ_CHILD_PERMISSIONS
|
||||||
|
|
||||||
|
const char kPermissionStringChromeBase[] = IDB_PREFIX "-chrome-";
|
||||||
|
const char kPermissionStringChromeReadSuffix[] = "-read";
|
||||||
|
const char kPermissionStringChromeWriteSuffix[] = "-write";
|
||||||
|
|
||||||
|
#undef IDB_PREFIX
|
||||||
|
|
||||||
enum AppId {
|
enum AppId {
|
||||||
kNoAppId = nsIScriptSecurityManager::NO_APP_ID,
|
kNoAppId = nsIScriptSecurityManager::NO_APP_ID,
|
||||||
@ -4374,6 +4380,18 @@ public:
|
|||||||
GetCachedStatement(const nsACString& aQuery,
|
GetCachedStatement(const nsACString& aQuery,
|
||||||
CachedStatement* aCachedStatement);
|
CachedStatement* aCachedStatement);
|
||||||
|
|
||||||
|
template <size_t N>
|
||||||
|
nsresult
|
||||||
|
GetCachedStatement(const char (&aQuery)[N],
|
||||||
|
CachedStatement* aCachedStatement)
|
||||||
|
{
|
||||||
|
static_assert(N > 1, "Must have a non-empty string!");
|
||||||
|
AssertIsOnConnectionThread();
|
||||||
|
MOZ_ASSERT(aCachedStatement);
|
||||||
|
|
||||||
|
return GetCachedStatement(NS_LITERAL_CSTRING(aQuery), aCachedStatement);
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
BeginWriteTransaction();
|
BeginWriteTransaction();
|
||||||
|
|
||||||
@ -8329,7 +8347,7 @@ DatabaseConnection::Init()
|
|||||||
MOZ_ASSERT(!mInWriteTransaction);
|
MOZ_ASSERT(!mInWriteTransaction);
|
||||||
|
|
||||||
CachedStatement stmt;
|
CachedStatement stmt;
|
||||||
nsresult rv = GetCachedStatement(NS_LITERAL_CSTRING("BEGIN"), &stmt);
|
nsresult rv = GetCachedStatement("BEGIN", &stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -8396,7 +8414,7 @@ DatabaseConnection::BeginWriteTransaction()
|
|||||||
|
|
||||||
// Release our read locks.
|
// Release our read locks.
|
||||||
CachedStatement rollbackStmt;
|
CachedStatement rollbackStmt;
|
||||||
nsresult rv = GetCachedStatement(NS_LITERAL_CSTRING("ROLLBACK"), &rollbackStmt);
|
nsresult rv = GetCachedStatement("ROLLBACK", &rollbackStmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -8424,7 +8442,7 @@ DatabaseConnection::BeginWriteTransaction()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CachedStatement beginStmt;
|
CachedStatement beginStmt;
|
||||||
rv = GetCachedStatement(NS_LITERAL_CSTRING("BEGIN IMMEDIATE"), &beginStmt);
|
rv = GetCachedStatement("BEGIN IMMEDIATE", &beginStmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -8473,7 +8491,7 @@ DatabaseConnection::RollbackWriteTransaction()
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
nsresult rv = GetCachedStatement(NS_LITERAL_CSTRING("ROLLBACK"), &stmt);
|
nsresult rv = GetCachedStatement("ROLLBACK", &stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -8504,7 +8522,7 @@ DatabaseConnection::FinishWriteTransaction()
|
|||||||
mInWriteTransaction = false;
|
mInWriteTransaction = false;
|
||||||
|
|
||||||
CachedStatement stmt;
|
CachedStatement stmt;
|
||||||
nsresult rv = GetCachedStatement(NS_LITERAL_CSTRING("BEGIN"), &stmt);
|
nsresult rv = GetCachedStatement("BEGIN", &stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -8528,7 +8546,7 @@ DatabaseConnection::StartSavepoint()
|
|||||||
js::ProfileEntry::Category::STORAGE);
|
js::ProfileEntry::Category::STORAGE);
|
||||||
|
|
||||||
CachedStatement stmt;
|
CachedStatement stmt;
|
||||||
nsresult rv = GetCachedStatement(NS_LITERAL_CSTRING(SAVEPOINT_CLAUSE), &stmt);
|
nsresult rv = GetCachedStatement(kSavepointClause, &stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -8562,7 +8580,7 @@ DatabaseConnection::ReleaseSavepoint()
|
|||||||
|
|
||||||
CachedStatement stmt;
|
CachedStatement stmt;
|
||||||
nsresult rv = GetCachedStatement(
|
nsresult rv = GetCachedStatement(
|
||||||
NS_LITERAL_CSTRING("RELEASE " SAVEPOINT_CLAUSE),
|
NS_LITERAL_CSTRING("RELEASE ") + NS_LITERAL_CSTRING(kSavepointClause),
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
rv = stmt->Execute();
|
rv = stmt->Execute();
|
||||||
@ -8600,7 +8618,7 @@ DatabaseConnection::RollbackSavepoint()
|
|||||||
|
|
||||||
CachedStatement stmt;
|
CachedStatement stmt;
|
||||||
nsresult rv = GetCachedStatement(
|
nsresult rv = GetCachedStatement(
|
||||||
NS_LITERAL_CSTRING("ROLLBACK TO " SAVEPOINT_CLAUSE),
|
NS_LITERAL_CSTRING("ROLLBACK TO ") + NS_LITERAL_CSTRING(kSavepointClause),
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -8622,14 +8640,22 @@ DatabaseConnection::Checkpoint(bool aIdle)
|
|||||||
"DatabaseConnection::Checkpoint",
|
"DatabaseConnection::Checkpoint",
|
||||||
js::ProfileEntry::Category::STORAGE);
|
js::ProfileEntry::Category::STORAGE);
|
||||||
|
|
||||||
CachedStatement stmt;
|
nsAutoCString checkpointMode;
|
||||||
nsresult rv =
|
if (aIdle) {
|
||||||
GetCachedStatement(aIdle ?
|
|
||||||
// When idle we want to reclaim disk space.
|
// When idle we want to reclaim disk space.
|
||||||
NS_LITERAL_CSTRING("PRAGMA wal_checkpoint(TRUNCATE)") :
|
checkpointMode.AssignLiteral("TRUNCATE");
|
||||||
|
} else {
|
||||||
// We're being called at the end of a READ_WRITE_FLUSH transaction so make
|
// We're being called at the end of a READ_WRITE_FLUSH transaction so make
|
||||||
// sure that the database is completely checkpointed and flushed to disk.
|
// sure that the database is completely checkpointed and flushed to disk.
|
||||||
NS_LITERAL_CSTRING("PRAGMA wal_checkpoint(FULL)"),
|
checkpointMode.AssignLiteral("FULL");
|
||||||
|
}
|
||||||
|
|
||||||
|
CachedStatement stmt;
|
||||||
|
nsresult rv =
|
||||||
|
GetCachedStatement(
|
||||||
|
NS_LITERAL_CSTRING("PRAGMA wal_checkpoint(") +
|
||||||
|
checkpointMode +
|
||||||
|
NS_LITERAL_CSTRING(")"),
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -9219,10 +9245,10 @@ DatabaseUpdateFunction::UpdateInternal(int64_t aId,
|
|||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
if (!mUpdateStatement) {
|
if (!mUpdateStatement) {
|
||||||
rv = connection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = connection->GetCachedStatement(
|
||||||
"UPDATE file "
|
"UPDATE file "
|
||||||
"SET refcount = refcount + :delta "
|
"SET refcount = refcount + :delta "
|
||||||
"WHERE id = :id"),
|
"WHERE id = :id",
|
||||||
&mUpdateStatement);
|
&mUpdateStatement);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -9254,10 +9280,10 @@ DatabaseUpdateFunction::UpdateInternal(int64_t aId,
|
|||||||
|
|
||||||
if (rows > 0) {
|
if (rows > 0) {
|
||||||
if (!mSelectStatement) {
|
if (!mSelectStatement) {
|
||||||
rv = connection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = connection->GetCachedStatement(
|
||||||
"SELECT id "
|
"SELECT id "
|
||||||
"FROM file "
|
"FROM file "
|
||||||
"WHERE id = :id"),
|
"WHERE id = :id",
|
||||||
&mSelectStatement);
|
&mSelectStatement);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -9287,9 +9313,9 @@ DatabaseUpdateFunction::UpdateInternal(int64_t aId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!mInsertStatement) {
|
if (!mInsertStatement) {
|
||||||
rv = connection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = connection->GetCachedStatement(
|
||||||
"INSERT INTO file (id, refcount) "
|
"INSERT INTO file (id, refcount) "
|
||||||
"VALUES(:id, :delta)"),
|
"VALUES(:id, :delta)",
|
||||||
&mInsertStatement);
|
&mInsertStatement);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -14244,7 +14270,8 @@ FileManager::Init(nsIFile* aDirectory,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = journalDirectory->Append(NS_LITERAL_STRING(JOURNAL_DIRECTORY_NAME));
|
NS_ConvertASCIItoUTF16 dirName(NS_LITERAL_CSTRING(kJournalDirectoryName));
|
||||||
|
rv = journalDirectory->Append(dirName);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -14496,7 +14523,8 @@ FileManager::InitDirectory(nsIFile* aDirectory,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = journalDirectory->Append(NS_LITERAL_STRING(JOURNAL_DIRECTORY_NAME));
|
NS_ConvertASCIItoUTF16 dirName(NS_LITERAL_CSTRING(kJournalDirectoryName));
|
||||||
|
rv = journalDirectory->Append(dirName);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -14679,7 +14707,7 @@ FileManager::GetUsage(nsIFile* aDirectory, uint64_t* aUsage)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leafName.EqualsLiteral(JOURNAL_DIRECTORY_NAME)) {
|
if (leafName.EqualsLiteral(kJournalDirectoryName)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15248,7 +15276,7 @@ QuotaClient::GetUsageForDirectoryInternal(nsIFile* aDirectory,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!leafName.EqualsLiteral(JOURNAL_DIRECTORY_NAME)) {
|
if (!leafName.EqualsLiteral(kJournalDirectoryName)) {
|
||||||
NS_WARNING("Unknown directory found!");
|
NS_WARNING("Unknown directory found!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -16016,19 +16044,19 @@ DatabaseOperationBase::InsertIndexTableRows(
|
|||||||
if (stmt) {
|
if (stmt) {
|
||||||
stmt.Reset();
|
stmt.Reset();
|
||||||
} else if (info.mUnique) {
|
} else if (info.mUnique) {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"INSERT INTO unique_index_data "
|
"INSERT INTO unique_index_data "
|
||||||
"(index_id, value, object_store_id, object_data_key) "
|
"(index_id, value, object_store_id, object_data_key) "
|
||||||
"VALUES (:index_id, :value, :object_store_id, :object_data_key);"),
|
"VALUES (:index_id, :value, :object_store_id, :object_data_key);",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"INSERT OR IGNORE INTO index_data "
|
"INSERT OR IGNORE INTO index_data "
|
||||||
"(index_id, value, object_data_key, object_store_id) "
|
"(index_id, value, object_data_key, object_store_id) "
|
||||||
"VALUES (:index_id, :value, :object_data_key, :object_store_id);"),
|
"VALUES (:index_id, :value, :object_data_key, :object_store_id);",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -16118,20 +16146,20 @@ DatabaseOperationBase::DeleteIndexDataTableRows(
|
|||||||
if (stmt) {
|
if (stmt) {
|
||||||
stmt.Reset();
|
stmt.Reset();
|
||||||
} else if (indexValue.mUnique) {
|
} else if (indexValue.mUnique) {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM unique_index_data "
|
"DELETE FROM unique_index_data "
|
||||||
"WHERE index_id = :index_id "
|
"WHERE index_id = :index_id "
|
||||||
"AND value = :value;"),
|
"AND value = :value;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM index_data "
|
"DELETE FROM index_data "
|
||||||
"WHERE index_id = :index_id "
|
"WHERE index_id = :index_id "
|
||||||
"AND value = :value "
|
"AND value = :value "
|
||||||
"AND object_data_key = :object_data_key;"),
|
"AND object_data_key = :object_data_key;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -16194,11 +16222,11 @@ DatabaseOperationBase::DeleteObjectStoreDataTableRowsWithIndexes(
|
|||||||
DatabaseConnection::CachedStatement selectStmt;
|
DatabaseConnection::CachedStatement selectStmt;
|
||||||
|
|
||||||
if (singleRowOnly) {
|
if (singleRowOnly) {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"SELECT index_data_values "
|
"SELECT index_data_values "
|
||||||
"FROM object_data "
|
"FROM object_data "
|
||||||
"WHERE object_store_id = :object_store_id "
|
"WHERE object_store_id = :object_store_id "
|
||||||
"AND key = :key;"),
|
"AND key = :key;",
|
||||||
&selectStmt);
|
&selectStmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -16271,10 +16299,10 @@ DatabaseOperationBase::DeleteObjectStoreDataTableRowsWithIndexes(
|
|||||||
if (deleteStmt) {
|
if (deleteStmt) {
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(deleteStmt->Reset()));
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(deleteStmt->Reset()));
|
||||||
} else {
|
} else {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM object_data "
|
"DELETE FROM object_data "
|
||||||
"WHERE object_store_id = :object_store_id "
|
"WHERE object_store_id = :object_store_id "
|
||||||
"AND key = :key;"),
|
"AND key = :key;",
|
||||||
&deleteStmt);
|
&deleteStmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -16335,11 +16363,11 @@ DatabaseOperationBase::UpdateIndexValues(
|
|||||||
MOZ_ASSERT(!indexDataValuesLength == !(indexDataValues.get()));
|
MOZ_ASSERT(!indexDataValuesLength == !(indexDataValues.get()));
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement updateStmt;
|
DatabaseConnection::CachedStatement updateStmt;
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"UPDATE object_data "
|
"UPDATE object_data "
|
||||||
"SET index_data_values = :index_data_values "
|
"SET index_data_values = :index_data_values "
|
||||||
"WHERE object_store_id = :object_store_id "
|
"WHERE object_store_id = :object_store_id "
|
||||||
"AND key = :key;"),
|
"AND key = :key;",
|
||||||
&updateStmt);
|
&updateStmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -16396,10 +16424,10 @@ DatabaseOperationBase::ObjectStoreHasIndexes(DatabaseConnection* aConnection,
|
|||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
|
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
aConnection->GetCachedStatement(
|
||||||
"SELECT id "
|
"SELECT id "
|
||||||
"FROM object_store_index "
|
"FROM object_store_index "
|
||||||
"WHERE object_store_id = :object_store_id;"),
|
"WHERE object_store_id = :object_store_id;",
|
||||||
&stmt)));
|
&stmt)));
|
||||||
|
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
@ -16758,10 +16786,10 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
|
|||||||
// Check to make sure that the child process has access to the database it
|
// Check to make sure that the child process has access to the database it
|
||||||
// is accessing.
|
// is accessing.
|
||||||
NS_NAMED_LITERAL_CSTRING(permissionStringBase,
|
NS_NAMED_LITERAL_CSTRING(permissionStringBase,
|
||||||
PERMISSION_STRING_CHROME_BASE);
|
kPermissionStringChromeBase);
|
||||||
NS_ConvertUTF16toUTF8 databaseName(mCommonParams.metadata().name());
|
NS_ConvertUTF16toUTF8 databaseName(mCommonParams.metadata().name());
|
||||||
NS_NAMED_LITERAL_CSTRING(readSuffix, PERMISSION_STRING_CHROME_READ_SUFFIX);
|
NS_NAMED_LITERAL_CSTRING(readSuffix, kPermissionStringChromeReadSuffix);
|
||||||
NS_NAMED_LITERAL_CSTRING(writeSuffix, PERMISSION_STRING_CHROME_WRITE_SUFFIX);
|
NS_NAMED_LITERAL_CSTRING(writeSuffix, kPermissionStringChromeWriteSuffix);
|
||||||
|
|
||||||
const nsAutoCString permissionStringWrite =
|
const nsAutoCString permissionStringWrite =
|
||||||
permissionStringBase + databaseName + writeSuffix;
|
permissionStringBase + databaseName + writeSuffix;
|
||||||
@ -16850,7 +16878,7 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t intPermission =
|
uint32_t intPermission =
|
||||||
mozilla::CheckPermission(aContentParent, principal, IDB_PREFIX);
|
mozilla::CheckPermission(aContentParent, principal, kPermissionString);
|
||||||
|
|
||||||
permission =
|
permission =
|
||||||
PermissionRequestBase::PermissionValueForIntPermission(intPermission);
|
PermissionRequestBase::PermissionValueForIntPermission(intPermission);
|
||||||
@ -18343,17 +18371,18 @@ VersionChangeOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_NAMED_LITERAL_CSTRING(version, "version");
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement updateStmt;
|
DatabaseConnection::CachedStatement updateStmt;
|
||||||
rv = aConnection->GetCachedStatement(
|
rv = aConnection->GetCachedStatement(
|
||||||
NS_LITERAL_CSTRING("UPDATE database "
|
NS_LITERAL_CSTRING("UPDATE database "
|
||||||
"SET version = :version"),
|
"SET version = :") + version,
|
||||||
&updateStmt);
|
&updateStmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = updateStmt->BindInt64ByName(NS_LITERAL_CSTRING("version"),
|
rv = updateStmt->BindInt64ByName(version, int64_t(mRequestedVersion));
|
||||||
int64_t(mRequestedVersion));
|
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -19395,7 +19424,7 @@ CommitOp::AssertForeignKeyConsistency(DatabaseConnection* aConnection)
|
|||||||
|
|
||||||
DatabaseConnection::CachedStatement pragmaStmt;
|
DatabaseConnection::CachedStatement pragmaStmt;
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
aConnection->GetCachedStatement(NS_LITERAL_CSTRING("PRAGMA foreign_keys;"), &pragmaStmt)));
|
aConnection->GetCachedStatement("PRAGMA foreign_keys;", &pragmaStmt)));
|
||||||
|
|
||||||
bool hasResult;
|
bool hasResult;
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(pragmaStmt->ExecuteStep(&hasResult)));
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(pragmaStmt->ExecuteStep(&hasResult)));
|
||||||
@ -19409,7 +19438,7 @@ CommitOp::AssertForeignKeyConsistency(DatabaseConnection* aConnection)
|
|||||||
|
|
||||||
DatabaseConnection::CachedStatement checkStmt;
|
DatabaseConnection::CachedStatement checkStmt;
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
aConnection->GetCachedStatement(NS_LITERAL_CSTRING("PRAGMA foreign_key_check;"), &checkStmt)));
|
aConnection->GetCachedStatement("PRAGMA foreign_key_check;", &checkStmt)));
|
||||||
|
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(checkStmt->ExecuteStep(&hasResult)));
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(checkStmt->ExecuteStep(&hasResult)));
|
||||||
|
|
||||||
@ -19462,7 +19491,7 @@ CommitOp::Run()
|
|||||||
AssertForeignKeyConsistency(connection);
|
AssertForeignKeyConsistency(connection);
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
mResultCode = connection->GetCachedStatement(NS_LITERAL_CSTRING("COMMIT"), &stmt);
|
mResultCode = connection->GetCachedStatement("COMMIT", &stmt);
|
||||||
NS_WARN_IF_FALSE(NS_SUCCEEDED(mResultCode),
|
NS_WARN_IF_FALSE(NS_SUCCEEDED(mResultCode),
|
||||||
"Failed to get 'COMMIT' statement!");
|
"Failed to get 'COMMIT' statement!");
|
||||||
|
|
||||||
@ -19613,10 +19642,10 @@ CreateObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
// have thrown an error long before now...
|
// have thrown an error long before now...
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
aConnection->GetCachedStatement(
|
||||||
"SELECT name "
|
"SELECT name "
|
||||||
"FROM object_store "
|
"FROM object_store "
|
||||||
"WHERE name = :name;"),
|
"WHERE name = :name;",
|
||||||
&stmt)));
|
&stmt)));
|
||||||
|
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
@ -19635,9 +19664,9 @@ CreateObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"INSERT INTO object_store (id, auto_increment, name, key_path) "
|
"INSERT INTO object_store (id, auto_increment, name, key_path) "
|
||||||
"VALUES (:id, :auto_increment, :name, :key_path)"),
|
"VALUES (:id, :auto_increment, :name, :key_path)",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -19713,9 +19742,9 @@ DeleteObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
// Make sure |mIsLastObjectStore| is telling the truth.
|
// Make sure |mIsLastObjectStore| is telling the truth.
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
aConnection->GetCachedStatement(
|
||||||
"SELECT id "
|
"SELECT id "
|
||||||
"FROM object_store;"),
|
"FROM object_store;",
|
||||||
&stmt)));
|
&stmt)));
|
||||||
|
|
||||||
bool foundThisObjectStore = false;
|
bool foundThisObjectStore = false;
|
||||||
@ -19760,8 +19789,8 @@ DeleteObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
if (mIsLastObjectStore) {
|
if (mIsLastObjectStore) {
|
||||||
// We can just delete everything if this is the last object store.
|
// We can just delete everything if this is the last object store.
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM index_data;"),
|
"DELETE FROM index_data;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -19772,8 +19801,8 @@ DeleteObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM unique_index_data;"),
|
"DELETE FROM unique_index_data;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -19784,8 +19813,8 @@ DeleteObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM object_data;"),
|
"DELETE FROM object_data;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -19796,8 +19825,8 @@ DeleteObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM object_store_index;"),
|
"DELETE FROM object_store_index;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -19808,8 +19837,8 @@ DeleteObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM object_store;"),
|
"DELETE FROM object_store;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -19831,9 +19860,9 @@ DeleteObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
|
|
||||||
// Now clean up the object store index table.
|
// Now clean up the object store index table.
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM object_store_index "
|
"DELETE FROM object_store_index "
|
||||||
"WHERE object_store_id = :object_store_id;"),
|
"WHERE object_store_id = :object_store_id;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -19853,9 +19882,9 @@ DeleteObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
// We only have to worry about object data if this object store has no
|
// We only have to worry about object data if this object store has no
|
||||||
// indexes.
|
// indexes.
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM object_data "
|
"DELETE FROM object_data "
|
||||||
"WHERE object_store_id = :object_store_id;"),
|
"WHERE object_store_id = :object_store_id;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -19874,9 +19903,9 @@ DeleteObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM object_store "
|
"DELETE FROM object_store "
|
||||||
"WHERE id = :object_store_id;"),
|
"WHERE id = :object_store_id;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -19998,11 +20027,11 @@ CreateIndexOp::InsertDataFromObjectStoreInternal(
|
|||||||
MOZ_ASSERT(storageConnection);
|
MOZ_ASSERT(storageConnection);
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
nsresult rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
nsresult rv = aConnection->GetCachedStatement(
|
||||||
"UPDATE object_data "
|
"UPDATE object_data "
|
||||||
"SET index_data_values = update_index_data_values "
|
"SET index_data_values = update_index_data_values "
|
||||||
"(key, index_data_values, file_ids, data) "
|
"(key, index_data_values, file_ids, data) "
|
||||||
"WHERE object_store_id = :object_store_id;"),
|
"WHERE object_store_id = :object_store_id;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -20079,11 +20108,11 @@ CreateIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
// we should have thrown an error long before now...
|
// we should have thrown an error long before now...
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
aConnection->GetCachedStatement(
|
||||||
"SELECT name "
|
"SELECT name "
|
||||||
"FROM object_store_index "
|
"FROM object_store_index "
|
||||||
"WHERE object_store_id = :osid "
|
"WHERE object_store_id = :osid "
|
||||||
"AND name = :name;"),
|
"AND name = :name;",
|
||||||
&stmt)));
|
&stmt)));
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mObjectStoreId)));
|
stmt->BindInt64ByName(NS_LITERAL_CSTRING("osid"), mObjectStoreId)));
|
||||||
@ -20104,10 +20133,10 @@ CreateIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"INSERT INTO object_store_index (id, name, key_path, unique_index, "
|
"INSERT INTO object_store_index (id, name, key_path, unique_index, "
|
||||||
"multientry, object_store_id) "
|
"multientry, object_store_id) "
|
||||||
"VALUES (:id, :name, :key_path, :unique, :multientry, :osid)"),
|
"VALUES (:id, :name, :key_path, :unique, :multientry, :osid)",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -20509,11 +20538,11 @@ DeleteIndexOp::RemoveReferencesToIndex(
|
|||||||
// There is no need to parse the previous entry in the index_data_values
|
// There is no need to parse the previous entry in the index_data_values
|
||||||
// column if this is the last index. Simply set it to NULL.
|
// column if this is the last index. Simply set it to NULL.
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
nsresult rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
nsresult rv = aConnection->GetCachedStatement(
|
||||||
"UPDATE object_data "
|
"UPDATE object_data "
|
||||||
"SET index_data_values = NULL "
|
"SET index_data_values = NULL "
|
||||||
"WHERE object_store_id = :object_store_id "
|
"WHERE object_store_id = :object_store_id "
|
||||||
"AND key = :key;"),
|
"AND key = :key;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -20607,10 +20636,10 @@ DeleteIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
// Make sure |mIsLastIndex| is telling the truth.
|
// Make sure |mIsLastIndex| is telling the truth.
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
aConnection->GetCachedStatement(
|
||||||
"SELECT id "
|
"SELECT id "
|
||||||
"FROM object_store_index "
|
"FROM object_store_index "
|
||||||
"WHERE object_store_id = :object_store_id;"),
|
"WHERE object_store_id = :object_store_id;",
|
||||||
&stmt)));
|
&stmt)));
|
||||||
|
|
||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(
|
||||||
@ -20660,15 +20689,15 @@ DeleteIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
// The cost of having an index on this field is too high.
|
// The cost of having an index on this field is too high.
|
||||||
if (mUnique) {
|
if (mUnique) {
|
||||||
if (mIsLastIndex) {
|
if (mIsLastIndex) {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"/* do not warn (bug someone else) */ "
|
"/* do not warn (bug someone else) */ "
|
||||||
"SELECT value, object_data_key "
|
"SELECT value, object_data_key "
|
||||||
"FROM unique_index_data "
|
"FROM unique_index_data "
|
||||||
"WHERE index_id = :index_id "
|
"WHERE index_id = :index_id "
|
||||||
"ORDER BY object_data_key ASC;"),
|
"ORDER BY object_data_key ASC;",
|
||||||
&selectStmt);
|
&selectStmt);
|
||||||
} else {
|
} else {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"/* do not warn (bug out) */ "
|
"/* do not warn (bug out) */ "
|
||||||
"SELECT unique_index_data.value, "
|
"SELECT unique_index_data.value, "
|
||||||
"unique_index_data.object_data_key, "
|
"unique_index_data.object_data_key, "
|
||||||
@ -20678,21 +20707,21 @@ DeleteIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
"ON unique_index_data.object_data_key = object_data.key "
|
"ON unique_index_data.object_data_key = object_data.key "
|
||||||
"WHERE unique_index_data.index_id = :index_id "
|
"WHERE unique_index_data.index_id = :index_id "
|
||||||
"AND object_data.object_store_id = :object_store_id "
|
"AND object_data.object_store_id = :object_store_id "
|
||||||
"ORDER BY unique_index_data.object_data_key ASC;"),
|
"ORDER BY unique_index_data.object_data_key ASC;",
|
||||||
&selectStmt);
|
&selectStmt);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mIsLastIndex) {
|
if (mIsLastIndex) {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"/* do not warn (bug me not) */ "
|
"/* do not warn (bug me not) */ "
|
||||||
"SELECT value, object_data_key "
|
"SELECT value, object_data_key "
|
||||||
"FROM index_data "
|
"FROM index_data "
|
||||||
"WHERE index_id = :index_id "
|
"WHERE index_id = :index_id "
|
||||||
"AND object_store_id = :object_store_id "
|
"AND object_store_id = :object_store_id "
|
||||||
"ORDER BY object_data_key ASC;"),
|
"ORDER BY object_data_key ASC;",
|
||||||
&selectStmt);
|
&selectStmt);
|
||||||
} else {
|
} else {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"/* do not warn (bug off) */ "
|
"/* do not warn (bug off) */ "
|
||||||
"SELECT index_data.value, "
|
"SELECT index_data.value, "
|
||||||
"index_data.object_data_key, "
|
"index_data.object_data_key, "
|
||||||
@ -20702,7 +20731,7 @@ DeleteIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
"ON index_data.object_data_key = object_data.key "
|
"ON index_data.object_data_key = object_data.key "
|
||||||
"WHERE index_data.index_id = :index_id "
|
"WHERE index_data.index_id = :index_id "
|
||||||
"AND object_data.object_store_id = :object_store_id "
|
"AND object_data.object_store_id = :object_store_id "
|
||||||
"ORDER BY index_data.object_data_key ASC;"),
|
"ORDER BY index_data.object_data_key ASC;",
|
||||||
&selectStmt);
|
&selectStmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -20803,17 +20832,17 @@ DeleteIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(deleteIndexRowStmt->Reset()));
|
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(deleteIndexRowStmt->Reset()));
|
||||||
} else {
|
} else {
|
||||||
if (mUnique) {
|
if (mUnique) {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM unique_index_data "
|
"DELETE FROM unique_index_data "
|
||||||
"WHERE index_id = :index_id "
|
"WHERE index_id = :index_id "
|
||||||
"AND value = :value;"),
|
"AND value = :value;",
|
||||||
&deleteIndexRowStmt);
|
&deleteIndexRowStmt);
|
||||||
} else {
|
} else {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM index_data "
|
"DELETE FROM index_data "
|
||||||
"WHERE index_id = :index_id "
|
"WHERE index_id = :index_id "
|
||||||
"AND value = :value "
|
"AND value = :value "
|
||||||
"AND object_data_key = :object_data_key;"),
|
"AND object_data_key = :object_data_key;",
|
||||||
&deleteIndexRowStmt);
|
&deleteIndexRowStmt);
|
||||||
}
|
}
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
@ -20861,9 +20890,9 @@ DeleteIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement deleteStmt;
|
DatabaseConnection::CachedStatement deleteStmt;
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM object_store_index "
|
"DELETE FROM object_store_index "
|
||||||
"WHERE id = :index_id;"),
|
"WHERE id = :index_id;",
|
||||||
&deleteStmt);
|
&deleteStmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -20995,11 +21024,11 @@ ObjectStoreAddOrPutRequestOp::RemoveOldIndexDataValues(
|
|||||||
MOZ_ASSERT(mObjectStoreHasIndexes);
|
MOZ_ASSERT(mObjectStoreHasIndexes);
|
||||||
|
|
||||||
DatabaseConnection::CachedStatement indexValuesStmt;
|
DatabaseConnection::CachedStatement indexValuesStmt;
|
||||||
nsresult rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
nsresult rv = aConnection->GetCachedStatement(
|
||||||
"SELECT index_data_values "
|
"SELECT index_data_values "
|
||||||
"FROM object_data "
|
"FROM object_data "
|
||||||
"WHERE object_store_id = :object_store_id "
|
"WHERE object_store_id = :object_store_id "
|
||||||
"AND key = :key;"),
|
"AND key = :key;",
|
||||||
&indexValuesStmt);
|
&indexValuesStmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
@ -21244,16 +21273,16 @@ ObjectStoreAddOrPutRequestOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
// detectable errors rather than corrupting data.
|
// detectable errors rather than corrupting data.
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
if (!mOverwrite || keyUnset) {
|
if (!mOverwrite || keyUnset) {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"INSERT INTO object_data "
|
"INSERT INTO object_data "
|
||||||
"(object_store_id, key, file_ids, data) "
|
"(object_store_id, key, file_ids, data) "
|
||||||
"VALUES (:osid, :key, :file_ids, :data);"),
|
"VALUES (:osid, :key, :file_ids, :data);",
|
||||||
&stmt);
|
&stmt);
|
||||||
} else {
|
} else {
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"INSERT OR REPLACE INTO object_data "
|
"INSERT OR REPLACE INTO object_data "
|
||||||
"(object_store_id, key, file_ids, data) "
|
"(object_store_id, key, file_ids, data) "
|
||||||
"VALUES (:osid, :key, :file_ids, :data);"),
|
"VALUES (:osid, :key, :file_ids, :data);",
|
||||||
&stmt);
|
&stmt);
|
||||||
}
|
}
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
@ -22008,9 +22037,9 @@ ObjectStoreClearRequestOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DatabaseConnection::CachedStatement stmt;
|
DatabaseConnection::CachedStatement stmt;
|
||||||
rv = aConnection->GetCachedStatement(NS_LITERAL_CSTRING(
|
rv = aConnection->GetCachedStatement(
|
||||||
"DELETE FROM object_data "
|
"DELETE FROM object_data "
|
||||||
"WHERE object_store_id = :object_store_id;"),
|
"WHERE object_store_id = :object_store_id;",
|
||||||
&stmt);
|
&stmt);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -111,12 +111,12 @@ const char kChromeOrigin[] = "chrome";
|
|||||||
const char kAboutHomeOrigin[] = "moz-safe-about:home";
|
const char kAboutHomeOrigin[] = "moz-safe-about:home";
|
||||||
const char kIndexedDBOriginPrefix[] = "indexeddb://";
|
const char kIndexedDBOriginPrefix[] = "indexeddb://";
|
||||||
|
|
||||||
#define INDEXEDDB_DIRECTORY_NAME "indexedDB"
|
const char kIndexedDBDirectoryName[] = "indexedDB";
|
||||||
#define STORAGE_DIRECTORY_NAME "storage"
|
const char kStorageDirectoryName[] = "storage";
|
||||||
#define PERSISTENT_DIRECTORY_NAME "persistent"
|
const char kPersistentDirectoryName[] = "persistent";
|
||||||
#define PERMANENT_DIRECTORY_NAME "permanent"
|
const char kPermanentDirectoryName[] = "permanent";
|
||||||
#define TEMPORARY_DIRECTORY_NAME "temporary"
|
const char kTemporaryDirectoryName[] = "temporary";
|
||||||
#define DEFAULT_DIRECTORY_NAME "default"
|
const char kDefaultDirectoryName[] = "default";
|
||||||
|
|
||||||
enum AppId {
|
enum AppId {
|
||||||
kNoAppId = nsIScriptSecurityManager::NO_APP_ID,
|
kNoAppId = nsIScriptSecurityManager::NO_APP_ID,
|
||||||
@ -801,7 +801,7 @@ IsTreatedAsTemporary(PersistenceType aPersistenceType,
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
CloneStoragePath(nsIFile* aBaseDir,
|
CloneStoragePath(nsIFile* aBaseDir,
|
||||||
const nsAString& aStorageName,
|
const nsACString& aStorageName,
|
||||||
nsAString& aStoragePath)
|
nsAString& aStoragePath)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
@ -812,7 +812,8 @@ CloneStoragePath(nsIFile* aBaseDir,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = storageDir->Append(aStorageName);
|
NS_ConvertASCIItoUTF16 dirName(aStorageName);
|
||||||
|
rv = storageDir->Append(dirName);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -1426,28 +1427,29 @@ QuotaManager::Init()
|
|||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = CloneStoragePath(baseDir,
|
rv = CloneStoragePath(baseDir,
|
||||||
NS_LITERAL_STRING(INDEXEDDB_DIRECTORY_NAME),
|
NS_LITERAL_CSTRING(kIndexedDBDirectoryName),
|
||||||
mIndexedDBPath);
|
mIndexedDBPath);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = baseDir->Append(NS_LITERAL_STRING(STORAGE_DIRECTORY_NAME));
|
NS_ConvertASCIItoUTF16 dirName(NS_LITERAL_CSTRING(kStorageDirectoryName));
|
||||||
|
rv = baseDir->Append(dirName);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = baseDir->GetPath(mStoragePath);
|
rv = baseDir->GetPath(mStoragePath);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = CloneStoragePath(baseDir,
|
rv = CloneStoragePath(baseDir,
|
||||||
NS_LITERAL_STRING(PERMANENT_DIRECTORY_NAME),
|
NS_LITERAL_CSTRING(kPermanentDirectoryName),
|
||||||
mPermanentStoragePath);
|
mPermanentStoragePath);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = CloneStoragePath(baseDir,
|
rv = CloneStoragePath(baseDir,
|
||||||
NS_LITERAL_STRING(TEMPORARY_DIRECTORY_NAME),
|
NS_LITERAL_CSTRING(kTemporaryDirectoryName),
|
||||||
mTemporaryStoragePath);
|
mTemporaryStoragePath);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = CloneStoragePath(baseDir,
|
rv = CloneStoragePath(baseDir,
|
||||||
NS_LITERAL_STRING(DEFAULT_DIRECTORY_NAME),
|
NS_LITERAL_CSTRING(kDefaultDirectoryName),
|
||||||
mDefaultStoragePath);
|
mDefaultStoragePath);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
@ -2131,7 +2133,8 @@ QuotaManager::MaybeUpgradeIndexedDBDirectory()
|
|||||||
rv = persistentStorageDir->InitWithPath(mStoragePath);
|
rv = persistentStorageDir->InitWithPath(mStoragePath);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = persistentStorageDir->Append(NS_LITERAL_STRING(PERSISTENT_DIRECTORY_NAME));
|
NS_ConvertASCIItoUTF16 dirName(NS_LITERAL_CSTRING(kPersistentDirectoryName));
|
||||||
|
rv = persistentStorageDir->Append(dirName);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = persistentStorageDir->Exists(&exists);
|
rv = persistentStorageDir->Exists(&exists);
|
||||||
@ -2152,7 +2155,7 @@ QuotaManager::MaybeUpgradeIndexedDBDirectory()
|
|||||||
// However there's a theoretical possibility that the indexedDB directory
|
// However there's a theoretical possibility that the indexedDB directory
|
||||||
// is on different volume, but it should be rare enough that we don't have
|
// is on different volume, but it should be rare enough that we don't have
|
||||||
// to worry about it.
|
// to worry about it.
|
||||||
rv = indexedDBDir->MoveTo(storageDir, NS_LITERAL_STRING(PERSISTENT_DIRECTORY_NAME));
|
rv = indexedDBDir->MoveTo(storageDir, dirName);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -2176,7 +2179,8 @@ QuotaManager::MaybeUpgradePersistentStorageDirectory()
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = persistentStorageDir->Append(NS_LITERAL_STRING(PERSISTENT_DIRECTORY_NAME));
|
NS_ConvertASCIItoUTF16 dirName(NS_LITERAL_CSTRING(kPersistentDirectoryName));
|
||||||
|
rv = persistentStorageDir->Append(dirName);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -2271,7 +2275,8 @@ QuotaManager::MaybeUpgradePersistentStorageDirectory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// And finally rename persistent to default.
|
// And finally rename persistent to default.
|
||||||
rv = persistentStorageDir->RenameTo(nullptr, NS_LITERAL_STRING(DEFAULT_DIRECTORY_NAME));
|
NS_ConvertASCIItoUTF16 defDirName(NS_LITERAL_CSTRING(kDefaultDirectoryName));
|
||||||
|
rv = persistentStorageDir->RenameTo(nullptr, defDirName);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -2480,7 +2485,7 @@ QuotaManager::GetStorageId(PersistenceType aPersistenceType,
|
|||||||
str.Append('*');
|
str.Append('*');
|
||||||
str.AppendInt(aClientType);
|
str.AppendInt(aClientType);
|
||||||
str.Append('*');
|
str.Append('*');
|
||||||
AppendUTF16toUTF8(aName, str);
|
str.Append(NS_ConvertUTF16toUTF8(aName));
|
||||||
|
|
||||||
aDatabaseId = str;
|
aDatabaseId = str;
|
||||||
}
|
}
|
||||||
|
@ -356,10 +356,10 @@ nsPermissionManager::AppClearDataObserverInit()
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsPermissionManager Implementation
|
// nsPermissionManager Implementation
|
||||||
|
|
||||||
#define PERMISSIONS_FILE_NAME "permissions.sqlite"
|
static const char kPermissionsFileName[] = "permissions.sqlite";
|
||||||
#define HOSTS_SCHEMA_VERSION 4
|
#define HOSTS_SCHEMA_VERSION 4
|
||||||
|
|
||||||
#define HOSTPERM_FILE_NAME "hostperm.1"
|
static const char kHostpermFileName[] = "hostperm.1";
|
||||||
|
|
||||||
// Default permissions are read from a URL - this is the preference we read
|
// Default permissions are read from a URL - this is the preference we read
|
||||||
// to find that URL. If not set, don't use any default permissions.
|
// to find that URL. If not set, don't use any default permissions.
|
||||||
@ -453,7 +453,7 @@ nsPermissionManager::InitDB(bool aRemoveFile)
|
|||||||
}
|
}
|
||||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
|
NS_ENSURE_SUCCESS(rv, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
rv = permissionsFile->AppendNative(NS_LITERAL_CSTRING(PERMISSIONS_FILE_NAME));
|
rv = permissionsFile->AppendNative(NS_LITERAL_CSTRING(kPermissionsFileName));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (aRemoveFile) {
|
if (aRemoveFile) {
|
||||||
@ -1861,7 +1861,7 @@ nsPermissionManager::Import()
|
|||||||
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(permissionsFile));
|
rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(permissionsFile));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = permissionsFile->AppendNative(NS_LITERAL_CSTRING(HOSTPERM_FILE_NAME));
|
rv = permissionsFile->AppendNative(NS_LITERAL_CSTRING(kHostpermFileName));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIInputStream> fileInputStream;
|
nsCOMPtr<nsIInputStream> fileInputStream;
|
||||||
|
@ -128,7 +128,7 @@ const uint32_t STARTUP_WINDOW = 5U * 60U; // 5min
|
|||||||
const uint32_t METADATA_VERSION = 1;
|
const uint32_t METADATA_VERSION = 1;
|
||||||
|
|
||||||
// ID Extensions for cache entries
|
// ID Extensions for cache entries
|
||||||
#define PREDICTOR_ORIGIN_EXTENSION "predictor-origin"
|
const char PREDICTOR_ORIGIN_EXTENSION[] = "predictor-origin";
|
||||||
|
|
||||||
// Get the full origin (scheme, host, port) out of a URI (maybe should be part
|
// Get the full origin (scheme, host, port) out of a URI (maybe should be part
|
||||||
// of nsIURI instead?)
|
// of nsIURI instead?)
|
||||||
@ -506,16 +506,16 @@ class NuwaMarkPredictorThreadRunner : public nsRunnable
|
|||||||
|
|
||||||
// Predictor::nsICacheEntryMetaDataVisitor
|
// Predictor::nsICacheEntryMetaDataVisitor
|
||||||
|
|
||||||
#define SEEN_META_DATA "predictor::seen"
|
static const char seenMetaData[] = "predictor::seen";
|
||||||
#define META_DATA_PREFIX "predictor::"
|
static const char metaDataPrefix[] = "predictor::";
|
||||||
nsresult
|
nsresult
|
||||||
Predictor::OnMetaDataElement(const char *asciiKey, const char *asciiValue)
|
Predictor::OnMetaDataElement(const char *asciiKey, const char *asciiValue)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
if (!StringBeginsWith(nsDependentCString(asciiKey),
|
if (!StringBeginsWith(nsDependentCString(asciiKey),
|
||||||
NS_LITERAL_CSTRING(META_DATA_PREFIX)) ||
|
NS_LITERAL_CSTRING(metaDataPrefix)) ||
|
||||||
NS_LITERAL_CSTRING(SEEN_META_DATA).Equals(asciiKey)) {
|
NS_LITERAL_CSTRING(seenMetaData).Equals(asciiKey)) {
|
||||||
// This isn't a bit of metadata we care about
|
// This isn't a bit of metadata we care about
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -1336,10 +1336,10 @@ Predictor::LearnInternal(PredictorLearnReason reason, nsICacheEntry *entry,
|
|||||||
|
|
||||||
nsCString junk;
|
nsCString junk;
|
||||||
if (!fullUri && reason == nsINetworkPredictor::LEARN_LOAD_TOPLEVEL &&
|
if (!fullUri && reason == nsINetworkPredictor::LEARN_LOAD_TOPLEVEL &&
|
||||||
NS_FAILED(entry->GetMetaDataElement(SEEN_META_DATA, getter_Copies(junk)))) {
|
NS_FAILED(entry->GetMetaDataElement(seenMetaData, getter_Copies(junk)))) {
|
||||||
// This is an origin-only entry that we haven't seen before. Let's mark it
|
// This is an origin-only entry that we haven't seen before. Let's mark it
|
||||||
// as seen.
|
// as seen.
|
||||||
entry->SetMetaDataElement(SEEN_META_DATA, "1");
|
entry->SetMetaDataElement(seenMetaData, "1");
|
||||||
|
|
||||||
// Need to ensure someone else can get to the entry if necessary
|
// Need to ensure someone else can get to the entry if necessary
|
||||||
entry->MetaDataReady();
|
entry->MetaDataReady();
|
||||||
@ -1376,8 +1376,8 @@ Predictor::SpaceCleaner::OnMetaDataElement(const char *key, const char *value)
|
|||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
if (!StringBeginsWith(nsDependentCString(key),
|
if (!StringBeginsWith(nsDependentCString(key),
|
||||||
NS_LITERAL_CSTRING(META_DATA_PREFIX)) ||
|
NS_LITERAL_CSTRING(metaDataPrefix)) ||
|
||||||
NS_LITERAL_CSTRING(SEEN_META_DATA).Equals(key)) {
|
NS_LITERAL_CSTRING(seenMetaData).Equals(key)) {
|
||||||
// This isn't a bit of metadata we care about
|
// This isn't a bit of metadata we care about
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -1420,7 +1420,7 @@ Predictor::LearnForSubresource(nsICacheEntry *entry, nsIURI *targetURI)
|
|||||||
RETURN_IF_FAILED(rv);
|
RETURN_IF_FAILED(rv);
|
||||||
|
|
||||||
nsCString key;
|
nsCString key;
|
||||||
key.AssignLiteral(META_DATA_PREFIX);
|
key.AssignASCII(metaDataPrefix);
|
||||||
nsCString uri;
|
nsCString uri;
|
||||||
targetURI->GetAsciiSpec(uri);
|
targetURI->GetAsciiSpec(uri);
|
||||||
key.Append(uri);
|
key.Append(uri);
|
||||||
@ -1554,7 +1554,7 @@ Predictor::ParseMetaDataEntry(const char *key, const char *value, nsIURI **uri,
|
|||||||
PREDICTOR_LOG((" flags -> %u", flags));
|
PREDICTOR_LOG((" flags -> %u", flags));
|
||||||
|
|
||||||
if (key) {
|
if (key) {
|
||||||
const char *uriStart = key + (sizeof(META_DATA_PREFIX) - 1);
|
const char *uriStart = key + (sizeof(metaDataPrefix) - 1);
|
||||||
nsresult rv = NS_NewURI(uri, uriStart, nullptr, mIOService);
|
nsresult rv = NS_NewURI(uri, uriStart, nullptr, mIOService);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
PREDICTOR_LOG((" NS_NewURI returned 0x%X", rv));
|
PREDICTOR_LOG((" NS_NewURI returned 0x%X", rv));
|
||||||
@ -1652,7 +1652,7 @@ Predictor::Resetter::OnMetaDataElement(const char *asciiKey,
|
|||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
if (!StringBeginsWith(nsDependentCString(asciiKey),
|
if (!StringBeginsWith(nsDependentCString(asciiKey),
|
||||||
NS_LITERAL_CSTRING(META_DATA_PREFIX))) {
|
NS_LITERAL_CSTRING(metaDataPrefix))) {
|
||||||
// Not a metadata entry we care about, carry on
|
// Not a metadata entry we care about, carry on
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace net {
|
namespace net {
|
||||||
|
|
||||||
#define CONTEXT_EVICTION_PREFIX "ce_"
|
const char kContextEvictionPrefix[] = "ce_";
|
||||||
const uint32_t kContextEvictionPrefixLength =
|
const uint32_t kContextEvictionPrefixLength =
|
||||||
sizeof(CONTEXT_EVICTION_PREFIX) - 1;
|
sizeof(kContextEvictionPrefix) - 1;
|
||||||
|
|
||||||
bool CacheFileContextEvictor::sDiskAlreadySearched = false;
|
bool CacheFileContextEvictor::sDiskAlreadySearched = false;
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ CacheFileContextEvictor::Init(nsIFile *aCacheDirectory)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = mEntriesDir->AppendNative(NS_LITERAL_CSTRING(ENTRIES_DIR));
|
rv = mEntriesDir->AppendNative(NS_LITERAL_CSTRING(kEntriesDir));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ CacheFileContextEvictor::LoadEvictInfoFromDisk()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StringBeginsWith(leaf, NS_LITERAL_CSTRING(CONTEXT_EVICTION_PREFIX))) {
|
if (!StringBeginsWith(leaf, NS_LITERAL_CSTRING(kContextEvictionPrefix))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,7 +395,7 @@ CacheFileContextEvictor::GetContextFile(nsILoadContextInfo *aLoadContextInfo,
|
|||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsAutoCString leafName;
|
nsAutoCString leafName;
|
||||||
leafName.AssignLiteral(CONTEXT_EVICTION_PREFIX);
|
leafName.Assign(NS_LITERAL_CSTRING(kContextEvictionPrefix));
|
||||||
|
|
||||||
nsAutoCString keyPrefix;
|
nsAutoCString keyPrefix;
|
||||||
CacheFileUtils::AppendKeyPrefix(aLoadContextInfo, keyPrefix);
|
CacheFileUtils::AppendKeyPrefix(aLoadContextInfo, keyPrefix);
|
||||||
|
@ -2802,7 +2802,7 @@ CacheFileIOManager::EvictAllInternal()
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = file->AppendNative(NS_LITERAL_CSTRING(ENTRIES_DIR));
|
rv = file->AppendNative(NS_LITERAL_CSTRING(kEntriesDir));
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -2817,7 +2817,7 @@ CacheFileIOManager::EvictAllInternal()
|
|||||||
NS_DispatchToMainThread(r);
|
NS_DispatchToMainThread(r);
|
||||||
|
|
||||||
// Create a new empty entries directory
|
// Create a new empty entries directory
|
||||||
rv = CheckAndCreateDir(mCacheDirectory, ENTRIES_DIR, false);
|
rv = CheckAndCreateDir(mCacheDirectory, kEntriesDir, false);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -3013,7 +3013,7 @@ CacheFileIOManager::TrashDirectory(nsIFile *aFile)
|
|||||||
|
|
||||||
srand(static_cast<unsigned>(PR_Now()));
|
srand(static_cast<unsigned>(PR_Now()));
|
||||||
while (true) {
|
while (true) {
|
||||||
leaf = TRASH_DIR;
|
leaf = kTrashDir;
|
||||||
leaf.AppendInt(rand());
|
leaf.AppendInt(rand());
|
||||||
rv = trash->SetNativeLeafName(leaf);
|
rv = trash->SetNativeLeafName(leaf);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@ -3256,11 +3256,11 @@ CacheFileIOManager::FindTrashDirToRemove()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (leafName.Length() < strlen(TRASH_DIR)) {
|
if (leafName.Length() < strlen(kTrashDir)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StringBeginsWith(leafName, NS_LITERAL_CSTRING(TRASH_DIR))) {
|
if (!StringBeginsWith(leafName, NS_LITERAL_CSTRING(kTrashDir))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3422,7 +3422,7 @@ CacheFileIOManager::GetFile(const SHA1Sum::Hash *aHash, nsIFile **_retval)
|
|||||||
rv = mCacheDirectory->Clone(getter_AddRefs(file));
|
rv = mCacheDirectory->Clone(getter_AddRefs(file));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = file->AppendNative(NS_LITERAL_CSTRING(ENTRIES_DIR));
|
rv = file->AppendNative(NS_LITERAL_CSTRING(kEntriesDir));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsAutoCString leafName;
|
nsAutoCString leafName;
|
||||||
@ -3458,7 +3458,7 @@ CacheFileIOManager::GetDoomedFile(nsIFile **_retval)
|
|||||||
rv = mCacheDirectory->Clone(getter_AddRefs(file));
|
rv = mCacheDirectory->Clone(getter_AddRefs(file));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = file->AppendNative(NS_LITERAL_CSTRING(DOOMED_DIR));
|
rv = file->AppendNative(NS_LITERAL_CSTRING(kDoomedDir));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = file->AppendNative(NS_LITERAL_CSTRING("dummyleaf"));
|
rv = file->AppendNative(NS_LITERAL_CSTRING("dummyleaf"));
|
||||||
@ -3586,11 +3586,11 @@ CacheFileIOManager::CreateCacheTree()
|
|||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// ensure entries directory exists
|
// ensure entries directory exists
|
||||||
rv = CheckAndCreateDir(mCacheDirectory, ENTRIES_DIR, false);
|
rv = CheckAndCreateDir(mCacheDirectory, kEntriesDir, false);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// ensure doomed directory exists
|
// ensure doomed directory exists
|
||||||
rv = CheckAndCreateDir(mCacheDirectory, DOOMED_DIR, true);
|
rv = CheckAndCreateDir(mCacheDirectory, kDoomedDir, true);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mTreeCreated = true;
|
mTreeCreated = true;
|
||||||
@ -3782,8 +3782,8 @@ CacheFileIOManager::SyncRemoveAllCacheFiles()
|
|||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
SyncRemoveDir(mCacheDirectory, ENTRIES_DIR);
|
SyncRemoveDir(mCacheDirectory, kEntriesDir);
|
||||||
SyncRemoveDir(mCacheDirectory, DOOMED_DIR);
|
SyncRemoveDir(mCacheDirectory, kDoomedDir);
|
||||||
|
|
||||||
// Clear any intermediate state of trash dir enumeration.
|
// Clear any intermediate state of trash dir enumeration.
|
||||||
mFailedTrashDirs.Clear();
|
mFailedTrashDirs.Clear();
|
||||||
|
@ -32,9 +32,9 @@ class CacheFile;
|
|||||||
class CacheFileHandlesEntry;
|
class CacheFileHandlesEntry;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ENTRIES_DIR "entries"
|
const char kEntriesDir[] = "entries";
|
||||||
#define DOOMED_DIR "doomed"
|
const char kDoomedDir[] = "doomed";
|
||||||
#define TRASH_DIR "trash"
|
const char kTrashDir[] = "trash";
|
||||||
|
|
||||||
|
|
||||||
class CacheFileHandle : public nsISupports
|
class CacheFileHandle : public nsISupports
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
#define kIndexVersion 0x00000001
|
#define kIndexVersion 0x00000001
|
||||||
#define kUpdateIndexStartDelay 50000 // in milliseconds
|
#define kUpdateIndexStartDelay 50000 // in milliseconds
|
||||||
|
|
||||||
#define INDEX_NAME "index"
|
const char kIndexName[] = "index";
|
||||||
#define TEMP_INDEX_NAME "index.tmp"
|
const char kTempIndexName[] = "index.tmp";
|
||||||
#define JOURNAL_NAME "index.log"
|
const char kJournalName[] = "index.log";
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace net {
|
namespace net {
|
||||||
@ -1039,7 +1039,7 @@ CacheIndex::RemoveAll()
|
|||||||
} else {
|
} else {
|
||||||
// We don't have a handle to index file, so get the file here, but delete
|
// We don't have a handle to index file, so get the file here, but delete
|
||||||
// it outside the lock. Ignore the result since this is not fatal.
|
// it outside the lock. Ignore the result since this is not fatal.
|
||||||
index->GetFile(NS_LITERAL_CSTRING(INDEX_NAME), getter_AddRefs(file));
|
index->GetFile(NS_LITERAL_CSTRING(kIndexName), getter_AddRefs(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index->mJournalHandle) {
|
if (index->mJournalHandle) {
|
||||||
@ -1572,7 +1572,7 @@ CacheIndex::WriteIndexToDisk()
|
|||||||
mProcessEntries = mIndexStats.ActiveEntriesCount();
|
mProcessEntries = mIndexStats.ActiveEntriesCount();
|
||||||
|
|
||||||
mIndexFileOpener = new FileOpenHelper(this);
|
mIndexFileOpener = new FileOpenHelper(this);
|
||||||
rv = CacheFileIOManager::OpenFile(NS_LITERAL_CSTRING(TEMP_INDEX_NAME),
|
rv = CacheFileIOManager::OpenFile(NS_LITERAL_CSTRING(kTempIndexName),
|
||||||
CacheFileIOManager::SPECIAL_FILE |
|
CacheFileIOManager::SPECIAL_FILE |
|
||||||
CacheFileIOManager::CREATE,
|
CacheFileIOManager::CREATE,
|
||||||
mIndexFileOpener);
|
mIndexFileOpener);
|
||||||
@ -1823,9 +1823,9 @@ CacheIndex::RemoveIndexFromDisk()
|
|||||||
{
|
{
|
||||||
LOG(("CacheIndex::RemoveIndexFromDisk()"));
|
LOG(("CacheIndex::RemoveIndexFromDisk()"));
|
||||||
|
|
||||||
RemoveFile(NS_LITERAL_CSTRING(INDEX_NAME));
|
RemoveFile(NS_LITERAL_CSTRING(kIndexName));
|
||||||
RemoveFile(NS_LITERAL_CSTRING(TEMP_INDEX_NAME));
|
RemoveFile(NS_LITERAL_CSTRING(kTempIndexName));
|
||||||
RemoveFile(NS_LITERAL_CSTRING(JOURNAL_NAME));
|
RemoveFile(NS_LITERAL_CSTRING(kJournalName));
|
||||||
}
|
}
|
||||||
|
|
||||||
class WriteLogHelper
|
class WriteLogHelper
|
||||||
@ -1940,14 +1940,14 @@ CacheIndex::WriteLogToDisk()
|
|||||||
MOZ_ASSERT(mPendingUpdates.Count() == 0);
|
MOZ_ASSERT(mPendingUpdates.Count() == 0);
|
||||||
MOZ_ASSERT(mState == SHUTDOWN);
|
MOZ_ASSERT(mState == SHUTDOWN);
|
||||||
|
|
||||||
RemoveFile(NS_LITERAL_CSTRING(TEMP_INDEX_NAME));
|
RemoveFile(NS_LITERAL_CSTRING(kTempIndexName));
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> indexFile;
|
nsCOMPtr<nsIFile> indexFile;
|
||||||
rv = GetFile(NS_LITERAL_CSTRING(INDEX_NAME), getter_AddRefs(indexFile));
|
rv = GetFile(NS_LITERAL_CSTRING(kIndexName), getter_AddRefs(indexFile));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIFile> logFile;
|
nsCOMPtr<nsIFile> logFile;
|
||||||
rv = GetFile(NS_LITERAL_CSTRING(JOURNAL_NAME), getter_AddRefs(logFile));
|
rv = GetFile(NS_LITERAL_CSTRING(kJournalName), getter_AddRefs(logFile));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
mIndexStats.Log();
|
mIndexStats.Log();
|
||||||
@ -2017,36 +2017,36 @@ CacheIndex::ReadIndexFromDisk()
|
|||||||
ChangeState(READING);
|
ChangeState(READING);
|
||||||
|
|
||||||
mIndexFileOpener = new FileOpenHelper(this);
|
mIndexFileOpener = new FileOpenHelper(this);
|
||||||
rv = CacheFileIOManager::OpenFile(NS_LITERAL_CSTRING(INDEX_NAME),
|
rv = CacheFileIOManager::OpenFile(NS_LITERAL_CSTRING(kIndexName),
|
||||||
CacheFileIOManager::SPECIAL_FILE |
|
CacheFileIOManager::SPECIAL_FILE |
|
||||||
CacheFileIOManager::OPEN,
|
CacheFileIOManager::OPEN,
|
||||||
mIndexFileOpener);
|
mIndexFileOpener);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
LOG(("CacheIndex::ReadIndexFromDisk() - CacheFileIOManager::OpenFile() "
|
LOG(("CacheIndex::ReadIndexFromDisk() - CacheFileIOManager::OpenFile() "
|
||||||
"failed [rv=0x%08x, file=%s]", rv, INDEX_NAME));
|
"failed [rv=0x%08x, file=%s]", rv, kIndexName));
|
||||||
FinishRead(false);
|
FinishRead(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mJournalFileOpener = new FileOpenHelper(this);
|
mJournalFileOpener = new FileOpenHelper(this);
|
||||||
rv = CacheFileIOManager::OpenFile(NS_LITERAL_CSTRING(JOURNAL_NAME),
|
rv = CacheFileIOManager::OpenFile(NS_LITERAL_CSTRING(kJournalName),
|
||||||
CacheFileIOManager::SPECIAL_FILE |
|
CacheFileIOManager::SPECIAL_FILE |
|
||||||
CacheFileIOManager::OPEN,
|
CacheFileIOManager::OPEN,
|
||||||
mJournalFileOpener);
|
mJournalFileOpener);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
LOG(("CacheIndex::ReadIndexFromDisk() - CacheFileIOManager::OpenFile() "
|
LOG(("CacheIndex::ReadIndexFromDisk() - CacheFileIOManager::OpenFile() "
|
||||||
"failed [rv=0x%08x, file=%s]", rv, JOURNAL_NAME));
|
"failed [rv=0x%08x, file=%s]", rv, kJournalName));
|
||||||
FinishRead(false);
|
FinishRead(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mTmpFileOpener = new FileOpenHelper(this);
|
mTmpFileOpener = new FileOpenHelper(this);
|
||||||
rv = CacheFileIOManager::OpenFile(NS_LITERAL_CSTRING(TEMP_INDEX_NAME),
|
rv = CacheFileIOManager::OpenFile(NS_LITERAL_CSTRING(kTempIndexName),
|
||||||
CacheFileIOManager::SPECIAL_FILE |
|
CacheFileIOManager::SPECIAL_FILE |
|
||||||
CacheFileIOManager::OPEN,
|
CacheFileIOManager::OPEN,
|
||||||
mTmpFileOpener);
|
mTmpFileOpener);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
LOG(("CacheIndex::ReadIndexFromDisk() - CacheFileIOManager::OpenFile() "
|
LOG(("CacheIndex::ReadIndexFromDisk() - CacheFileIOManager::OpenFile() "
|
||||||
"failed [rv=0x%08x, file=%s]", rv, TEMP_INDEX_NAME));
|
"failed [rv=0x%08x, file=%s]", rv, kTempIndexName));
|
||||||
FinishRead(false);
|
FinishRead(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2425,8 +2425,8 @@ CacheIndex::FinishRead(bool aSucceeded)
|
|||||||
(aSucceeded && mIndexOnDiskIsValid && mJournalReadSuccessfully));
|
(aSucceeded && mIndexOnDiskIsValid && mJournalReadSuccessfully));
|
||||||
|
|
||||||
if (mState == SHUTDOWN) {
|
if (mState == SHUTDOWN) {
|
||||||
RemoveFile(NS_LITERAL_CSTRING(TEMP_INDEX_NAME));
|
RemoveFile(NS_LITERAL_CSTRING(kTempIndexName));
|
||||||
RemoveFile(NS_LITERAL_CSTRING(JOURNAL_NAME));
|
RemoveFile(NS_LITERAL_CSTRING(kJournalName));
|
||||||
} else {
|
} else {
|
||||||
if (mIndexHandle && !mIndexOnDiskIsValid) {
|
if (mIndexHandle && !mIndexOnDiskIsValid) {
|
||||||
CacheFileIOManager::DoomFile(mIndexHandle, nullptr);
|
CacheFileIOManager::DoomFile(mIndexHandle, nullptr);
|
||||||
@ -2571,7 +2571,7 @@ CacheIndex::SetupDirectoryEnumerator()
|
|||||||
rv = mCacheDirectory->Clone(getter_AddRefs(file));
|
rv = mCacheDirectory->Clone(getter_AddRefs(file));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = file->AppendNative(NS_LITERAL_CSTRING(ENTRIES_DIR));
|
rv = file->AppendNative(NS_LITERAL_CSTRING(kEntriesDir));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
bool exists;
|
bool exists;
|
||||||
@ -3367,7 +3367,7 @@ CacheIndex::OnFileOpenedInternal(FileOpenHelper *aOpener,
|
|||||||
if (mJournalHandle) { // this shouldn't normally happen
|
if (mJournalHandle) { // this shouldn't normally happen
|
||||||
LOG(("CacheIndex::OnFileOpenedInternal() - Unexpected state, all "
|
LOG(("CacheIndex::OnFileOpenedInternal() - Unexpected state, all "
|
||||||
"files [%s, %s, %s] should never exist. Removing whole index.",
|
"files [%s, %s, %s] should never exist. Removing whole index.",
|
||||||
INDEX_NAME, JOURNAL_NAME, TEMP_INDEX_NAME));
|
kIndexName, kJournalName, kTempIndexName));
|
||||||
FinishRead(false);
|
FinishRead(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3377,7 +3377,7 @@ CacheIndex::OnFileOpenedInternal(FileOpenHelper *aOpener,
|
|||||||
// Rename journal to make sure we update index on next start in case
|
// Rename journal to make sure we update index on next start in case
|
||||||
// firefox crashes
|
// firefox crashes
|
||||||
rv = CacheFileIOManager::RenameFile(
|
rv = CacheFileIOManager::RenameFile(
|
||||||
mJournalHandle, NS_LITERAL_CSTRING(TEMP_INDEX_NAME), this);
|
mJournalHandle, NS_LITERAL_CSTRING(kTempIndexName), this);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
LOG(("CacheIndex::OnFileOpenedInternal() - CacheFileIOManager::"
|
LOG(("CacheIndex::OnFileOpenedInternal() - CacheFileIOManager::"
|
||||||
"RenameFile() failed synchronously [rv=0x%08x]", rv));
|
"RenameFile() failed synchronously [rv=0x%08x]", rv));
|
||||||
@ -3435,7 +3435,7 @@ CacheIndex::OnDataWritten(CacheFileHandle *aHandle, const char *aBuf,
|
|||||||
} else {
|
} else {
|
||||||
if (mSkipEntries == mProcessEntries) {
|
if (mSkipEntries == mProcessEntries) {
|
||||||
rv = CacheFileIOManager::RenameFile(mIndexHandle,
|
rv = CacheFileIOManager::RenameFile(mIndexHandle,
|
||||||
NS_LITERAL_CSTRING(INDEX_NAME),
|
NS_LITERAL_CSTRING(kIndexName),
|
||||||
this);
|
this);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
LOG(("CacheIndex::OnDataWritten() - CacheFileIOManager::"
|
LOG(("CacheIndex::OnDataWritten() - CacheFileIOManager::"
|
||||||
|
@ -68,7 +68,7 @@ static nsCookieService *gCookieService;
|
|||||||
|
|
||||||
// XXX_hack. See bug 178993.
|
// XXX_hack. See bug 178993.
|
||||||
// This is a hack to hide HttpOnly cookies from older browsers
|
// This is a hack to hide HttpOnly cookies from older browsers
|
||||||
#define HTTP_ONLY_PREFIX "#HttpOnly_"
|
static const char kHttpOnlyPrefix[] = "#HttpOnly_";
|
||||||
|
|
||||||
#define COOKIES_FILE "cookies.sqlite"
|
#define COOKIES_FILE "cookies.sqlite"
|
||||||
#define COOKIES_SCHEMA_VERSION 5
|
#define COOKIES_SCHEMA_VERSION 5
|
||||||
@ -92,7 +92,7 @@ static const int64_t kCookieStaleThreshold = 60 * PR_USEC_PER_SEC; // 1 minute i
|
|||||||
static const int64_t kCookiePurgeAge =
|
static const int64_t kCookiePurgeAge =
|
||||||
int64_t(30 * 24 * 60 * 60) * PR_USEC_PER_SEC; // 30 days in microseconds
|
int64_t(30 * 24 * 60 * 60) * PR_USEC_PER_SEC; // 30 days in microseconds
|
||||||
|
|
||||||
#define OLD_COOKIE_FILE_NAME "cookies.txt"
|
static const char kOldCookieFileName[] = "cookies.txt";
|
||||||
|
|
||||||
#undef LIMIT
|
#undef LIMIT
|
||||||
#define LIMIT(x, low, high, default) ((x) >= (low) && (x) <= (high) ? (x) : (default))
|
#define LIMIT(x, low, high, default) ((x) >= (low) && (x) <= (high) ? (x) : (default))
|
||||||
@ -1237,7 +1237,7 @@ nsCookieService::TryInitDB(bool aRecreateDB)
|
|||||||
// private browsing mode; otherwise ImportCookies() won't be happy.
|
// private browsing mode; otherwise ImportCookies() won't be happy.
|
||||||
DBState* initialState = mDBState;
|
DBState* initialState = mDBState;
|
||||||
mDBState = mDefaultDBState;
|
mDBState = mDefaultDBState;
|
||||||
oldCookieFile->AppendNative(NS_LITERAL_CSTRING(OLD_COOKIE_FILE_NAME));
|
oldCookieFile->AppendNative(NS_LITERAL_CSTRING(kOldCookieFileName));
|
||||||
ImportCookies(oldCookieFile);
|
ImportCookies(oldCookieFile);
|
||||||
oldCookieFile->Remove(false);
|
oldCookieFile->Remove(false);
|
||||||
mDBState = initialState;
|
mDBState = initialState;
|
||||||
@ -2501,9 +2501,9 @@ nsCookieService::ImportCookies(nsIFile *aCookieFile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (isMore && NS_SUCCEEDED(lineInputStream->ReadLine(buffer, &isMore))) {
|
while (isMore && NS_SUCCEEDED(lineInputStream->ReadLine(buffer, &isMore))) {
|
||||||
if (StringBeginsWith(buffer, NS_LITERAL_CSTRING(HTTP_ONLY_PREFIX))) {
|
if (StringBeginsWith(buffer, NS_LITERAL_CSTRING(kHttpOnlyPrefix))) {
|
||||||
isHttpOnly = true;
|
isHttpOnly = true;
|
||||||
hostIndex = sizeof(HTTP_ONLY_PREFIX) - 1;
|
hostIndex = sizeof(kHttpOnlyPrefix) - 1;
|
||||||
} else if (buffer.IsEmpty() || buffer.First() == '#') {
|
} else if (buffer.IsEmpty() || buffer.First() == '#') {
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
@ -611,12 +611,6 @@ RemoteOpenFileChild::RenameTo(nsIFile *newParentDir, const nsAString &newName)
|
|||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
RemoteOpenFileChild::RenameToNative(nsIFile *newParentDir, const nsACString &newName)
|
|
||||||
{
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
RemoteOpenFileChild::Remove(bool recursive)
|
RemoteOpenFileChild::Remove(bool recursive)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
{
|
{
|
||||||
static_assert(LEN <= 15,
|
static_assert(LEN <= 15,
|
||||||
"Thread name must be no more than 15 characters");
|
"Thread name must be no more than 15 characters");
|
||||||
return Dispatch(nsDependentCString(taskThreadName, LEN - 1));
|
return Dispatch(NS_LITERAL_CSTRING(taskThreadName));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult Dispatch(const nsACString& taskThreadName);
|
nsresult Dispatch(const nsACString& taskThreadName);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::psm;
|
using namespace mozilla::psm;
|
||||||
|
|
||||||
#define CERT_OVERRIDE_FILE_NAME "cert_override.txt"
|
static const char kCertOverrideFileName[] = "cert_override.txt";
|
||||||
|
|
||||||
void
|
void
|
||||||
nsCertOverride::convertBitsToString(OverrideBits ob, nsACString &str)
|
nsCertOverride::convertBitsToString(OverrideBits ob, nsACString &str)
|
||||||
@ -144,7 +144,7 @@ nsCertOverrideService::Observe(nsISupports *,
|
|||||||
|
|
||||||
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mSettingsFile));
|
nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mSettingsFile));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
mSettingsFile->AppendNative(NS_LITERAL_CSTRING(CERT_OVERRIDE_FILE_NAME));
|
mSettingsFile->AppendNative(NS_LITERAL_CSTRING(kCertOverrideFileName));
|
||||||
} else {
|
} else {
|
||||||
mSettingsFile = nullptr;
|
mSettingsFile = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ StartupCache::CollectReports(nsIHandleReportCallback* aHandleReport,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define STARTUP_CACHE_NAME "startupCache." SC_WORDSIZE "." SC_ENDIAN
|
static const char sStartupCacheName[] = "startupCache." SC_WORDSIZE "." SC_ENDIAN;
|
||||||
|
|
||||||
StartupCache*
|
StartupCache*
|
||||||
StartupCache::GetSingleton()
|
StartupCache::GetSingleton()
|
||||||
@ -196,7 +196,7 @@ StartupCache::Init()
|
|||||||
if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS)
|
if (NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
rv = file->AppendNative(NS_LITERAL_CSTRING(STARTUP_CACHE_NAME));
|
rv = file->AppendNative(NS_LITERAL_CSTRING(sStartupCacheName));
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
#define PLACES_WARN_DEPRECATED() \
|
#define PLACES_WARN_DEPRECATED() \
|
||||||
PR_BEGIN_MACRO \
|
PR_BEGIN_MACRO \
|
||||||
nsCString msg(__FUNCTION__); \
|
nsCString msg = NS_LITERAL_CSTRING(__FUNCTION__); \
|
||||||
msg.AppendLiteral(" is deprecated and will be removed in the next version.");\
|
msg.AppendLiteral(" is deprecated and will be removed in the next version.");\
|
||||||
NS_WARNING(msg.get()); \
|
NS_WARNING(msg.get()); \
|
||||||
nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);\
|
nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);\
|
||||||
|
@ -84,8 +84,10 @@ using base::Histogram;
|
|||||||
using base::LinearHistogram;
|
using base::LinearHistogram;
|
||||||
using base::StatisticsRecorder;
|
using base::StatisticsRecorder;
|
||||||
|
|
||||||
#define KEYED_HISTOGRAM_NAME_SEPARATOR "#"
|
const char KEYED_HISTOGRAM_NAME_SEPARATOR[] = "#";
|
||||||
#define SUBSESSION_HISTOGRAM_PREFIX "sub#"
|
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
|
||||||
|
const char SUBSESSION_HISTOGRAM_PREFIX[] = "sub#";
|
||||||
|
#endif
|
||||||
|
|
||||||
enum reflectStatus {
|
enum reflectStatus {
|
||||||
REFLECT_OK,
|
REFLECT_OK,
|
||||||
@ -869,7 +871,7 @@ IsExpired(const Histogram *histogram){
|
|||||||
bool
|
bool
|
||||||
IsValidHistogramName(const nsACString& name)
|
IsValidHistogramName(const nsACString& name)
|
||||||
{
|
{
|
||||||
return !FindInReadable(NS_LITERAL_CSTRING(KEYED_HISTOGRAM_NAME_SEPARATOR), name);
|
return !FindInReadable(nsCString(KEYED_HISTOGRAM_NAME_SEPARATOR), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -4146,11 +4148,11 @@ KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram,
|
|||||||
nsCString histogramName;
|
nsCString histogramName;
|
||||||
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
|
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
|
||||||
if (subsession) {
|
if (subsession) {
|
||||||
histogramName.AppendLiteral(SUBSESSION_HISTOGRAM_PREFIX);
|
histogramName.Append(SUBSESSION_HISTOGRAM_PREFIX);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
histogramName.Append(mName);
|
histogramName.Append(mName);
|
||||||
histogramName.AppendLiteral(KEYED_HISTOGRAM_NAME_SEPARATOR);
|
histogramName.Append(KEYED_HISTOGRAM_NAME_SEPARATOR);
|
||||||
histogramName.Append(key);
|
histogramName.Append(key);
|
||||||
|
|
||||||
Histogram* h;
|
Histogram* h;
|
||||||
|
@ -82,16 +82,16 @@ GetUpdateLog()
|
|||||||
#define LOG(args) PR_LOG(GetUpdateLog(), PR_LOG_DEBUG, args)
|
#define LOG(args) PR_LOG(GetUpdateLog(), PR_LOG_DEBUG, args)
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
#define UPDATER_BIN "updater.exe"
|
static const char kUpdaterBin[] = "updater.exe";
|
||||||
#else
|
#else
|
||||||
#define UPDATER_BIN "updater"
|
static const char kUpdaterBin[] = "updater";
|
||||||
#endif
|
#endif
|
||||||
#define UPDATER_INI "updater.ini"
|
static const char kUpdaterINI[] = "updater.ini";
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
#define UPDATER_APP "updater.app"
|
static const char kUpdaterApp[] = "updater.app";
|
||||||
#endif
|
#endif
|
||||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||||
#define UPDATER_PNG "updater.png"
|
static const char kUpdaterPNG[] = "updater.png";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MOZ_WIDGET_GONK)
|
#if defined(MOZ_WIDGET_GONK)
|
||||||
@ -330,8 +330,9 @@ IsOlderVersion(nsIFile *versionFile, const char *appVersion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
CopyFileIntoUpdateDir(nsIFile *parentDir, const nsACString& leaf, nsIFile *updateDir)
|
CopyFileIntoUpdateDir(nsIFile *parentDir, const char *leafName, nsIFile *updateDir)
|
||||||
{
|
{
|
||||||
|
nsDependentCString leaf(leafName);
|
||||||
nsCOMPtr<nsIFile> file;
|
nsCOMPtr<nsIFile> file;
|
||||||
|
|
||||||
// Make sure there is not an existing file in the target location.
|
// Make sure there is not an existing file in the target location.
|
||||||
@ -363,19 +364,19 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
|
|||||||
{
|
{
|
||||||
// Copy the updater application from the GRE and the updater ini from the app
|
// Copy the updater application from the GRE and the updater ini from the app
|
||||||
#if defined(XP_MACOSX)
|
#if defined(XP_MACOSX)
|
||||||
if (!CopyFileIntoUpdateDir(appDir, NS_LITERAL_CSTRING(UPDATER_APP), updateDir))
|
if (!CopyFileIntoUpdateDir(appDir, kUpdaterApp, updateDir))
|
||||||
return false;
|
return false;
|
||||||
CopyFileIntoUpdateDir(greDir, NS_LITERAL_CSTRING(UPDATER_INI), updateDir);
|
CopyFileIntoUpdateDir(greDir, kUpdaterINI, updateDir);
|
||||||
#else
|
#else
|
||||||
if (!CopyFileIntoUpdateDir(greDir, NS_LITERAL_CSTRING(UPDATER_BIN), updateDir))
|
if (!CopyFileIntoUpdateDir(greDir, kUpdaterBin, updateDir))
|
||||||
return false;
|
return false;
|
||||||
CopyFileIntoUpdateDir(appDir, NS_LITERAL_CSTRING(UPDATER_INI), updateDir);
|
CopyFileIntoUpdateDir(appDir, kUpdaterINI, updateDir);
|
||||||
#endif
|
#endif
|
||||||
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(ANDROID)
|
#if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(ANDROID)
|
||||||
nsCOMPtr<nsIFile> iconDir;
|
nsCOMPtr<nsIFile> iconDir;
|
||||||
appDir->Clone(getter_AddRefs(iconDir));
|
appDir->Clone(getter_AddRefs(iconDir));
|
||||||
iconDir->AppendNative(NS_LITERAL_CSTRING("icons"));
|
iconDir->AppendNative(NS_LITERAL_CSTRING("icons"));
|
||||||
if (!CopyFileIntoUpdateDir(iconDir, NS_LITERAL_CSTRING(UPDATER_PNG), updateDir))
|
if (!CopyFileIntoUpdateDir(iconDir, kUpdaterPNG, updateDir))
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
// Finally, return the location of the updater binary.
|
// Finally, return the location of the updater binary.
|
||||||
@ -383,7 +384,7 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
|
|||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return false;
|
return false;
|
||||||
#if defined(XP_MACOSX)
|
#if defined(XP_MACOSX)
|
||||||
rv = updater->AppendNative(NS_LITERAL_CSTRING(UPDATER_APP));
|
rv = updater->AppendNative(NS_LITERAL_CSTRING(kUpdaterApp));
|
||||||
nsresult tmp = updater->AppendNative(NS_LITERAL_CSTRING("Contents"));
|
nsresult tmp = updater->AppendNative(NS_LITERAL_CSTRING("Contents"));
|
||||||
if (NS_FAILED(tmp)) {
|
if (NS_FAILED(tmp)) {
|
||||||
rv = tmp;
|
rv = tmp;
|
||||||
@ -392,7 +393,7 @@ CopyUpdaterIntoUpdateDir(nsIFile *greDir, nsIFile *appDir, nsIFile *updateDir,
|
|||||||
if (NS_FAILED(tmp) || NS_FAILED(rv))
|
if (NS_FAILED(tmp) || NS_FAILED(rv))
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
rv = updater->AppendNative(NS_LITERAL_CSTRING(UPDATER_BIN));
|
rv = updater->AppendNative(NS_LITERAL_CSTRING(kUpdaterBin));
|
||||||
return NS_SUCCEEDED(rv);
|
return NS_SUCCEEDED(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -500,7 +501,8 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIFile *updateDir,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = updater->AppendNative(NS_LITERAL_CSTRING(UPDATER_BIN));
|
nsDependentCString leaf(kUpdaterBin);
|
||||||
|
rv = updater->AppendNative(leaf);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -768,7 +770,8 @@ ApplyUpdate(nsIFile *greDir, nsIFile *updateDir, nsIFile *statusFile,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = updater->AppendNative(NS_LITERAL_CSTRING(UPDATER_BIN));
|
nsDependentCString leaf(kUpdaterBin);
|
||||||
|
rv = updater->AppendNative(leaf);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ interface nsISimpleEnumerator;
|
|||||||
* be safely passed to javascript via xpconnect. Therefore, the "native
|
* be safely passed to javascript via xpconnect. Therefore, the "native
|
||||||
* methods" are not scriptable.
|
* methods" are not scriptable.
|
||||||
*/
|
*/
|
||||||
[scriptable, main_process_scriptable_only, uuid(890b802d-3522-4887-a892-3dab31df30d9), builtinclass]
|
[scriptable, main_process_scriptable_only, uuid(7441fb13-4d9f-42fd-836f-a165692938af), builtinclass]
|
||||||
interface nsIFile : nsISupports
|
interface nsIFile : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -189,7 +189,6 @@ interface nsIFile : nsISupports
|
|||||||
* This object will still point to the old location after renaming.
|
* This object will still point to the old location after renaming.
|
||||||
*/
|
*/
|
||||||
void renameTo(in nsIFile newParentDir, in AString newName);
|
void renameTo(in nsIFile newParentDir, in AString newName);
|
||||||
[noscript] void renameToNative(in nsIFile newParentDir, in ACString newName);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will try to delete this file. The 'recursive' flag
|
* This will try to delete this file. The 'recursive' flag
|
||||||
|
@ -2153,12 +2153,6 @@ nsLocalFile::MoveTo(nsIFile* aNewParentDir, const nsAString& aNewName)
|
|||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsLocalFile::RenameTo(nsIFile* aNewParentDir, const nsAString& aNewName)
|
nsLocalFile::RenameTo(nsIFile* aNewParentDir, const nsAString& aNewName)
|
||||||
{
|
|
||||||
SET_UCS_2ARGS_2(RenameToNative, aNewParentDir, aNewName);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsLocalFile::RenameToNative(nsIFile* aNewParentDir, const nsACString& aNewName)
|
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
@ -2167,7 +2161,12 @@ nsLocalFile::RenameToNative(nsIFile* aNewParentDir, const nsACString& aNewName)
|
|||||||
|
|
||||||
// check to make sure that we have a new parent
|
// check to make sure that we have a new parent
|
||||||
nsAutoCString newPathName;
|
nsAutoCString newPathName;
|
||||||
rv = GetNativeTargetPathName(aNewParentDir, aNewName, newPathName);
|
nsAutoCString newNativeName;
|
||||||
|
rv = NS_CopyUnicodeToNative(aNewName, newNativeName);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
rv = GetNativeTargetPathName(aNewParentDir, newNativeName, newPathName);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -2268,18 +2268,6 @@ nsLocalFile::RenameTo(nsIFile* aNewParentDir, const nsAString& aNewName)
|
|||||||
return CopySingleFile(this, targetParentDir, aNewName, options);
|
return CopySingleFile(this, targetParentDir, aNewName, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsLocalFile::RenameToNative(nsIFile* aNewParentDir, const nsACString& aNewName)
|
|
||||||
{
|
|
||||||
nsAutoString tmp;
|
|
||||||
nsresult rv = NS_CopyNativeToUnicode(aNewName, tmp);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
return RenameTo(aNewParentDir, tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsLocalFile::Load(PRLibrary** aResult)
|
nsLocalFile::Load(PRLibrary** aResult)
|
||||||
{
|
{
|
||||||
|
@ -30,8 +30,8 @@
|
|||||||
#define NS_LITERAL_STRING_INIT(n,s) n(MOZ_UTF16(s))
|
#define NS_LITERAL_STRING_INIT(n,s) n(MOZ_UTF16(s))
|
||||||
#define NS_NAMED_LITERAL_STRING(n,s) const nsLiteralString n(MOZ_UTF16(s))
|
#define NS_NAMED_LITERAL_STRING(n,s) const nsLiteralString n(MOZ_UTF16(s))
|
||||||
|
|
||||||
#define NS_LITERAL_CSTRING(s) static_cast<const nsLiteralCString&>(nsLiteralCString("" s))
|
#define NS_LITERAL_CSTRING(s) static_cast<const nsLiteralCString&>(nsLiteralCString(s))
|
||||||
#define NS_LITERAL_CSTRING_INIT(n,s) n("" s)
|
#define NS_LITERAL_CSTRING_INIT(n,s) n(s)
|
||||||
#define NS_NAMED_LITERAL_CSTRING(n,s) const nsLiteralCString n("" s)
|
#define NS_NAMED_LITERAL_CSTRING(n,s) const nsLiteralCString n(s)
|
||||||
|
|
||||||
#endif /* !defined(nsLiteralString_h___) */
|
#endif /* !defined(nsLiteralString_h___) */
|
||||||
|
@ -29,9 +29,10 @@ nsIRDFService* nsWindowDataSource::gRDFService = nullptr;
|
|||||||
|
|
||||||
uint32_t nsWindowDataSource::gRefCnt = 0;
|
uint32_t nsWindowDataSource::gRefCnt = 0;
|
||||||
|
|
||||||
#define URINC_WINDOWROOT "NC:WindowMediatorRoot"
|
static const char kURINC_WindowRoot[] = "NC:WindowMediatorRoot";
|
||||||
#define URINC_NAME NC_NAMESPACE_URI "Name"
|
|
||||||
#define URINC_KEYINDEX NC_NAMESPACE_URI "KeyIndex"
|
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, Name);
|
||||||
|
DEFINE_RDF_VOCAB(NC_NAMESPACE_URI, NC, KeyIndex);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsWindowDataSource::Init()
|
nsWindowDataSource::Init()
|
||||||
@ -42,9 +43,9 @@ nsWindowDataSource::Init()
|
|||||||
rv = CallGetService("@mozilla.org/rdf/rdf-service;1", &gRDFService);
|
rv = CallGetService("@mozilla.org/rdf/rdf-service;1", &gRDFService);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
gRDFService->GetResource(NS_LITERAL_CSTRING(URINC_WINDOWROOT), &kNC_WindowRoot);
|
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_WindowRoot), &kNC_WindowRoot);
|
||||||
gRDFService->GetResource(NS_LITERAL_CSTRING(URINC_NAME), &kNC_Name);
|
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_Name), &kNC_Name);
|
||||||
gRDFService->GetResource(NS_LITERAL_CSTRING(URINC_KEYINDEX), &kNC_KeyIndex);
|
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_KeyIndex), &kNC_KeyIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
mInner = do_CreateInstance("@mozilla.org/rdf/datasource;1?name=in-memory-datasource", &rv);
|
mInner = do_CreateInstance("@mozilla.org/rdf/datasource;1?name=in-memory-datasource", &rv);
|
||||||
|
Loading…
Reference in New Issue
Block a user