move PrioEncoder initialization into a non-static method

Assigned to



8 months ago
3 months ago


(Reporter: rhelmer, Assigned: rhelmer)


Firefox Tracking Flags

(Not tracked)




8 months ago
While looking at bug 1491737, I noticed that the way we're throwing errors from the static `encode` method could still potentially cause problems (memory leaks at least) if the key import were to fail (for any reason other than an invalid key, which bug 1492940 fixes), or if `Prio_init()` fails, since cleanup will never run:

Currently, cleanup such as freeing memory and shutting down the NSS context (via `Prio_clear`) only happens when the `PrioEncoder` singleton that the `encode` method creates has its destructor called by `ClearOnShutdown`.

In Henri suggested:
> Perhaps moving sPublicKeyA and sPublicKeyB to be fields mPublicKeyA and
> mPublicKeyB and moving the initialization code into a non-static method.

Comment 1

3 months ago

:chutten, are you likely to use the PrioEncoder DOM function or do you think you will use libprio directly from Telemetry?

Flags: needinfo?(chutten)

Comment 2

3 months ago

Oh, as I mention over in bug 1501132 comment#4, I plan on using PrioEncoder either as it is, or broken up into slightly smaller pieces so I can reach it without having a JS context.

Flags: needinfo?(chutten)
You need to log in before you can comment on or make changes to this bug.