Finalizer for WebIDL object backed by JS impl of an XPCOM interface

2017-08-08 Thread Henri Sivonen
What's the correct way to take an action right before a JS-implemented XPCOM object that acts as the implementation for a WebIDL interface gets garbage collected? -- Henri Sivonen hsivo...@hsivonen.fi https://hsivonen.fi/ ___ dev-platform mailing list d

Re: Finalizer for WebIDL object backed by JS impl of an XPCOM interface

2017-08-09 Thread Henri Sivonen
On Tue, Aug 8, 2017 at 1:26 PM, Henri Sivonen wrote: > What's the correct way to take an action right before a JS-implemented > XPCOM object that acts as the implementation for a WebIDL interface > gets garbage collected? Taking action soon after GC would work for me as well. I'm thinking of int

Re: Finalizer for WebIDL object backed by JS impl of an XPCOM interface

2017-08-09 Thread Boris Zbarsky
On 8/9/17 1:55 PM, Henri Sivonen wrote: I'm thinking of introducing a C++-implemented XPCOM object that the JS-implemented XPCOM object can hold a reference to and that has a C++ destructor that does what I want. Does that mean your action doesn't depend on which exact JS object got collected,

Re: Finalizer for WebIDL object backed by JS impl of an XPCOM interface

2017-08-11 Thread Henri Sivonen
On Wed, Aug 9, 2017 at 9:39 PM, Boris Zbarsky wrote: > On 8/9/17 1:55 PM, Henri Sivonen wrote: >> >> I'm thinking of introducing a C++-implemented XPCOM object that the >> JS-implemented XPCOM object can hold a reference to and that has a C++ >> destructor that does what I want. > > > Does that me

Re: Finalizer for WebIDL object backed by JS impl of an XPCOM interface

2017-08-11 Thread Boris Zbarsky
On 8/11/17 5:59 AM, Henri Sivonen wrote: The action is decrementing a counter on the inner window, so it's sufficient if the C++ destructor knows if it needs to decrement the counter and knows which window. The concrete situation is described in https://bugzilla.mozilla.org/show_bug.cgi?id=13781