Convert node serialization to a purely iterative algorithm.

We maintain a stack of open element nodes and non-node elements and use it to determine when to close them.
This commit is contained in:
Austin Hicks 2017-06-25 15:28:46 -04:00
parent 2bb4f65100
commit 033b31979b
3 changed files with 161 additions and 65 deletions

View file

@ -13737,6 +13737,12 @@
{}
]
],
"mozilla/deep_serialization_succeeds.html": [
[
"/_mozilla/mozilla/deep_serialization_succeeds.html",
{}
]
],
"mozilla/deterministic-raf.html": [
[
"/_mozilla/mozilla/deterministic-raf.html",
@ -26886,6 +26892,10 @@
"67d8cdd3e3a1656ba315fcbf6dae7236680bac16",
"reftest"
],
"mozilla/deep_serialization_succeeds.html": [
"cb3d201d577c17d19babf1f6c04ba882fa42048e",
"testharness"
],
"mozilla/details_ui_closed.html": [
"2acbe3afbec267bad4dd986803e636740a707507",
"reftest"

View file

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>Deep Serialization Test</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<div id="log"></div>
<script>
// The test here is that Servo doesn't crash.
test(function() {
var first = document.createElement('div');
var last = first;
for (var i = 0; i < 3000; i++) {
var e = document.createElement('div');
last.appendChild(e);
last = e;
}
last.textContent = "abcdef";
var elem = first;
assert_regexp_match(elem.outerHTML, /abcdef/);
}, "Test that deep trees can serialize without crashing.");
</script>
</body>
</html>