Proposal: Stop using Object.freeze/Object.seal on most of our Javascript Objects

Mark Banner mbanner at mozilla.com
Mon Nov 20 11:13:45 UTC 2017


[Resending to get the correct Firefox list]

Now that we don't have legacy add-ons outside of our control, I would 
like to propose that we stop using Object.freeze/Object.seal on most of 
our objects.

I believe that this was originally done to provide some extra 
security/stability relating to add-ons, i.e. stop them messing with our 
internal interfaces. Now that this isn't a problem, it seems that we 
should reconsider this.

One of the main reasons for opening this up would be to allow easier 
stubbing for unit/integration tests. For example, using sinon with 
stubbing makes it easier to work with - you don't have to cover multiple 
components for a "simple" test if you don't want to. Unfortunately, the 
current practice for using Object.freeze/Object.seal prevents this.

Are there any concerns or objections to changing this practice?

Mark.



More information about the firefox-dev mailing list