mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1029209 - Additional patch to fix a rooting hazard; r=bent
This commit is contained in:
parent
4c05eee5c1
commit
26636e0611
@ -780,10 +780,11 @@ ResolveMysteryBlob(nsIDOMBlob* aBlob, const nsString& aContentType,
|
|||||||
class MainThreadDeserializationTraits
|
class MainThreadDeserializationTraits
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static JSObject* CreateAndWrapMutableFile(JSContext* aCx,
|
static bool CreateAndWrapMutableFile(JSContext* aCx,
|
||||||
IDBDatabase* aDatabase,
|
IDBDatabase* aDatabase,
|
||||||
StructuredCloneFile& aFile,
|
StructuredCloneFile& aFile,
|
||||||
const MutableFileData& aData)
|
const MutableFileData& aData,
|
||||||
|
JS::MutableHandle<JSObject*> aResult)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
@ -792,7 +793,13 @@ public:
|
|||||||
nsRefPtr<IDBMutableFile> mutableFile = IDBMutableFile::Create(aData.name,
|
nsRefPtr<IDBMutableFile> mutableFile = IDBMutableFile::Create(aData.name,
|
||||||
aData.type, aDatabase, fileInfo.forget());
|
aData.type, aDatabase, fileInfo.forget());
|
||||||
|
|
||||||
return mutableFile->WrapObject(aCx);
|
JS::Rooted<JSObject*> result(aCx, mutableFile->WrapObject(aCx));
|
||||||
|
if (NS_WARN_IF(!result)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
aResult.set(result);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSObject* CreateAndWrapBlobOrFile(JSContext* aCx,
|
static JSObject* CreateAndWrapBlobOrFile(JSContext* aCx,
|
||||||
@ -882,13 +889,22 @@ public:
|
|||||||
class CreateIndexDeserializationTraits
|
class CreateIndexDeserializationTraits
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static JSObject* CreateAndWrapMutableFile(JSContext* aCx,
|
static bool CreateAndWrapMutableFile(JSContext* aCx,
|
||||||
IDBDatabase* aDatabase,
|
IDBDatabase* aDatabase,
|
||||||
StructuredCloneFile& aFile,
|
StructuredCloneFile& aFile,
|
||||||
const MutableFileData& aData)
|
const MutableFileData& aData,
|
||||||
|
JS::MutableHandle<JSObject*> aResult)
|
||||||
{
|
{
|
||||||
// MutableFile can't be used in index creation, so just make a dummy object.
|
// MutableFile can't be used in index creation, so just make a dummy object.
|
||||||
return JS_NewObject(aCx, nullptr, JS::NullPtr(), JS::NullPtr());
|
JS::Rooted<JSObject*> obj(aCx,
|
||||||
|
JS_NewObject(aCx, nullptr, JS::NullPtr(), JS::NullPtr()));
|
||||||
|
|
||||||
|
if (NS_WARN_IF(!obj)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
aResult.set(obj);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static JSObject* CreateAndWrapBlobOrFile(JSContext* aCx,
|
static JSObject* CreateAndWrapBlobOrFile(JSContext* aCx,
|
||||||
@ -1489,7 +1505,7 @@ IDBObjectStore::ReadBlobOrFile(JSStructuredCloneReader* aReader,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
template <class DeserializationTraits>
|
template <class Traits>
|
||||||
JSObject*
|
JSObject*
|
||||||
IDBObjectStore::StructuredCloneReadCallback(JSContext* aCx,
|
IDBObjectStore::StructuredCloneReadCallback(JSContext* aCx,
|
||||||
JSStructuredCloneReader* aReader,
|
JSStructuredCloneReader* aReader,
|
||||||
@ -1527,8 +1543,16 @@ IDBObjectStore::StructuredCloneReadCallback(JSContext* aCx,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DeserializationTraits::CreateAndWrapMutableFile(aCx, database,
|
JS::Rooted<JSObject*> result(aCx);
|
||||||
file, data);
|
if (NS_WARN_IF(!Traits::CreateAndWrapMutableFile(aCx,
|
||||||
|
database,
|
||||||
|
file,
|
||||||
|
data,
|
||||||
|
&result))) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlobOrFileData data;
|
BlobOrFileData data;
|
||||||
@ -1536,8 +1560,7 @@ IDBObjectStore::StructuredCloneReadCallback(JSContext* aCx,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DeserializationTraits::CreateAndWrapBlobOrFile(aCx, database,
|
return Traits::CreateAndWrapBlobOrFile(aCx, database, file, data);
|
||||||
file, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const JSStructuredCloneCallbacks* runtimeCallbacks =
|
const JSStructuredCloneCallbacks* runtimeCallbacks =
|
||||||
|
Loading…
Reference in New Issue
Block a user