TL;DR: Using Subresource Integrity hashing/checking can prevent your site from participating in a Great Cannon-style attack.
Mozilla Firefox Developer Edition 43 and other modern browsers help websites to control third-party JavaScript loads and prevent unexpected or malicious modifications. Using a new specification called Subresource Integrity, a website can include JavaScript that will stop working if it has been modified. With this technology, developers can benefit from the performance gains of using Content Delivery Networks (CDNs) without having to fear that a third-party compromise can harm their website.
Source: Do not let your CDN betray you: Use Subresource Integrity ✩ Mozilla Hacks – the Web developer blog