Revision control

1
<!DOCTYPE html>
2
<html>
3
<body onload="runTest()">
4
<script src="../resources/js-test.js"></script>
5
<script src="../resources/gc.js"></script>
6
<script>
7
description("This test asserts that Document doesn't leak when a Web Animation is created.");
8
9
if (window.internals) {
10
jsTestIsAsync = true;
11
12
window.onload = function () {
13
testDocumentIsNotLeaked(
14
async function initAndRemove(frameCount)
15
{
16
let frames = await new Promise((resolve, reject) => {
17
let frames = [];
18
let counter = 0;
19
function onLoad() {
20
counter++;
21
if (counter == frameCount)
22
resolve(frames);
23
}
24
for (let i = 0; i < frameCount; ++i) {
25
let frame = document.createElement('iframe');
26
frame.src = "resources/web-animation-leak-iframe.html";
27
frame.onload = onLoad;
28
document.body.appendChild(frame);
29
frames.push(frame);
30
}
31
});
32
debug("The iframe has finished loading.");
33
let frameIdentifiers = [];
34
for (let i = 0; i < frameCount; ++i) {
35
let frame = frames[i];
36
frameIdentifiers.push(internals.documentIdentifier(frame.contentDocument));
37
frame.remove();
38
}
39
nukeArray(frames);
40
frames = null;
41
return frameIdentifiers;
42
}
43
).then(
44
() => testPassed("The document was destroyed"),
45
(error) => testFailed(error.message)
46
).finally(finishJSTest);
47
};
48
}
49
50
</script>
51
</body>
52
</html>