mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 06:50:01 -04:00
fix: try catch most instances of rewriteHTML
This commit is contained in:
parent
c9c98bc70e
commit
d6b3fcda4c
2 changed files with 32 additions and 24 deletions
|
@ -5,24 +5,28 @@ export default function (client: ScramjetClient, self: typeof window) {
|
||||||
client.Proxy("Document.prototype.write", {
|
client.Proxy("Document.prototype.write", {
|
||||||
apply(ctx) {
|
apply(ctx) {
|
||||||
if (ctx.args[0])
|
if (ctx.args[0])
|
||||||
ctx.args[0] = rewriteHtml(
|
try {
|
||||||
ctx.args[0],
|
ctx.args[0] = rewriteHtml(
|
||||||
client.cookieStore,
|
ctx.args[0],
|
||||||
client.meta,
|
client.cookieStore,
|
||||||
false
|
client.meta,
|
||||||
);
|
false
|
||||||
|
);
|
||||||
|
} catch {}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
client.Proxy("Document.prototype.writeln", {
|
client.Proxy("Document.prototype.writeln", {
|
||||||
apply(ctx) {
|
apply(ctx) {
|
||||||
if (ctx.args[0])
|
if (ctx.args[0])
|
||||||
ctx.args[0] = rewriteHtml(
|
try {
|
||||||
ctx.args[0],
|
ctx.args[0] = rewriteHtml(
|
||||||
client.cookieStore,
|
ctx.args[0],
|
||||||
client.meta,
|
client.cookieStore,
|
||||||
false
|
client.meta,
|
||||||
);
|
false
|
||||||
|
);
|
||||||
|
} catch {}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,12 +220,14 @@ export default function (client: ScramjetClient, self: typeof window) {
|
||||||
client.Proxy("Element.prototype.insertAdjacentHTML", {
|
client.Proxy("Element.prototype.insertAdjacentHTML", {
|
||||||
apply(ctx) {
|
apply(ctx) {
|
||||||
if (ctx.args[1])
|
if (ctx.args[1])
|
||||||
ctx.args[1] = rewriteHtml(
|
try {
|
||||||
ctx.args[1],
|
ctx.args[1] = rewriteHtml(
|
||||||
client.cookieStore,
|
ctx.args[1],
|
||||||
client.meta,
|
client.cookieStore,
|
||||||
false
|
client.meta,
|
||||||
);
|
false
|
||||||
|
);
|
||||||
|
} catch {}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -327,12 +329,14 @@ export default function (client: ScramjetClient, self: typeof window) {
|
||||||
client.Proxy("DOMParser.prototype.parseFromString", {
|
client.Proxy("DOMParser.prototype.parseFromString", {
|
||||||
apply(ctx) {
|
apply(ctx) {
|
||||||
if (ctx.args[1] === "text/html") {
|
if (ctx.args[1] === "text/html") {
|
||||||
ctx.args[0] = rewriteHtml(
|
try {
|
||||||
ctx.args[0],
|
ctx.args[0] = rewriteHtml(
|
||||||
client.cookieStore,
|
ctx.args[0],
|
||||||
client.meta,
|
client.cookieStore,
|
||||||
false
|
client.meta,
|
||||||
);
|
false
|
||||||
|
);
|
||||||
|
} catch {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue