Closed Bug 884245 Opened 13 years ago Closed 13 years ago

nsContentUtils::GetDocumentFromCaller() roots with a null context

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: jonco, Assigned: bholley)

References

Details

Attachments

(1 file, 1 obsolete file)

The following code is obviously bogus: 1670 nsIDocument* 1671 nsContentUtils::GetDocumentFromCaller() 1672 { 1673 JSContext *cx = nullptr; 1674 JS::Rooted<JSObject*> obj(cx);
Attached patch Proposed fix (obsolete) — Splinter Review
Get the JSContext first via GetCurrentNativeCallContext()
Attachment #764076 - Flags: review?(bobbyholley+bmo)
Comment on attachment 764076 [details] [diff] [review] Proposed fix This isn't the fix we want. I'll attach a patch.
Attachment #764076 - Attachment is obsolete: true
Attachment #764076 - Flags: review?(bobbyholley+bmo)
The first three lines of this function are an obvious bug. But the behavior in general is also worrisome, because it's using antiquated XPConnect machinery that will be less and less correct as we move to the new DOM bindings. Let's just infer our global from the active compartment.
Attachment #764227 - Flags: review?(bzbarsky)
Assignee: jcoppeard → bobbyholley+bmo
Comment on attachment 764227 [details] [diff] [review] Simplify nsContentUtils::GetDocumentFromCaller. v1 r=me
Attachment #764227 - Flags: review?(bzbarsky) → review+
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: