Closed Bug 1275945 Opened 4 years ago Closed 4 years ago
Don't create the Auto
JSContext in ns Node Utils::Clone And Adopt if we don't have an a Reparent Scope
The changes in bug 839467 made CloneAndAdopt always push stuff on the JSContext stack. This isn't very desirable, both for performance reasons and because it lands a null-compartment thing on the stack. In practice, we only use this AutoJSContext when aReparentScope is non-null, so we should only construct it in that case.
This prevents us from pushing stuff on the JSContext stack unnecessarily when we're just cloning, not adopting. It's OK that we're doing it in a narrow scope that doesn't include our recursion into children, because in practice when aReparentScope is non-null we came from nsIDocument::AdoptNode which already does AutoJSContext. So we're not going to continuously push/pop the JSContext stack in that situation, since something already got pushed on it.
Attachment #8756900 - Flags: review?(mrbkap)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #8756900 - Flags: review?(mrbkap) → review+
You need to log in before you can comment on or make changes to this bug.