mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1140714 - Pass through remote NS_OpenAnonymousTemporaryFile failure to caller. r=billm
This commit is contained in:
parent
ebca8598ef
commit
bfd03b069b
@ -4459,12 +4459,15 @@ ContentParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd)
|
||||
}
|
||||
|
||||
bool
|
||||
ContentParent::RecvOpenAnonymousTemporaryFile(FileDescriptor *aFD)
|
||||
ContentParent::RecvOpenAnonymousTemporaryFile(FileDescOrError *aFD)
|
||||
{
|
||||
PRFileDesc *prfd;
|
||||
nsresult rv = NS_OpenAnonymousTemporaryFile(&prfd);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
// Returning false will kill the child process; instead
|
||||
// propagate the error and let the child handle it.
|
||||
*aFD = rv;
|
||||
return true;
|
||||
}
|
||||
*aFD = FileDescriptor(FileDescriptor::PlatformHandleType(PR_FileDesc2NativeHandle(prfd)));
|
||||
// The FileDescriptor object owns a duplicate of the file handle; we
|
||||
|
@ -762,7 +762,7 @@ private:
|
||||
RecvBackUpXResources(const FileDescriptor& aXSocketFd) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
RecvOpenAnonymousTemporaryFile(FileDescriptor* aFD) MOZ_OVERRIDE;
|
||||
RecvOpenAnonymousTemporaryFile(FileDescOrError* aFD) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
RecvKeygenProcessValue(const nsString& oldValue, const nsString& challenge,
|
||||
|
@ -335,6 +335,11 @@ union MaybeFileDesc {
|
||||
void_t;
|
||||
};
|
||||
|
||||
union FileDescOrError {
|
||||
FileDescriptor;
|
||||
nsresult;
|
||||
};
|
||||
|
||||
union OptionalContentId
|
||||
{
|
||||
ContentParentId;
|
||||
@ -827,7 +832,7 @@ parent:
|
||||
*/
|
||||
BackUpXResources(FileDescriptor aXSocketFd);
|
||||
|
||||
sync OpenAnonymousTemporaryFile() returns (FileDescriptor aFD);
|
||||
sync OpenAnonymousTemporaryFile() returns (FileDescOrError aFD);
|
||||
|
||||
/**
|
||||
* Keygen requires us to call it after a <keygen> element is parsed and
|
||||
|
@ -90,12 +90,15 @@ NS_OpenAnonymousTemporaryFile(PRFileDesc** aOutFileDesc)
|
||||
}
|
||||
|
||||
if (dom::ContentChild* child = dom::ContentChild::GetSingleton()) {
|
||||
ipc::FileDescriptor fd;
|
||||
DebugOnly<bool> succeeded = child->SendOpenAnonymousTemporaryFile(&fd);
|
||||
// The child process should already have been terminated if the
|
||||
// IPC had failed.
|
||||
MOZ_ASSERT(succeeded);
|
||||
*aOutFileDesc = PR_ImportFile(PROsfd(fd.PlatformHandle()));
|
||||
dom::FileDescOrError fd;
|
||||
child->SendOpenAnonymousTemporaryFile(&fd);
|
||||
if (fd.type() == dom::FileDescOrError::Tnsresult) {
|
||||
nsresult rv = fd.get_nsresult();
|
||||
MOZ_ASSERT(NS_FAILED(rv));
|
||||
return rv;
|
||||
}
|
||||
*aOutFileDesc =
|
||||
PR_ImportFile(PROsfd(fd.get_FileDescriptor().PlatformHandle()));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user