Bug 1199265 - Correct actor for Blob in StructuredCloneHelper, r=khuey

This commit is contained in:
Andrea Marchesini 2015-08-29 00:19:56 +01:00
parent f2b5e5a8ff
commit 24ef8804fa
2 changed files with 10 additions and 10 deletions

View File

@ -277,6 +277,7 @@ StructuredCloneHelper::Read(nsISupports* aParent,
// If we are tranferring something, we cannot call 'Read()' more than once.
if (mSupportsTransferring) {
mBlobImplArray.Clear();
mClonedImages.Clear();
Shutdown();
}
}
@ -433,7 +434,7 @@ ReadBlob(JSContext* aCx,
{
MOZ_ASSERT(aHelper);
MOZ_ASSERT(aIndex < aHelper->BlobImpls().Length());
nsRefPtr<BlobImpl> blobImpl = aHelper->BlobImpls()[aIndex];
nsRefPtr<BlobImpl> blobImpl = aHelper->BlobImpls()[aIndex];
blobImpl = EnsureBlobForBackgroundManager(blobImpl);
MOZ_ASSERT(blobImpl);
@ -507,6 +508,9 @@ ReadFileList(JSContext* aCx,
nsRefPtr<BlobImpl> blobImpl = aHelper->BlobImpls()[index];
MOZ_ASSERT(blobImpl->IsFile());
blobImpl = EnsureBlobForBackgroundManager(blobImpl);
MOZ_ASSERT(blobImpl);
nsRefPtr<File> file = File::Create(aHelper->ParentDuringRead(), blobImpl);
if (!fileList->Append(file)) {
return nullptr;
@ -544,7 +548,11 @@ WriteFileList(JSStructuredCloneWriter* aWriter,
}
for (uint32_t i = 0; i < aFileList->Length(); ++i) {
aHelper->BlobImpls().AppendElement(aFileList->Item(i)->Impl());
nsRefPtr<BlobImpl> blobImpl =
EnsureBlobForBackgroundManager(aFileList->Item(i)->Impl());
MOZ_ASSERT(blobImpl);
aHelper->BlobImpls().AppendElement(blobImpl);
}
return true;

View File

@ -88,14 +88,6 @@ BroadcastChannelParent::CheckAndDeliver(const ClonedMessageData& aData,
if (aOrigin == mOrigin &&
aChannel == mChannel &&
aPrivateBrowsing == mPrivateBrowsing) {
// We need to duplicate data only if we have blobs or if the manager of
// them is different than the manager of this parent actor.
if (aData.blobsParent().IsEmpty() ||
static_cast<BlobParent*>(aData.blobsParent()[0])->GetBackgroundManager() == Manager()) {
unused << SendNotify(aData);
return;
}
// Duplicate the data for this parent.
ClonedMessageData newData(aData);