Bug 1330375 - P4: GetInnerText perf regression test. r=heycam

Mochitest to ensure that that zero reflows occur while iterating table
calling innerText and setting `display:none`.

MozReview-Commit-ID: K5vrsj3ogWy

--HG--
extra : rebase_source : 61ceacc5133db6a558a4e8b80f72f18a7195d153
This commit is contained in:
Dan Glastonbury 2018-07-19 17:34:48 +10:00
Родитель 04130fc7b4
Коммит 5ba8f2364f
2 изменённых файлов: 60 добавлений и 0 удалений

Просмотреть файл

@ -152,6 +152,7 @@ support-files = file_bug1089417_iframe.html
[test_bug1203766.html]
[test_bug1232829.html]
[test_bug1292447.html]
[test_bug1330375.html]
[test_bug1371488.html]
[test_bug1375944.html]
support-files = file_bug1375944.html Ahem.ttf

Просмотреть файл

@ -0,0 +1,59 @@
<!DOCTYPE html>
<!-- https://bugzil.la/1330375 -->
<meta charset="utf-8">
<title>Test for Bug 1330375</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest.css"/>
<body>
<div id="content">
<table>
<tbody>
<tr><td>lorem ipsum</td><td>dolor sit</td><td>amet</td><td>consectetur adipsicing</td><td>elit.</td></tr>
<tr><td>lorem ipsum</td><td>dolor sit</td><td>amet</td><td>consectetur adipsicing</td><td>elit.</td></tr>
<tr><td>lorem ipsum</td><td>dolor sit</td><td>amet</td><td>consectetur adipsicing</td><td>elit.</td></tr>
<tr><td>lorem ipsum</td><td>dolor sit</td><td>amet</td><td>consectetur adipsicing</td><td>elit.</td></tr>
<tr><td>lorem ipsum</td><td>dolor sit</td><td>amet</td><td>consectetur adipsicing</td><td>elit.</td></tr>
<tr><td>lorem ipsum</td><td>dolor sit</td><td>amet</td><td>consectetur adipsicing</td><td>elit.</td></tr>
<tr><td>lorem ipsum</td><td>dolor sit</td><td>amet</td><td>consectetur adipsicing</td><td>elit.</td></tr>
<tr><td>lorem ipsum</td><td>dolor sit</td><td>amet</td><td>consectetur adipsicing</td><td>elit.</td></tr>
<tr><td>lorem ipsum</td><td>dolor sit</td><td>amet</td><td>consectetur adipsicing</td><td>elit.</td></tr>
<tr><td>lorem ipsum</td><td>dolor sit</td><td>amet</td><td>consectetur adipsicing</td><td>elit.</td></tr>
</tbody>
</table>
</div>
</body>
<script>
"use strict";
const gUtils = SpecialPowers.getDOMWindowUtils(window);
function flush_layout(element) {
(element || document.documentElement).offsetHeight;
}
SimpleTest.waitForExplicitFinish();
window.onload = function() {
flush_layout(document.getElementById("content"));
let before = {
framesConstructed: gUtils.framesConstructed,
framesReflowed: gUtils.framesReflowed,
};
// Begin test
let rows = document.getElementsByTagName("tr");
for (var r = 0; r < rows.length; r++) {
let row = rows[r];
row.innerText;
// Cause potential invalidation of layout:
row.style.display = "none";
}
is(gUtils.framesConstructed, before.framesConstructed, "Frames constructed should be 0");
is(gUtils.framesReflowed, before.framesReflowed, "Frames reflowed should be 0");
SimpleTest.finish();
}
</script>