mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-26 02:17:34 +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
|
|
@ -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