On 20/11/2017 10:01, 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 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?
Thanks for raising this, I think this is a great idea. I think
additionally we could probably drop a lot of internal/external object
forwarding we do for this purpose (e.g. CustomizableUI has that and a
CustomizableUIInternal object to which everything is forwarded), which
would remove a lot of useless boilerplate.
~ Gijs
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform