Closed Bug 951082 Opened 6 years ago Closed 4 years ago

Figure out what nsReferencedElement::Reset should do if nsContentUtils::ConvertStringFromEncoding fails

Categories

(Core :: DOM: Core & HTML, defect, trivial)

All
Linux
defect
Not set
trivial

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: hsivonen, Assigned: jwatt)

Details

Attachments

(1 file)

If nsContentUtils::ConvertStringFromEncoding fails, it means that fallible allocation failed. We should probably stick to something other than trying conversion from UTF-8 without handling UTF-8 errors as the fallback case.

I.e. don't do 
  nsresult rv = nsContentUtils::ConvertStringFromEncoding(charset,
                                                          refPart,
                                                          ref);
  if (NS_FAILED(rv)) {
    CopyUTF8toUTF16(refPart, ref);
  }
Attached patch patchSplinter Review
Attachment #8752170 - Flags: review?(dholbert)
Assignee: nobody → jwatt
Comment on attachment 8752170 [details] [diff] [review]
patch

Review of attachment 8752170 [details] [diff] [review]:
-----------------------------------------------------------------

Commit message nit:

> Bug 951082 - Make nsReferencedElement::Reset fail if nsContentUtils::ConvertStringFromEncoding fails. r=dholbert

Maybe "fail if" --> "fail if its call to", to make the relationship a bit clearer.
Attachment #8752170 - Flags: review?(dholbert) → review+
https://hg.mozilla.org/mozilla-central/rev/8c85bfdc5442
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.