Sort:  

Various add-ons already do this. For example uMatrix (also shown in one of @sempervideo videos) has this setting:

One of the first things I always do after installing Firefox!