Bug 1585819 - Somewhat dubiously appease the hazard analysis. r=bustage

It was complaining about

  "unrooted '<returnvalue>' of type 'JSObject*' live across GC call at dom/base/Element.cpp:588"

Where the GC call is:

Function '_ZN7mozilla3dom7Element10WrapObjectEP9JSContextN2JS6HandleIP8JSObjectEE$JSObject* mozilla::dom::Element::WrapObject(JSContext*, JS::Handle<JSObject*>)' has unrooted '<returnvalue>' of type 'JSObject*' live across GC call '_ZN6RefPtrI12nsXBLBindingED1Ev$RefPtr<T>::~RefPtr() [with T = nsXBLBinding]' at dom/base/Element.cpp:588
    Element.cpp:588: Assign(64,65, return := __temp_29**)
    Element.cpp:588: Call(65,66, binding.~__dt_comp ()) [[GC call]]
    Element.cpp:588: Call(66,67, principal.~__dt_comp ())
    Element.cpp:588: Call(67,68, uri.~__dt_comp ())
    Element.cpp:588: Call(68,69, style.~__dt_comp ())
    Element.cpp:588: Call(69,70, obj.~__dt_comp ())
    Element.cpp:589:  [[end of function]]
GC Function: _ZN6RefPtrI12nsXBLBindingED1Ev$RefPtr<T>::~RefPtr() [with T = nsXBLBinding]
    RefPtr<T>::~RefPtr() [with T = nsXBLBinding] [[base_dtor]]
    static void RefPtr<T>::ConstRemovingRefPtrTraits<U>::Release(U*) [with U = nsXBLBinding; T = nsXBLBinding]
    static void mozilla::RefPtrTraits<U>::Release(U*) [with U = nsXBLBinding]
    uint32 nsXBLBinding::Release()
    uint64 nsCycleCollectingAutoRefCnt::decr(void*, nsCycleCollectionParticipant*, uint8*) [with void (* suspect)(void*, nsCycleCollectionParticipant*, nsCycleCollectingAutoRefCnt*, bool*) = NS_CycleCollectorSuspect3; uintptr_t = long unsigned int]
    NS_CycleCollectorSuspect3
    nsCycleCollector.cpp:void SuspectAfterShutdown(void*, nsCycleCollectionParticipant*, nsCycleCollectingAutoRefCnt*, uint8*)
    nsCycleCollectionParticipant.DeleteCycleCollectable
    void nsIContent::cycleCollection::DeleteCycleCollectable(void*)
    nsIContent.DeleteCycleCollectable
    unresolved nsIContent.DeleteCycleCollectable

I don't think the analysis is right since the Rooted<> thing will go out of the
scope after the RefPtr.

MANUAL PUSH: Bustage fix for broken (I think) analysis
This commit is contained in:
Emilio Cobos Álvarez 2019-10-03 06:35:33 +02:00
parent 34fa4fa528
commit c863ef674b

View File

@ -550,6 +550,7 @@ JSObject* Element::WrapObject(JSContext* aCx,
return obj;
}
{
RefPtr<ComputedStyle> style =
nsComputedDOMStyle::GetComputedStyleNoFlush(this, nullptr);
if (!style) {
@ -584,6 +585,7 @@ JSObject* Element::WrapObject(JSContext* aCx,
&nsXBLBinding::ExecuteAttachedHandler));
}
}
}
return obj;
}