mirror of
https://github.com/servo/servo.git
synced 2025-09-18 19:08:22 +01:00
Root nodes for the duration of their CSS transitions.
This ensures that we can pass a node address as part of the asynchronous transition end notification, making it safe to fire the corresponding DOM event on the node from the script thread. Without explicitly rooting this node when the transition starts, we risk the node being GCed before the transition is complete.
This commit is contained in:
parent
f3c8f7e0d0
commit
dabebdfbf5
11 changed files with 126 additions and 25 deletions
|
@ -19897,6 +19897,12 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/transitionend_safety.html": [
|
||||
[
|
||||
"/_mozilla/mozilla/transitionend_safety.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"mozilla/union.html": [
|
||||
[
|
||||
"/_mozilla/mozilla/union.html",
|
||||
|
@ -31544,6 +31550,10 @@
|
|||
"38d8991444d05c40f1d0168bfce8472e378b603c",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/transitionend_safety.html": [
|
||||
"778e43b049aa421bad7f86eb03d0955576a84ce0",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/union.html": [
|
||||
"47ee847e660eb907a7bd916cf37cf3ceba68ea7d",
|
||||
"testharness"
|
||||
|
|
27
tests/wpt/mozilla/tests/mozilla/transitionend_safety.html
Normal file
27
tests/wpt/mozilla/tests/mozilla/transitionend_safety.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>Asynchronous transitionend event is not a GC hazard</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
var elem = document.createElement('div');
|
||||
document.body.appendChild(elem);
|
||||
elem.textContent = 'hi there';
|
||||
elem.style.transition = 'color 10ms';
|
||||
elem.style.color = 'black';
|
||||
elem.ontransitionend = t.step_func_done();
|
||||
|
||||
t.step_timeout(function() {
|
||||
elem.style.color = 'red';
|
||||
|
||||
t.step_timeout(function() {
|
||||
document.body.removeChild(elem);
|
||||
elem = null;
|
||||
window.gc();
|
||||
}, 0);
|
||||
}, 0);
|
||||
}, 'Nodes cannot be GCed while a CSS transition is in effect.');
|
||||
</script>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue