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.
This commit is contained in:
Raymond Hill 2020-07-17 16:03:49 -04:00
parent 6516834051
commit 3e55ffff13
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
<!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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 KiB