diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-06-08 15:57:27 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:18 -0400 |
commit | c6fe42095040b0be2ee85bc750bd905bfe396fbd (patch) | |
tree | ad3f070b511ea91ebcba4f45c194a8479880d3d6 | |
parent | aa2decd154dbbd17e0eac9c570841eb445c63a3f (diff) | |
download | UXP-c6fe42095040b0be2ee85bc750bd905bfe396fbd.tar UXP-c6fe42095040b0be2ee85bc750bd905bfe396fbd.tar.gz UXP-c6fe42095040b0be2ee85bc750bd905bfe396fbd.tar.lz UXP-c6fe42095040b0be2ee85bc750bd905bfe396fbd.tar.xz UXP-c6fe42095040b0be2ee85bc750bd905bfe396fbd.zip |
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.
-rw-r--r-- | js/src/frontend/TokenStream.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/js/src/frontend/TokenStream.cpp b/js/src/frontend/TokenStream.cpp index 619285090..186b7a8ab 100644 --- a/js/src/frontend/TokenStream.cpp +++ b/js/src/frontend/TokenStream.cpp @@ -225,8 +225,13 @@ TokenStream::SourceCoords::add(uint32_t lineNum, uint32_t lineStartOffset) // only if lineStartOffsets_.append succeeds, to keep sentinel. // Otherwise return false to tell TokenStream about OOM. 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; + } lineStartOffsets_[lineIndex] = lineStartOffset; } else { @@ -557,7 +562,6 @@ TokenStream::advance(size_t position) lookahead = 0; if (flags.hitOOM) { - error(JSMSG_OUT_OF_MEMORY); return false; } @@ -1876,8 +1880,9 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier) MOZ_CRASH("should have jumped to |out| or |error|"); out: - if (flags.hitOOM) - return reportError(JSMSG_OUT_OF_MEMORY); + if (flags.hitOOM) { + return false; + } flags.isDirtyLine = true; tp->pos.end = userbuf.offset(); @@ -1893,8 +1898,9 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier) return true; error: - if (flags.hitOOM) - return reportError(JSMSG_OUT_OF_MEMORY); + if (flags.hitOOM) { + return false; + } flags.isDirtyLine = true; tp->pos.end = userbuf.offset(); |