Bug 1358113 - Use IPCBlob in File.createFromNsIFile/createFromFileName, r=smaug

This commit is contained in:
Andrea Marchesini 2017-04-24 12:16:50 +02:00
Родитель 4ee48ef4d0
Коммит acd0e47b6d
3 изменённых файлов: 13 добавлений и 11 удалений

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

@ -3305,11 +3305,8 @@ ContentChild::RecvFileCreationResponse(const nsID& aUUID,
} else {
MOZ_ASSERT(aResult.type() == FileCreationResult::TFileCreationSuccessResult);
PBlobChild* blobChild =
aResult.get_FileCreationSuccessResult().blobChild();
MOZ_ASSERT(blobChild);
RefPtr<BlobImpl> impl = static_cast<BlobChild*>(blobChild)->GetBlobImpl();
RefPtr<BlobImpl> impl =
IPCBlobUtils::Deserialize(aResult.get_FileCreationSuccessResult().blob());
helper->ResponseReceived(impl, NS_OK);
}

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

@ -46,6 +46,7 @@
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileCreatorHelper.h"
#include "mozilla/dom/FileSystemSecurity.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/ExternalHelperAppParent.h"
#include "mozilla/dom/GetFilesHelper.h"
#include "mozilla/dom/GeolocationBinding.h"
@ -5317,13 +5318,17 @@ ContentParent::RecvFileCreationRequest(const nsID& aID,
MOZ_ASSERT(blobImpl);
BlobParent* blobParent = BlobParent::GetOrCreate(this, blobImpl);
if (NS_WARN_IF(!blobParent)) {
return IPC_FAIL_NO_REASON(this);
IPCBlob ipcBlob;
rv = IPCBlobUtils::Serialize(blobImpl, this, ipcBlob);
if (NS_WARN_IF(NS_FAILED(rv))) {
if (!SendFileCreationResponse(aID, FileCreationErrorResult(rv))) {
return IPC_FAIL_NO_REASON(this);
}
return IPC_OK();
}
if (!SendFileCreationResponse(aID,
FileCreationSuccessResult(blobParent, nullptr))) {
if (!SendFileCreationResponse(aID, FileCreationSuccessResult(ipcBlob))) {
return IPC_FAIL_NO_REASON(this);
}

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

@ -212,7 +212,7 @@ union GetFilesResponseResult
struct FileCreationSuccessResult
{
PBlob blob;
IPCBlob blob;
};
struct FileCreationErrorResult