The ScriptCache has a simple system for determining when the process is untrusted to ensure that script cache writes are finished before untrusted content is loaded in the content process. This expands this system to more explicitly cover multiple potential causes of becoming untrusted, and exposes a threadsafe flag which can be checked to see if the process could have started loading untrusted content. Much like the existing ScriptCache threshold, this is defined very conservatively, such that we cannot have loaded untrusted content before the threshold. Differential Revision: https://phabricator.services.mozilla.com/D307885