This won't remove the event listener because unload points to the function not the instance that was added. e.g. https://github.com/mozilla/pdf.js/blob/master/extensions/firefox/components/PdfStreamConverter.js#L497