diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /browser/components/resistfingerprinting/test/browser/file_animationapi_iframee.html | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/resistfingerprinting/test/browser/file_animationapi_iframee.html')
-rw-r--r-- | browser/components/resistfingerprinting/test/browser/file_animationapi_iframee.html | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/browser/components/resistfingerprinting/test/browser/file_animationapi_iframee.html b/browser/components/resistfingerprinting/test/browser/file_animationapi_iframee.html new file mode 100644 index 0000000000..da86656bd4 --- /dev/null +++ b/browser/components/resistfingerprinting/test/browser/file_animationapi_iframee.html @@ -0,0 +1,85 @@ +<!DOCTYPE html> +<head> +<meta charset="utf8"> +<script> +function waitForCondition(aCond, aCallback, aErrorMsg) { + var tries = 0; + var interval = setInterval(() => { + if (tries >= 30) { + result.push({ + 'error': `Exceeded 30 tries waiting for animation` + }) + clearInterval(interval); + parent.postMessage(result, "*"); + return; + } + + var conditionPassed; + try { + conditionPassed = aCond(); + } catch (e) { + result.push({ + 'error': `${e}\n${e.stack}` + }) + clearInterval(interval); + parent.postMessage(result, "*") + return; + } + + if (conditionPassed) { + clearInterval(interval); + aCallback(); + } + + tries++; + }, 100); + } + +window.onload = async () => { + parent.postMessage("ready", "*"); +} + +var result = []; + +window.addEventListener("message", async function listener(event) { + if (event.data[0] == "gimme") { + + const testDiv = document.getElementById("testDiv"); + const animation = testDiv.animate({ opacity: [0, 1] }, 100000); + animation.play(); + + waitForCondition( + () => animation.currentTime > 100, + () => { + + result.push({ + 'name': 'animation.startTime', + 'value': animation.startTime + }); + result.push({ + 'name': 'animation.currentTime', + 'value': animation.currentTime + }); + result.push({ + 'name': 'animation.timeline.currentTime', + 'value': animation.timeline.currentTime + }); + + if (document.timeline) { + result.push({ + 'name': 'document.timeline.currentTime', + 'value': document.timeline.currentTime + }); + } + + parent.postMessage(result, "*") + }, + "animation failed to start"); + } +}); +</script> +</head> +<body> +<div id="testDiv">test</div> +</body> +</html> |