mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-22 00:17:32 +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
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue