зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1472024 part 1: Check for & gracefully handle failure return values from HTMLTableCellAccessible::GetCellIndexes. r=eeejay
HTMLTableCellAccessible::GetCellIndexes can fail via its NS_ENSURE_STATE macro, and this patch updates its callsites to account for that possibility. In each case, I've just copied the existing graceful-fallback behavior that the surrounding code uses for other unexpected conditions. Note that I'm intentionally not using NS_ENSURE_SUCCESS in my error-handling here, to avoid redundant warning-spam. (In the failure scenario, GetCellIndexes will already have spammed a warning, via its own aforementioned NS_ENSURE_STATE call; it's usually not useful to repeat the warning in the caller.) Differential Revision: https://phabricator.services.mozilla.com/D155123
This commit is contained in:
Родитель
13d8c567da
Коммит
90e860f7bd
|
@ -171,7 +171,9 @@ uint32_t HTMLTableCellAccessible::RowIdx() const {
|
|||
|
||||
uint32_t HTMLTableCellAccessible::ColExtent() const {
|
||||
int32_t rowIdx = -1, colIdx = -1;
|
||||
GetCellIndexes(rowIdx, colIdx);
|
||||
if (NS_FAILED(GetCellIndexes(rowIdx, colIdx))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
TableAccessible* table = Table();
|
||||
NS_ASSERTION(table, "cell not in a table!");
|
||||
|
@ -182,7 +184,9 @@ uint32_t HTMLTableCellAccessible::ColExtent() const {
|
|||
|
||||
uint32_t HTMLTableCellAccessible::RowExtent() const {
|
||||
int32_t rowIdx = -1, colIdx = -1;
|
||||
GetCellIndexes(rowIdx, colIdx);
|
||||
if (NS_FAILED(GetCellIndexes(rowIdx, colIdx))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
TableAccessible* table = Table();
|
||||
NS_ASSERTION(table, "cell not in atable!");
|
||||
|
@ -231,7 +235,9 @@ void HTMLTableCellAccessible::RowHeaderCells(nsTArray<Accessible*>* aCells) {
|
|||
|
||||
bool HTMLTableCellAccessible::Selected() {
|
||||
int32_t rowIdx = -1, colIdx = -1;
|
||||
GetCellIndexes(rowIdx, colIdx);
|
||||
if (NS_FAILED(GetCellIndexes(rowIdx, colIdx))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TableAccessible* table = Table();
|
||||
NS_ENSURE_TRUE(table, false);
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<style>
|
||||
.a { position: absolute }
|
||||
</style>
|
||||
<table>
|
||||
<tbody class="a">
|
||||
<tr>b</tr>
|
||||
<th>
|
|
@ -0,0 +1,20 @@
|
|||
<html class="reftest-wait">
|
||||
<script>
|
||||
function tweak() {
|
||||
document.getElementById('a').appendChild(document.createTextNode('hZ'));
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
// double-rAF (to ensure layout/paints have been flushed) before we make
|
||||
// the dynamic modification. This seems to make the bug more likely to
|
||||
// reproduce, in unpatched builds.
|
||||
requestAnimationFrame(() => { requestAnimationFrame(() => {
|
||||
tweak();
|
||||
}); });
|
||||
};
|
||||
</script>
|
||||
<table>
|
||||
<tfoot id='a'>
|
||||
<th>
|
||||
<textarea>Text
|
|
@ -9,6 +9,8 @@ load 1072792.xhtml
|
|||
load 1380199.html
|
||||
load 1402999.html
|
||||
load 1463962.html
|
||||
load 1472024-1.html
|
||||
load 1472024-2.html
|
||||
load 1484778.html
|
||||
load 1494707.html
|
||||
load 1503964.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче