fix: proxy Node.getRootNode

This commit is contained in:
Percs 2024-10-14 12:17:37 -05:00
parent a2af4d7f3b
commit ee85b48d33
7 changed files with 13 additions and 4 deletions

View file

@ -36,7 +36,7 @@ mkdir dist/ || true
{ {
cat <<EOF cat <<EOF
if ("document" in self && document.currentScript) { if ("document" in self && document?.currentScript) {
document.currentScript.remove(); document.currentScript.remove();
} }
EOF EOF

View file

@ -306,6 +306,7 @@ export default function (client: ScramjetClient, self: typeof window) {
"Node.prototype.parentElement", "Node.prototype.parentElement",
"Node.prototype.previousSibling", "Node.prototype.previousSibling",
"Node.prototype.nextSibling", "Node.prototype.nextSibling",
"Node.prototype.getRootNode",
], ],
{ {
get(ctx) { get(ctx) {

View file

@ -38,6 +38,6 @@ if (!(SCRAMJETCLIENT in <Partial<typeof self>>self)) {
client.frame?.dispatchEvent(ev); client.frame?.dispatchEvent(ev);
} }
if ("document" in self && document.currentScript) { if ("document" in self && document?.currentScript) {
document.currentScript.remove(); document.currentScript.remove();
} }

View file

@ -63,6 +63,11 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
if (typeof v === "string" && v.includes("scramjet")) { if (typeof v === "string" && v.includes("scramjet")) {
debugger; debugger;
} }
if (typeof v === "string" && v.includes(location.origin)) {
debugger;
}
if (iswindow && v instanceof Document && v.defaultView.$scramjet) { if (iswindow && v instanceof Document && v.defaultView.$scramjet) {
debugger; debugger;
} }

View file

@ -43,6 +43,6 @@ $scramjet.shared = {
CookieStore, CookieStore,
}; };
if ("document" in self && document.currentScript) { if ("document" in self && document?.currentScript) {
document.currentScript.remove(); document.currentScript.remove();
} }

View file

@ -45,7 +45,7 @@ export function rewriteHtml(
const injected = ` const injected = `
self.COOKIE = ${dump}; self.COOKIE = ${dump};
self.$scramjet.config = ${JSON.stringify($scramjet.config)}; self.$scramjet.config = ${JSON.stringify($scramjet.config)};
if ("document" in self && document.currentScript) { if ("document" in self && document?.currentScript) {
document.currentScript.remove(); document.currentScript.remove();
} }
`; `;

View file

@ -10,6 +10,9 @@ const scramjet = new ScramjetController({
"https://discord.com/.*": { "https://discord.com/.*": {
naiiveRewriter: true, naiiveRewriter: true,
}, },
"https://worker-playground.glitch.me/.*": {
serviceworkers: true,
},
}, },
}); });