Skip to content

Commit f1e99ab

Browse files
committed
[core] delete iframe sandbox
1 parent 9761d35 commit f1e99ab

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/client/dom/element.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,18 @@ export default function (client: ScramjetClient, self: typeof window) {
178178
});
179179

180180
if (ruleList) {
181-
ctx.args[1] = ruleList.fn(value, client.meta, client.cookieStore);
181+
const ret = ruleList.fn(value, client.meta, client.cookieStore);
182+
if (ret == null) {
183+
client.natives.call(
184+
"Element.prototype.removeAttribute",
185+
ctx.this,
186+
name
187+
);
188+
ctx.return(undefined);
189+
190+
return;
191+
}
192+
ctx.args[1] = ret;
182193
ctx.fn.call(ctx.this, `scramjet-attr-${ctx.args[0]}`, value);
183194
}
184195
},

src/shared/htmlRules.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ export const htmlRules: {
3131
},
3232
src: ["iframe"],
3333
},
34+
{
35+
// is this a good idea?
36+
fn: (value: string, meta: URLMeta) => {
37+
return null;
38+
},
39+
sandbox: ["iframe"],
40+
},
3441
{
3542
fn: (value: string, meta: URLMeta) => {
3643
if (value.startsWith("blob:")) {

0 commit comments

Comments
 (0)