proxy Element.prototype.insertAdjacentHTML, rust docs work perfectly now.

This commit is contained in:
wearrrrr 2024-10-17 19:49:35 -05:00
parent 6705d0ba2b
commit a748053085
2 changed files with 16 additions and 4 deletions

View file

@ -237,6 +237,18 @@ export default function (client: ScramjetClient, self: typeof window) {
}, },
}); });
client.Proxy("Element.prototype.insertAdjacentHTML", {
apply(ctx) {
if (ctx.args[1])
ctx.args[1] = rewriteHtml(
ctx.args[1],
client.cookieStore,
client.meta,
true
);
},
})
client.Trap("HTMLIFrameElement.prototype.contentWindow", { client.Trap("HTMLIFrameElement.prototype.contentWindow", {
get(ctx) { get(ctx) {
const realwin = ctx.get() as Window; const realwin = ctx.get() as Window;

View file

@ -280,11 +280,11 @@ export function rewriteSrcset(srcset: string, meta: URLMeta) {
return rewrittenUrls.join(""); return rewrittenUrls.join("");
} }
function _base64ToBytes(base64) { // function base64ToBytes(base64) {
const binString = atob(base64); // const binString = atob(base64);
return Uint8Array.from(binString, (m) => m.codePointAt(0)); // return Uint8Array.from(binString, (m) => m.codePointAt(0));
} // }
function bytesToBase64(bytes: Uint8Array) { function bytesToBase64(bytes: Uint8Array) {
const binString = Array.from(bytes, (byte) => const binString = Array.from(bytes, (byte) =>