Closed Bug 1447454 Opened 6 years ago Closed 6 years ago

Stop allowing implicit downcasts in StrongOrRawPtr

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file)

Given the way the StrongOrRawPtr(already_AddRefed<S>&& aPtr) ctor does a downcast, you can do things like:

  interface Foo {
    Element bar();
  };

and then have Foo::bar() return already_AddRefed<nsINode> and this will compile.  This is obviously not good.  ;)

Luckily we have only two things that are relying on this behavior, and both are actually safe.  One is being removed in bug 1446246 and the other is simple to fix.
Priority: -- → P2
Attachment #8960780 - Flags: review?(peterv) → review+
Depends on: 1446246
Bug 888600 introduced new failures of this sort, but I think bug 1448850 will remove them again....
Depends on: 1448850
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/5cc5f9c978a3
Stop allowing implicit downcasts in StrongOrRawPtr.  r=peterv
https://hg.mozilla.org/mozilla-central/rev/5cc5f9c978a3
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla61
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: