mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-27 09:37:31 +09:00
1326454 - Don't report an error when SourceCoords::add fails, because it fails only when an underlying Vector::append fails, and that vector handles OOM reporting itself.
This commit is contained in:
parent
6828c2c09b
commit
e4867e8b4d
1 changed files with 12 additions and 6 deletions
|
|
@ -225,8 +225,13 @@ TokenStream::SourceCoords::add(uint32_t lineNum, uint32_t lineStartOffset)
|
||||||
// only if lineStartOffsets_.append succeeds, to keep sentinel.
|
// only if lineStartOffsets_.append succeeds, to keep sentinel.
|
||||||
// Otherwise return false to tell TokenStream about OOM.
|
// Otherwise return false to tell TokenStream about OOM.
|
||||||
uint32_t maxPtr = MAX_PTR;
|
uint32_t maxPtr = MAX_PTR;
|
||||||
if (!lineStartOffsets_.append(maxPtr))
|
if (!lineStartOffsets_.append(maxPtr)) {
|
||||||
|
static_assert(mozilla::IsSame<decltype(lineStartOffsets_.allocPolicy()),
|
||||||
|
TempAllocPolicy&>::value,
|
||||||
|
"this function's caller depends on it reporting an "
|
||||||
|
"error on failure, as TempAllocPolicy ensures");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
lineStartOffsets_[lineIndex] = lineStartOffset;
|
lineStartOffsets_[lineIndex] = lineStartOffset;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -557,7 +562,6 @@ TokenStream::advance(size_t position)
|
||||||
lookahead = 0;
|
lookahead = 0;
|
||||||
|
|
||||||
if (flags.hitOOM) {
|
if (flags.hitOOM) {
|
||||||
error(JSMSG_OUT_OF_MEMORY);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1876,8 +1880,9 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
|
||||||
MOZ_CRASH("should have jumped to |out| or |error|");
|
MOZ_CRASH("should have jumped to |out| or |error|");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (flags.hitOOM)
|
if (flags.hitOOM) {
|
||||||
return reportError(JSMSG_OUT_OF_MEMORY);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
flags.isDirtyLine = true;
|
flags.isDirtyLine = true;
|
||||||
tp->pos.end = userbuf.offset();
|
tp->pos.end = userbuf.offset();
|
||||||
|
|
@ -1893,8 +1898,9 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (flags.hitOOM)
|
if (flags.hitOOM) {
|
||||||
return reportError(JSMSG_OUT_OF_MEMORY);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
flags.isDirtyLine = true;
|
flags.isDirtyLine = true;
|
||||||
tp->pos.end = userbuf.offset();
|
tp->pos.end = userbuf.offset();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue