This webrev also contains the following fixes:
1) FF crash crash on reload which the download FX dialog is being displayed
The cause is that the mNPP became invalid inside NotifyInstallStatus when
Fix is to set the mNPP to NULL in ~ScriptablePluginObject() within a critical section. In NotifyInstallStatus, null check mNPP inside the same critical section and call pluginThreadAsyncCall if it isn't null.
2) Forgot to report status upon cancel on download.
Fixed in JREInstall.install() and JavaFX.install(). There's no issue with the FX download thread. The onOk and onCancel methods in CDownloadDialog are synchronized with the download thread.
3) Missing install status sometimes.
The problem is due to synchronization issue between pluginThreadCallback and NotifyInstallStatus in ScriptablePluginObject. NPN_InvokeDefault fails sometimes if NotifyInstallStatus returns too soon. By the time pluginThreadCallback is invoked, the NPObject may become invalid if the destructor of MozInstallCallback has been invoked.
A fix is to add a handle to synchronize the pluginThreadCallback and NotifyInstallStatus methods. NotifyInstallStatus will wait for pluginThreadCallback to finish and then release the allocated resources including the handle.