Bug 256180 layout part - Increase MAX_REFLOW_DEPTH to reduce the probability of content going silently missing. r=bzbarsky.

MozReview-Commit-ID: 7Ui0tVlLEQM
This commit is contained in:
Henri Sivonen 2017-09-14 11:01:06 +03:00
parent 05fc2b8600
commit 39d84173d2
11 changed files with 347 additions and 1 deletions

View File

@ -13,7 +13,32 @@
#error This header/class should only be used within Mozilla code. It should not be used by extensions. #error This header/class should only be used within Mozilla code. It should not be used by extensions.
#endif #endif
#define MAX_REFLOW_DEPTH 200 #if (defined(XP_WIN) && !defined(HAVE_64BIT_BUILD)) || defined(ANDROID)
// Blink's magic depth limit from its HTML parser (513) plus as much as fits in the
// default run-time stack on armv7 Android on Dalvik when using display: block minus
// a bit just to be sure. The Dalvik default stack crashes at 588. ART can do a few
// frames more. Using the same number for 32-bit Windows for consistency. Over there,
// Blink's magic depth of 513 doesn't fit in the default stack of 1 MB, but this magic
// depth fits when the default is grown by mere 192 KB (tested in 64 KB increments).
//
// 32-bit Windows has a different limit compared to 64-bit desktop, because the
// default stack size affects all threads and consumes address space. Fixing that
// is bug 1257522.
//
// 32-bit Android on ARM already happens to have defaults that are close enough to
// what makes sense as a temporary measure on Windows, so adjusting the Android
// stack can be a follow-up. The stack on 64-bit ARM needs adjusting in any case
// before 64-bit ARM can become tier-1. See bug 1400811.
//
// Ideally, we'd get rid of this smaller limit and make 32-bit Windows and Android
// capable of working with the Linux/Mac/Win64 number below.
#define MAX_REFLOW_DEPTH 585
#else
// Blink's magic depth limit from its HTML parser times two. Also just about fits
// within the system default runtime stack limit of 8 MB on 64-bit Mac and Linux with
// display: table-cell.
#define MAX_REFLOW_DEPTH 1026
#endif
/* nsIFrame is in the process of being deCOMtaminated, i.e., this file is /* nsIFrame is in the process of being deCOMtaminated, i.e., this file is
eventually going to be eliminated, and all callers will use nsFrame instead. eventually going to be eliminated, and all callers will use nsFrame instead.

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>1026-deep display: table-cell</title>
</head>
<body>
<h1>1026-element-deep display: table-cell</h1>
<p>Actual depth (including text leaves): 1027
</body>
</html>

View File

@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>1026-element-deep display: table-cell</title>
<script>
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/
function count() {
var depth = 0;
var deepest = 0;
var current = document;
var next = null;
outer: for (;;) {
if ((next = current.firstChild)) {
depth++;
if (depth > deepest) {
deepest = depth;
}
current = next;
continue;
}
for (;;) {
if ((next = current.nextSibling)) {
current = next;
break;
}
current = current.parentNode;
depth--;
if (current == document) {
break outer;
}
}
}
var h1 = document.getElementsByTagName("h1")[0];
var p = document.createElement("p");
var t = document.createTextNode("Actual depth (including text leaves): " + deepest);
p.appendChild(t);
h1.parentNode.insertBefore(p, h1.nextSibling);
}
function deep() {
var t = document.createTextNode("PASS");
var div = document.createElement("div");
div.appendChild(t);
for (var i = 0; i < 1023; i++) {
var another = document.createElement("div");
another.appendChild(div);
div = another;
}
document.body.appendChild(div);
count();
}
window.addEventListener('DOMContentLoaded', deep, false);
</script>
<style>
div {
display: table-cell;
}
</style>
</head>
<body>
<h1>1026-element-deep display: table-cell</h1>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>585-deep display: table-cell</title>
</head>
<body>
<h1>585-element-deep display: table-cell</h1>
<p>Actual depth (including text leaves): 586
</body>
</html>

View File

@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>585-element-deep display: table-cell</title>
<script>
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/
function count() {
var depth = 0;
var deepest = 0;
var current = document;
var next = null;
outer: for (;;) {
if ((next = current.firstChild)) {
depth++;
if (depth > deepest) {
deepest = depth;
}
current = next;
continue;
}
for (;;) {
if ((next = current.nextSibling)) {
current = next;
break;
}
current = current.parentNode;
depth--;
if (current == document) {
break outer;
}
}
}
var h1 = document.getElementsByTagName("h1")[0];
var p = document.createElement("p");
var t = document.createTextNode("Actual depth (including text leaves): " + deepest);
p.appendChild(t);
h1.parentNode.insertBefore(p, h1.nextSibling);
}
function deep() {
var t = document.createTextNode("PASS");
var div = document.createElement("div");
div.appendChild(t);
for (var i = 0; i < 582; i++) {
var another = document.createElement("div");
another.appendChild(div);
div = another;
}
document.body.appendChild(div);
count();
}
window.addEventListener('DOMContentLoaded', deep, false);
</script>
<style>
div {
display: table-cell;
}
</style>
</head>
<body>
<h1>585-element-deep display: table-cell</h1>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>1026-deep display: block</title>
</head>
<body>
<h1>1026-element-deep display: block</h1>
<p>Actual depth (including text leaves): 1027
<div>PASS</div>
</body>
</html>

View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>1026-element-deep display: block</title>
<script>
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/
function count() {
var depth = 0;
var deepest = 0;
var current = document;
var next = null;
outer: for (;;) {
if ((next = current.firstChild)) {
depth++;
if (depth > deepest) {
deepest = depth;
}
current = next;
continue;
}
for (;;) {
if ((next = current.nextSibling)) {
current = next;
break;
}
current = current.parentNode;
depth--;
if (current == document) {
break outer;
}
}
}
var h1 = document.getElementsByTagName("h1")[0];
var p = document.createElement("p");
var t = document.createTextNode("Actual depth (including text leaves): " + deepest);
p.appendChild(t);
h1.parentNode.insertBefore(p, h1.nextSibling);
}
function deep() {
var t = document.createTextNode("PASS");
var div = document.createElement("div");
div.appendChild(t);
for (var i = 0; i < 1023; i++) {
var another = document.createElement("div");
another.appendChild(div);
div = another;
}
document.body.appendChild(div);
count();
}
window.addEventListener('DOMContentLoaded', deep, false);
</script>
</head>
<body>
<h1>1026-element-deep display: block</h1>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>585-deep display: block</title>
</head>
<body>
<h1>585-element-deep display: block</h1>
<p>Actual depth (including text leaves): 586
<div>PASS</div>
</body>
</html>

View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>585-element-deep display: block</title>
<script>
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/
function count() {
var depth = 0;
var deepest = 0;
var current = document;
var next = null;
outer: for (;;) {
if ((next = current.firstChild)) {
depth++;
if (depth > deepest) {
deepest = depth;
}
current = next;
continue;
}
for (;;) {
if ((next = current.nextSibling)) {
current = next;
break;
}
current = current.parentNode;
depth--;
if (current == document) {
break outer;
}
}
}
var h1 = document.getElementsByTagName("h1")[0];
var p = document.createElement("p");
var t = document.createTextNode("Actual depth (including text leaves): " + deepest);
p.appendChild(t);
h1.parentNode.insertBefore(p, h1.nextSibling);
}
function deep() {
var t = document.createTextNode("PASS");
var div = document.createElement("div");
div.appendChild(t);
for (var i = 0; i < 582; i++) {
var another = document.createElement("div");
another.appendChild(div);
div = another;
}
document.body.appendChild(div);
count();
}
window.addEventListener('DOMContentLoaded', deep, false);
</script>
</head>
<body>
<h1>585-element-deep display: block</h1>
</body>
</html>

View File

@ -38,6 +38,17 @@
== 23604-1.html 23604-1-ref.html == 23604-1.html 23604-1-ref.html
== 23604-2.html 23604-2-ref.html == 23604-2.html 23604-2-ref.html
!= 24998-1.html 24998-1-ref.html != 24998-1.html 24998-1-ref.html
# Debug builds and ASAN builds have larger stack frames, so skipped.
# 32-bit Windows doesn't have enough run-time stack to deal with the test, so skipped.
skip-if(isDebugBuild||AddressSanitizer||(winWidget&&(!is64Bit))) == 256180-1.html 256180-1-ref.html
# Debug builds have larger stack frames, so skipped.
# 32-bit Windows doesn't have enough run-time stack to deal with the test, so skipped.
skip-if(isDebugBuild||(winWidget&&(!is64Bit))) == 256180-2.html 256180-2-ref.html
# Debug builds and ASAN builds have larger stack frames, so skipped.
# 32-bit Windows doesn't have enough run-time stack to deal with the test, so skipped.
skip-if(isDebugBuild||AddressSanitizer||(winWidget&&(!is64Bit))) == 256180-3.html 256180-3-ref.html
# Debug builds have larger stack frames, so skipped.
skip-if(isDebugBuild) == 256180-4.html 256180-4-ref.html
== 25888-1l.html 25888-1l-ref.html == 25888-1l.html 25888-1l-ref.html
!= 25888-1l.html 25888-1l-notref.html != 25888-1l.html 25888-1l-notref.html
== 25888-1r.html 25888-1r-ref.html == 25888-1r.html 25888-1r-ref.html

View File

@ -463,6 +463,8 @@ function BuildConditionSandbox(aURL) {
sandbox.qtWidget = xr.widgetToolkit == "qt"; sandbox.qtWidget = xr.widgetToolkit == "qt";
sandbox.winWidget = xr.widgetToolkit == "windows"; sandbox.winWidget = xr.widgetToolkit == "windows";
sandbox.is64Bit = xr.is64Bit;
// Scrollbars that are semi-transparent. See bug 1169666. // Scrollbars that are semi-transparent. See bug 1169666.
sandbox.transparentScrollbars = xr.widgetToolkit == "gtk3"; sandbox.transparentScrollbars = xr.widgetToolkit == "gtk3";