Bug 1309527 - Fix the race condition to prevent the access of metadata in both PBackground thread and the Connection thread. r=janv

This commit is contained in:
Bevis Tseng 2016-10-26 19:14:12 +08:00
Родитель e8f0bc4a89
Коммит 3af6bacb93
6 изменённых файлов: 34 добавлений и 55 удалений

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

@ -7915,16 +7915,18 @@ class RenameObjectStoreOp final
{
friend class VersionChangeTransaction;
const RefPtr<FullObjectStoreMetadata> mMetadata;
const int64_t mId;
const nsString mNewName;
private:
// Only created by VersionChangeTransaction.
RenameObjectStoreOp(VersionChangeTransaction* aTransaction,
FullObjectStoreMetadata* const aMetadata)
: VersionChangeTransactionOp(aTransaction)
, mMetadata(aMetadata)
, mId(aMetadata->mCommonMetadata.id())
, mNewName(aMetadata->mCommonMetadata.name())
{
MOZ_ASSERT(aMetadata->mCommonMetadata.id());
MOZ_ASSERT(mId);
}
~RenameObjectStoreOp()
@ -8109,8 +8111,9 @@ class RenameIndexOp final
{
friend class VersionChangeTransaction;
const RefPtr<FullIndexMetadata> mMetadata;
const int64_t mObjectStoreId;
const int64_t mIndexId;
const nsString mNewName;
private:
// Only created by VersionChangeTransaction.
@ -8118,10 +8121,11 @@ private:
FullIndexMetadata* const aMetadata,
int64_t aObjectStoreId)
: VersionChangeTransactionOp(aTransaction)
, mMetadata(aMetadata)
, mObjectStoreId(aObjectStoreId)
, mIndexId(aMetadata->mCommonMetadata.id())
, mNewName(aMetadata->mCommonMetadata.name())
{
MOZ_ASSERT(aMetadata->mCommonMetadata.id());
MOZ_ASSERT(mIndexId);
}
~RenameIndexOp()
@ -24396,12 +24400,10 @@ RenameObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
&stmt));
MOZ_ALWAYS_SUCCEEDS(
stmt->BindStringByName(NS_LITERAL_CSTRING("name"),
mMetadata->mCommonMetadata.name()));
stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mNewName));
MOZ_ALWAYS_SUCCEEDS(
stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"),
mMetadata->mCommonMetadata.id()));
stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), mId));
bool hasResult;
MOZ_ALWAYS_SUCCEEDS(stmt->ExecuteStep(&hasResult));
@ -24425,15 +24427,13 @@ RenameObjectStoreOp::DoDatabaseWork(DatabaseConnection* aConnection)
return rv;
}
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"),
mMetadata->mCommonMetadata.name());
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mNewName);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"),
mMetadata->mCommonMetadata.id());
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), mId);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@ -25506,12 +25506,10 @@ RenameIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
mObjectStoreId));
MOZ_ALWAYS_SUCCEEDS(
stmt->BindStringByName(NS_LITERAL_CSTRING("name"),
mMetadata->mCommonMetadata.name()));
stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mNewName));
MOZ_ALWAYS_SUCCEEDS(
stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"),
mMetadata->mCommonMetadata.id()));
stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), mIndexId));
bool hasResult;
MOZ_ALWAYS_SUCCEEDS(stmt->ExecuteStep(&hasResult));
@ -25537,15 +25535,13 @@ RenameIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
return rv;
}
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"),
mMetadata->mCommonMetadata.name());
rv = stmt->BindStringByName(NS_LITERAL_CSTRING("name"), mNewName);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"),
mMetadata->mCommonMetadata.id());
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("id"), mIndexId);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;

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

@ -1,11 +0,0 @@
[idbindex-rename.html]
type: testharness
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1309527
expected:
if debug and not e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): CRASH
if debug and not e10s and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH
if debug and not e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH
if debug and e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH
if debug and e10s and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH
if debug and not e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH
if debug and e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH

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

@ -1,22 +0,0 @@
[idbobjectstore-rename-store.html]
type: testharness
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1309527
expected:
if debug and not e10s and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH
if debug and not e10s and (os == "win") and (version == "6.1.7601") and (processor == "x86") and (bits == 32): CRASH
if debug and e10s and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): CRASH
if debug and e10s and (os == "mac") and (version == "OS X 10.10.5") and (processor == "x86_64") and (bits == 64): CRASH
if not debug and e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): TIMEOUT
if debug and e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH
if debug and e10s and (os == "win") and (version == "5.1.2600") and (processor == "x86") and (bits == 32): CRASH
if not debug and not e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): TIMEOUT
if debug and not e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): CRASH
[IndexedDB object store can be renamed to "\\u0000"]
expected:
if not debug and not e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): TIMEOUT
[IndexedDB object store can be renamed to "\\uDC00\\uD800"]
expected:
if not debug and e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and not e10s and (os == "win") and (version == "6.2.9200") and (processor == "x86_64") and (bits == 64): NOTRUN

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

@ -38463,6 +38463,20 @@
]
},
"testharness": {
"IndexedDB/idbindex-rename.html": [
{
"path": "IndexedDB/idbindex-rename.html",
"timeout": "long",
"url": "/IndexedDB/idbindex-rename.html"
}
],
"IndexedDB/idbobjectstore-rename-store.html": [
{
"path": "IndexedDB/idbobjectstore-rename-store.html",
"timeout": "long",
"url": "/IndexedDB/idbobjectstore-rename-store.html"
}
],
"WebCryptoAPI/generateKey/failures_AES-CBC.worker.js": [
{
"path": "WebCryptoAPI/generateKey/failures_AES-CBC.worker.js",

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

@ -1,4 +1,5 @@
<!DOCTYPE html>
<meta name="timeout" content="long">
<title>IndexedDB: index renaming support</title>
<link rel="help"
href="https://w3c.github.io/IndexedDB/#dom-idbindex-name">

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

@ -1,4 +1,5 @@
<!DOCTYPE html>
<meta name="timeout" content="long">
<title>IndexedDB: object store renaming support</title>
<link rel="help"
href="https://w3c.github.io/IndexedDB/#dom-idbobjectstore-name">