Open Bug 1478749 Opened 8 years ago Updated 2 years ago

JS::ubi::Concrete<nsINode> edge names allocated via NS_strdup should not be freed with JS_free

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: KrisWright, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

JS::ubi::Concrete<nsINode> is a UbiNode memory reporting specialization for DOM structure, which measures the size of its associated nsINode pointer and yields outgoing edges to its parent children. For the time being, all of the edge names allocated in JS::ubi::Concrete<nsINode>::edges are allocated via NS_strdup[1] and then freed using JS_free. While this works for the time being, it could pose a problem in the future. We want to expose a function from JS (such as js::DuplicateString[2]) that enables us to allocate these edge names in JS. 1. See Bug 1474383 2. https://searchfox.org/mozilla-central/rev/943a6cf31a96eb439db8f241ab4df25c14003bb8/js/src/util/Text.cpp#95
Priority: -- → P3
Kristen, are you interested in patching this? We'd take a patch for it. Ping me on IRC if you'd like to look into it.
Added js::ubi::CreateEdgeName(const char16_t*, char16_t*) to expose js::DuplicateString to JS::ubi::Concrete<nsINode>::edges
Assignee: nobody → kwright
Status: NEW → ASSIGNED
Comment on attachment 9025398 [details] [diff] [review] Exposes js::DuplicateString to NodeUbiReporting.cpp through the UbiNode namespace Jim, would you mind doing a review for this?
Attachment #9025398 - Flags: review?(jimb)
Severity: normal → S3

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: kwright → nobody
Status: ASSIGNED → NEW
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: