So:
- block all incoming and outgoing requests from that page
- discard all data persisted in cookies/localStorage
- ignore caches (to prevent timing attacks)
If it's not possible for the page to perform any lasting global state modifications, you wouldn't have to trust that the server is not shipping malicious code to exfiltrate the key or plaintext. It wouldn't be able to do so.
EDIT: I'm speaking from the position of an end-user. I'm downloading ciphertext + a decryption tool from an untrusted server and executing the decryption tool locally, with a key which I input locally. I want to make sure that the plaintext and key do not get leaked back to the server.
Situations where this arises include encrypted pastebins, bitaddress.org, Ian Coleman's BIP39 tool, anything else that generates or handles bitcoin keys, etc.
May have to watch the network tab to identify additional dependencies as the page loads.
The wget step ensures that the user knows and controls everything that gets sent upstream.
Is there a browser that can require of each HTTP request?