зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1676152 - Generalize StructuredCloneHolder::WriteString to accept a nsAString. r=baku
Differential Revision: https://phabricator.services.mozilla.com/D96415
This commit is contained in:
Родитель
119d8f1aa7
Коммит
17eaf9bf3f
|
@ -481,10 +481,11 @@ bool StructuredCloneHolder::ReadString(JSStructuredCloneReader* aReader,
|
|||
|
||||
/* static */
|
||||
bool StructuredCloneHolder::WriteString(JSStructuredCloneWriter* aWriter,
|
||||
const nsString& aString) {
|
||||
const nsAString& aString) {
|
||||
size_t charSize = sizeof(nsString::char_type);
|
||||
return JS_WriteUint32Pair(aWriter, aString.Length(), 0) &&
|
||||
JS_WriteBytes(aWriter, aString.get(), aString.Length() * charSize);
|
||||
JS_WriteBytes(aWriter, aString.BeginReading(),
|
||||
aString.Length() * charSize);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
@ -296,7 +296,7 @@ class StructuredCloneHolder : public StructuredCloneHolderBase {
|
|||
// Helper functions for reading and writing strings.
|
||||
static bool ReadString(JSStructuredCloneReader* aReader, nsString& aString);
|
||||
static bool WriteString(JSStructuredCloneWriter* aWriter,
|
||||
const nsString& aString);
|
||||
const nsAString& aString);
|
||||
|
||||
static const JSStructuredCloneCallbacks sCallbacks;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче