Isn't that just SRI in a bookmarklet? With SRI you give the browser a hash and if the resource does not match it does not load.
data:text/html,<script crossorigin="anonymous" integrity="..." src="...">
In total that should be a lot smaller than the linked codegolf answer.