Closed Bug 910853 Opened 11 years ago Closed 10 years ago

Issues with JavaScriptParent::className

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 962604

People

(Reporter: evilpie, Unassigned)

References

Details

I found two issues with className. First we return NULL on failure, but that actually crashes the browser sometimes, because we don't expect null pointers. We should return something like "crashed". The second issue is harder to fix, at the moment we use ToNewCString, which creates c-string copy of the nsString, but we never free it and just leak. Fixing this is harder and would probably involve having a map of ObjectId->cstring, which would allow us to free the string when the child object dies. The other solution would be to change the className interface to always create a copy. This is however is also not really favorable for all the other static strings.
Do you have any slots on the proxy in the parent where you could just store the string?  And then clean it up when finalized?
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.