зеркало из https://github.com/mozilla/gecko-dev.git
64 строки
1.6 KiB
HTML
64 строки
1.6 KiB
HTML
|
<!DOCTYPE HTML>
|
||
|
<html>
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title>Test for Bug 1399603</title>
|
||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||
|
</head>
|
||
|
<body>
|
||
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1399603">Mozilla Bug 1399603</a>
|
||
|
<p id="display"></p>
|
||
|
<div id="content">
|
||
|
<div id="root">
|
||
|
<div id="target"></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<pre id="test">
|
||
|
<script type="application/javascript">
|
||
|
|
||
|
function waitForNotification(f) {
|
||
|
requestAnimationFrame(function() {
|
||
|
setTimeout(function() { setTimeout(f); });
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function forceGC() {
|
||
|
SpecialPowers.gc();
|
||
|
SpecialPowers.forceShrinkingGC();
|
||
|
SpecialPowers.forceCC();
|
||
|
SpecialPowers.gc();
|
||
|
SpecialPowers.forceShrinkingGC();
|
||
|
SpecialPowers.forceCC();
|
||
|
}
|
||
|
|
||
|
let content = document.getElementById('content');
|
||
|
let root = document.getElementById('root');
|
||
|
let target = document.getElementById('target');
|
||
|
let entries = [];
|
||
|
let observer = new IntersectionObserver(function(changes) {
|
||
|
entries = entries.concat(changes);
|
||
|
}, { root: root });
|
||
|
observer.observe(target);
|
||
|
|
||
|
waitForNotification(function () {
|
||
|
is(entries.length, 1, "Initial notification.");
|
||
|
root.removeChild(target);
|
||
|
content.removeChild(root);
|
||
|
root = null;
|
||
|
forceGC();
|
||
|
waitForNotification(function () {
|
||
|
is(entries.length, 1, "No new notifications.");
|
||
|
SimpleTest.finish();
|
||
|
});
|
||
|
});
|
||
|
|
||
|
SimpleTest.waitForExplicitFinish();
|
||
|
|
||
|
</script>
|
||
|
</pre>
|
||
|
<div id="log">
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|