uBlock/docs/tests/infinite-iframe-creation.html
Raymond Hill 3e55ffff13
Add infinite iframe-creation test
Location:
https://gorhill.github.io/uBlock/tests/infinite-iframe-creation.html

The test is useful to ensure no runaway memory consumption
in uBO's main process, and is also useful as rough performance
assessment, i.e. we want uBO's main process to be low CPU, etc.

Useful to use with Chromium's Task Manager, which reports both
memory and CPU usage.

Typically to be used with uBO with default settings/lists.
2020-07-17 16:03:49 -04:00

39 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>Infinite iframe creation</title>
</head>
<body>
<h1>Infinite iframe creation</h1>
<div style="display:flex;flex-wrap:wrap;">
<div class="iframeContainer"></div>
<div class="iframeContainer"></div>
<div class="iframeContainer"></div>
<div class="iframeContainer"></div>
</div>
<script>
let containers = document.querySelectorAll('.iframeContainer');
let iContainer = 0;
function randomStr(size) {
const part = Math.random().toString().slice(2);
return part.repeat((size + part.length - 1) / part.length);
}
function createFrame() {
iContainer += 1;
const i = iContainer % containers.length;
const container = containers[i];
if ( container.firstElementChild !== null ) {
container.firstElementChild.remove();
}
const iframe = document.createElement('iframe');
iframe.src = 'plagiomnium_affine_laminazellen.jpeg?_=' + randomStr(10000);
container.appendChild(iframe);
setTimeout(( ) => {
createFrame();
}, 333);
}
createFrame();
</script>
<div><a href="https://commons.wikimedia.org/wiki/File:Plagiomnium_affine_laminazellen.jpeg">Image from commons.wikimedia.org</a></div>
</body>
</html>