YUes I am god

This commit is contained in:
velzie 2024-08-25 23:04:31 -04:00
parent 5024e19c08
commit c61e62ec91
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
6 changed files with 56 additions and 8 deletions

View file

@ -0,0 +1,26 @@
import { ScramjetClient } from "../client";
import { config } from "../shared";
export const POLLUTANT = Symbol.for("scramjet realm pollutant");
export default function (client: ScramjetClient, self: typeof globalThis) {
// object.$setrealm({}).postMessage(...)
// the empty object is the "pollutant" which can reconstruct the real realm
// i explain more in postmessage.ts
Object.defineProperty(self.Object.prototype, config.setrealmfn, {
value(pollution: {}) {
// this is bad!! sites could detect this
Object.defineProperty(this, POLLUTANT, {
value: pollution,
writable: false,
configurable: true,
enumerable: false,
});
return this;
},
writable: false,
configurable: false,
enumerable: false,
});
}