mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1326105 part 1. dom::RootedCallback should hold on to a JSContext that it can then use in its destructor. r=smaug
This commit is contained in:
parent
10f0b72494
commit
f3debaf2fb
@ -545,11 +545,12 @@ ImplCycleCollectionUnlink(CallbackObjectHolder<T, U>& aField)
|
||||
// it ensures that the callback is traced, and that if something is holding onto
|
||||
// the callback when we're done with it HoldJSObjects is called.
|
||||
template<typename T>
|
||||
class RootedCallback : public JS::Rooted<T>
|
||||
class MOZ_RAII RootedCallback : public JS::Rooted<T>
|
||||
{
|
||||
public:
|
||||
explicit RootedCallback(JSContext* cx)
|
||||
: JS::Rooted<T>(cx)
|
||||
, mCx(cx)
|
||||
{}
|
||||
|
||||
// We need a way to make assignment from pointers (how we're normally used)
|
||||
@ -599,6 +600,8 @@ private:
|
||||
{
|
||||
return aOwningNonNull.isInitialized();
|
||||
}
|
||||
|
||||
JSContext* mCx;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
Loading…
Reference in New Issue
Block a user