I’m writing an extension to help improve browser privacy and I was wondering how I would go about redefining a few core Javascript functions that server up identifiable information about the user. For instance, if I wanted to stop the browser from leaking my list of plugins, how do I get my extension to override the PluginArray class?
I am currently loading my contentScript using PageMod and attempting to override PluginArray using smile:
Object.defineProperty(window, 'PluginArray', { enumerable: false, configurable: false, writable: true, value: PluginArray });
However this code fails with the error: ‘can’t redefine non-configurable property “PluginArray”’. I understand that under normal JavaScript circumstances providing such an override is not allowed. However I’m hoping that there is a lower level API that I can use to bypass these security restrictions.