Closed Bug 1132655 Opened 10 years ago Closed 10 years ago

Don't allow conversions from DOMString to const string references

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38
Tracking Status
firefox38 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

Details

Attachments

(1 file)

DOMString is meant to be used as an outparam. When converting it to a const string reference, what will happen is that its conversion operator to nsString& will get invoked and then the result will be treated as a const nsString&. But the conversion operator to nsString& on DOMString is only supposed to be used if the DOMString doesn't contain any data, and asserts so. Sadly, we have some codepaths that are clearly undertested... In any case, the upshot is that you can only pass a DOMString to a const string ref without hitting asserts in the tree today if the DOMString is empty. It's highly unlikely that anyone is currently doing that correctly.
Attachment #8563653 - Flags: review?(bugs) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: