Bug 1270310 - Part 1: Make allocation in ConvertStringLineBreaks fallible. r=froydnj, r=peterv
ConvertStringLineBreaks calls ConvertUnicharLineBreaksInSitu which uses fallible allocation. We should make the potential allocation in |BeginWriting| fallible as well and handle the failure. This also updates the callers to |ConvertStringLineBreaks| to handle the error properly in release builds.
This commit is contained in:
@@ -5764,13 +5764,17 @@ HTMLInputElement::SaveState()
|
||||
inputState = new HTMLInputElementState();
|
||||
nsAutoString value;
|
||||
GetValue(value);
|
||||
DebugOnly<nsresult> rv =
|
||||
nsresult rv =
|
||||
nsLinebreakConverter::ConvertStringLineBreaks(
|
||||
value,
|
||||
nsLinebreakConverter::eLinebreakPlatform,
|
||||
nsLinebreakConverter::eLinebreakContent);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Converting linebreaks failed!");
|
||||
inputState->SetValue(value);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Converting linebreaks failed!");
|
||||
return rv;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user