Bug 1465292 Part 2 - Track parsed content from XDR'ed scripts, r=nbp.

--HG--
extra : rebase_source : 93559e9e14c17a06e8a31e414958c32bc377b5ca
This commit is contained in:
Brian Hackett 2018-07-23 21:41:50 +00:00
Родитель 8f3d612ea8
Коммит 54b2f27d05
1 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -2214,6 +2214,18 @@ ScriptSource::performXDR(XDRState<mode>* xdr)
MOZ_ASSERT_IF(mode == XDR_DECODE && xdr->hasOptions(), filename());
if (mode == XDR_DECODE && !xdr->hasOptions() && !setFilename(xdr->cx(), fn))
return xdr->fail(JS::TranscodeResult_Throw);
// Note the content of sources decoded when recording or replaying.
if (mode == XDR_DECODE && hasSourceData() && mozilla::recordreplay::IsRecordingOrReplaying()) {
UncompressedSourceCache::AutoHoldEntry holder;
ScriptSource::PinnedChars chars(xdr->cx(), this, holder, 0, length());
if (!chars.get())
return xdr->fail(JS::TranscodeResult_Throw);
JS::BeginContentParseForRecordReplay(this, filename(), "application/javascript",
JS::SmallestEncoding::UTF16);
JS::AddContentParseDataForRecordReplay(this, chars.get(), length() * sizeof(char16_t));
JS::EndContentParseForRecordReplay(this);
}
}
return Ok();