Closed Bug 949887 Opened 11 years ago Closed 11 years ago

Rooting hazard in Navigator::HasTelephonySupport

Categories

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

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 940765

People

(Reporter: bzbarsky, Unassigned)

References

Details

(Keywords: regression)

Bug 915604 introduced a rooting hazard: the unrooted aGlobal is used after the preference get, and we have no guarantee that the preference get won't GC.

I recommend moving this line:

  nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);

to before the preference get.
Hm, I did it the other way, by rooting the global. I was afraid GetWindowFromGlobal might be expensive.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.