mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 1253059: Use fallible allocation in the worker error reporter. r=baku
This commit is contained in:
parent
9eea75a6f5
commit
d7b4ab4573
@ -5795,7 +5795,13 @@ WorkerPrivate::ReportError(JSContext* aCx, const char* aFallbackMessage,
|
||||
}
|
||||
|
||||
if (message.IsEmpty()) {
|
||||
message = NS_ConvertUTF8toUTF16(aFallbackMessage);
|
||||
nsDependentCString fallbackMessage(aFallbackMessage);
|
||||
if (!AppendUTF8toUTF16(fallbackMessage, message, mozilla::fallible)) {
|
||||
// Try again, with only a 1 KB string. Do this infallibly this time.
|
||||
// If the user doesn't have 1 KB to spare we're done anyways.
|
||||
nsDependentCString truncatedFallbackMessage(aFallbackMessage, 1024);
|
||||
AppendUTF8toUTF16(truncatedFallbackMessage, message);
|
||||
}
|
||||
}
|
||||
|
||||
mErrorHandlerRecursionCount++;
|
||||
|
Loading…
Reference in New Issue
Block a user