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

Mark Banner mbanner at
Mon Nov 20 14:06:54 UTC 2017

On 20/11/2017 13:22, Nicolas B. Pierron wrote:
> On 11/20/2017 10:01 AM, Mark Banner wrote:
>> 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 would personally recommend to every JavaScript developer that they 
> should use these functions, in web pages, in JavaScript libraries, …
> I believe that Object.freeze and Object.seal are sanity functions, 
> part of defensive programming, used to guarantee that no other part of 
> the code is doing something which is not intended.
I can understand the idea here, but I'm failing to believe that doing 
this would outweigh the benefits of having a unit test system where I 
can truly test at the unit level (or, more easily test at the 
integration/functional level).

If we had a complex function bar(), which, as part of it called, how could I ensure that is called with the 
correct parameters according to the inputs of bar()?

If Object is frozen, then I can't change Object, which means I either 
have to have some sort of abstraction interface, or a backdoor into 
Object, both of which would add extra overhead and complexity which 
doesn't seem to be the ideal.

Are there alternative ways we could achieve the same without the (or 
with low) complexity/overhead?


More information about the firefox-dev mailing list