Closed Bug 1599114 Opened 6 years ago Closed 6 years ago

StrongOrRawPtr should accept a RefPtr

Categories

(Core :: DOM: Bindings (WebIDL), defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: sg, Assigned: sg)

Details

Attachments

(1 file)

StrongOrRawPtr only accepts a raw pointer or the deprecated already_AddRefed<>&&. It should also accept RefPtr<>&& directly to not force classes implementing the binding to use already_AddRefed.

The patch is fine as far as it goes, bug could you point me to where already_AddRefed got deprecated? The last discussion I see on that is in 2016 (on mozilla.dev.platform), and the conclusion seemed to be that using RefPtr by value in places where we currently use already_AddRefed lost us valuable assertions about expected behavior and introduced threadsafety concerns. Has something changed since then?

Flags: needinfo?(sgiesecke)

I was following https://bugzilla.mozilla.org/show_bug.cgi?id=1349379. It's what the summary of the bug says. In conclusion, maybe "deprecated" does not properly describe this, but "deprecated except for specific uses that remain legitimate" is what I understand from that.

Flags: needinfo?(sgiesecke)

Ah, I see. The summary there doesn't really cover the situation, yeah.

Returning RefPtr is slightly footgunny right now, but I guess for the specific cases where StrongOrRawPtr is used it's not really a problem. We just need to watch out for people overusing RefPtr return values where they're not really needed or appropriate...

Pushed by sgiesecke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a0b2e7b06070 Allow StrongOrRawPtr to accept RefPtr. r=bzbarsky
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: