diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-24 08:29:43 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-24 08:29:43 +0200 |
commit | 2e2ba8ff45915f40ed3e014101269c175f2a89a0 (patch) | |
tree | 3b94a9a9fa83efa384b8dac611cf8c6495532a62 /ManualTests/input-starved-by-timers.html | |
parent | f53e6f8e798362ed712d4a51633b0d0b03dbc213 (diff) | |
download | qtwebkit-2e2ba8ff45915f40ed3e014101269c175f2a89a0.tar.gz |
Imported WebKit commit bf0b0213bbf3886c96610020602012ca7d11b084 (http://svn.webkit.org/repository/webkit/trunk@126545)
New snapshot with clang and python build fixes
Diffstat (limited to 'ManualTests/input-starved-by-timers.html')
-rw-r--r-- | ManualTests/input-starved-by-timers.html | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ManualTests/input-starved-by-timers.html b/ManualTests/input-starved-by-timers.html new file mode 100644 index 000000000..f26cfa7b9 --- /dev/null +++ b/ManualTests/input-starved-by-timers.html @@ -0,0 +1,51 @@ +<html> +<head> +<script> +function log(m) { + document.getElementById("log").innerHTML += m + "<br>"; +} + +var multiplyFactor = 2; // Create this many timers in every timer callback. +var targetLatency = 10000; // Multiply timers until it takes this much to fire all their callbacks. +var timerCount = 1; + +function timerCallback(creationTimestamp) { + --timerCount; + + if (!multiplyFactor) { + if (timerCount == 0) + log("No more timers - UI should be responsive now."); + return; + } + + // Create more timers. Capture the current time so when callbacks are fired, + // we can check how long it actually took (latency caused by a long timer queue). + var timestamp = new Date().getTime(); + for (i = 0; i < multiplyFactor; ++i) { + setTimeout(function() { timerCallback(timestamp); }, 0); + ++timerCount; + } + + // Once the timer queue gets long enough for the timer firing latency to be over the limit, + // stop multplying them and keep the number of timers constant. + if (multiplyFactor > 1 && new Date().getTime() - creationTimestamp > targetLatency) + multiplyFactor = 1; +} + +function runTest() { + log("Freezing UI..."); + setTimeout(function() { timerCallback(new Date().getTime()); }, 0); + setTimeout("multiplyFactor = 0; log('Finishing. Started to drain timers.');", 10000); +} + +</script> +</head> +<body onload="runTest()"> +This test will create enough timers to freeze browser UI. After 10 seconds, it +will start drain the timers so the UI becomes responsive again in a few seconds. +You don't need to kill the browser.<br>If the bug is fixed, there will be no +UI freeze. Refresh the page to repeat the experiment.<br>Try to click at this +button (or browser's menu) while UI is frozen: <button onclick="log('clicked')">Click Me</button> <hr> +<div id="log"></div> +</body> +</html> |