mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Split aData into smaller chunks to avoid going over the IPC message size limit (1335989).
This commit is contained in:
parent
0104a9cd3c
commit
e84c7ab0c3
6 changed files with 32 additions and 4 deletions
|
|
@ -385,6 +385,18 @@ struct ParamTraits<nsLiteralCString> : ParamTraits<nsACString>
|
|||
typedef nsLiteralCString paramType;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<nsDependentSubstring> : ParamTraits<nsAString>
|
||||
{
|
||||
typedef nsDependentSubstring paramType;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<nsDependentCSubstring> : ParamTraits<nsACString>
|
||||
{
|
||||
typedef nsDependentCSubstring paramType;
|
||||
};
|
||||
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
|
||||
template<>
|
||||
|
|
|
|||
|
|
@ -36,6 +36,8 @@ Types = (
|
|||
'nsresult',
|
||||
'nsString',
|
||||
'nsCString',
|
||||
'nsDependentSubstring',
|
||||
'nsDependentCSubstring',
|
||||
'mozilla::ipc::Shmem',
|
||||
'mozilla::ipc::FileDescriptor'
|
||||
)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ parent:
|
|||
async AppData(SerializedLoadContext loadContext, PBrowserOrId browser);
|
||||
|
||||
// methods corresponding to those of nsIWyciwygChannel
|
||||
async WriteToCacheEntry(nsString data);
|
||||
async WriteToCacheEntry(nsDependentSubstring data);
|
||||
async CloseCacheEntry(nsresult reason);
|
||||
async SetCharsetAndSource(int32_t source, nsCString charset);
|
||||
async SetSecurityInfo(nsCString securityInfo);
|
||||
|
|
|
|||
|
|
@ -689,8 +689,22 @@ WyciwygChannelChild::WriteToCacheEntry(const nsAString & aData)
|
|||
mSentAppData = true;
|
||||
}
|
||||
|
||||
SendWriteToCacheEntry(PromiseFlatString(aData));
|
||||
mState = WCC_ONWRITE;
|
||||
|
||||
// Give ourselves a megabyte of headroom for the message size. Convert bytes
|
||||
// to wide chars.
|
||||
static const size_t kMaxMessageSize = (IPC::Channel::kMaximumMessageSize - 1024) / 2;
|
||||
|
||||
size_t curIndex = 0;
|
||||
size_t charsRemaining = aData.Length();
|
||||
do {
|
||||
size_t chunkSize = std::min(charsRemaining, kMaxMessageSize);
|
||||
SendWriteToCacheEntry(Substring(aData, curIndex, chunkSize));
|
||||
|
||||
charsRemaining -= chunkSize;
|
||||
curIndex += chunkSize;
|
||||
} while (charsRemaining != 0);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ WyciwygChannelParent::RecvAsyncOpen(const URIParams& aOriginal,
|
|||
}
|
||||
|
||||
bool
|
||||
WyciwygChannelParent::RecvWriteToCacheEntry(const nsString& data)
|
||||
WyciwygChannelParent::RecvWriteToCacheEntry(const nsDependentSubstring& data)
|
||||
{
|
||||
if (!mReceivedAppData) {
|
||||
printf_stderr("WyciwygChannelParent::RecvWriteToCacheEntry: FATAL ERROR: didn't receive app data\n");
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ protected:
|
|||
const uint32_t& loadFlags,
|
||||
const IPC::SerializedLoadContext& loadContext,
|
||||
const PBrowserOrId &parent) override;
|
||||
virtual bool RecvWriteToCacheEntry(const nsString& data) override;
|
||||
virtual bool RecvWriteToCacheEntry(const nsDependentSubstring& data) override;
|
||||
virtual bool RecvCloseCacheEntry(const nsresult& reason) override;
|
||||
virtual bool RecvSetCharsetAndSource(const int32_t& source,
|
||||
const nsCString& charset) override;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue