mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 826846 - B2G: Crash in loop if reinstall existing packaged app. r=jdm
This commit is contained in:
parent
8371f28da1
commit
8c677d69d5
@ -26,8 +26,10 @@ parent:
|
||||
__delete__();
|
||||
|
||||
child:
|
||||
// success/failure code, and if NS_SUCCEEDED(rv), an open file descriptor
|
||||
FileOpened(FileDescriptor fd, nsresult rv);
|
||||
// Your file handle is ready, Sir...
|
||||
FileOpened(FileDescriptor fd);
|
||||
// Trying to send invalid fd crashes, so we need separate method for failure
|
||||
FileDidNotOpen();
|
||||
};
|
||||
|
||||
|
||||
|
@ -138,26 +138,39 @@ RemoteOpenFileChild::AsyncRemoteFileOpen(int32_t aFlags,
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool
|
||||
RemoteOpenFileChild::RecvFileOpened(const FileDescriptor& aFD,
|
||||
const nsresult& aRV)
|
||||
RemoteOpenFileChild::RecvFileOpened(const FileDescriptor& aFD)
|
||||
{
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA)
|
||||
NS_NOTREACHED("osX and Windows shouldn't be doing IPDL here");
|
||||
#else
|
||||
if (NS_SUCCEEDED(aRV)) {
|
||||
mNSPRFileDesc = PR_AllocFileDesc(aFD.PlatformHandle(), PR_GetFileMethods());
|
||||
}
|
||||
mNSPRFileDesc = PR_AllocFileDesc(aFD.PlatformHandle(), PR_GetFileMethods());
|
||||
|
||||
MOZ_ASSERT(mListener);
|
||||
|
||||
mListener->OnRemoteFileOpenComplete(aRV);
|
||||
|
||||
mListener->OnRemoteFileOpenComplete(NS_OK);
|
||||
mListener = nullptr; // release ref to listener
|
||||
|
||||
// This calls NeckoChild::DeallocPRemoteOpenFile(), which deletes |this| if
|
||||
// IPDL holds the last reference. Don't rely on |this| existing after here!
|
||||
Send__delete__(this);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
RemoteOpenFileChild::RecvFileDidNotOpen()
|
||||
{
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA)
|
||||
NS_NOTREACHED("osX and Windows shouldn't be doing IPDL here");
|
||||
#else
|
||||
MOZ_ASSERT(mListener);
|
||||
printf_stderr("RemoteOpenFileChild: file was not opened!\n");
|
||||
mListener->OnRemoteFileOpenComplete(NS_ERROR_FILE_NOT_FOUND);
|
||||
mListener = nullptr; // release ref to listener
|
||||
|
||||
// This calls NeckoChild::DeallocPRemoteOpenFile(), which deletes |this| if
|
||||
// IPDL holds the last reference. Don't rely on |this| existing after here!
|
||||
Send__delete__(this);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -68,7 +68,8 @@ private:
|
||||
RemoteOpenFileChild(const RemoteOpenFileChild& other);
|
||||
|
||||
protected:
|
||||
virtual bool RecvFileOpened(const FileDescriptor&, const nsresult&);
|
||||
virtual bool RecvFileOpened(const FileDescriptor&);
|
||||
virtual bool RecvFileDidNotOpen();
|
||||
|
||||
// regular nsIFile object, that we forward most calls to.
|
||||
nsCOMPtr<nsIFile> mFile;
|
||||
|
@ -50,7 +50,7 @@ RemoteOpenFileParent::RecvAsyncOpenFile()
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
int fd = open(path.get(), O_RDONLY);
|
||||
if (fd != -1) {
|
||||
unused << SendFileOpened(FileDescriptor(fd), NS_OK);
|
||||
unused << SendFileOpened(FileDescriptor(fd));
|
||||
// file handle needs to stay open until it's shared with child (and IPDL
|
||||
// is async, so hasn't happened yet). Close in destructor.
|
||||
mFd = fd;
|
||||
@ -60,7 +60,8 @@ RemoteOpenFileParent::RecvAsyncOpenFile()
|
||||
|
||||
// Note: sending an invalid file descriptor currently kills the child process:
|
||||
// but that's ok for our use case (failing to open application.jar).
|
||||
unused << SendFileOpened(FileDescriptor(mFd), NS_ERROR_NOT_AVAILABLE);
|
||||
printf_stderr("RemoteOpenFileParent: file '%s' was not found!\n", path.get());
|
||||
unused << SendFileDidNotOpen();
|
||||
#endif // OS_TYPE
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user