зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1816233 - Clean up content-visibility-031.html. r=surkov
This makes assert failures getting reported properly rather than as uncaught exceptions. No behavior change otherwise. Differential Revision: https://phabricator.services.mozilla.com/D169543
This commit is contained in:
Родитель
761c7cd973
Коммит
cda7130279
|
@ -20,10 +20,10 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
||||
<script>
|
||||
async_test((t) => {
|
||||
async_test(t => {
|
||||
let didCallback = false;
|
||||
|
||||
async function runTest() {
|
||||
function runTest() {
|
||||
let resizeCallback = function (entries) {
|
||||
didCallback = true;
|
||||
}
|
||||
|
@ -31,11 +31,11 @@ async_test((t) => {
|
|||
|
||||
resizeObserver.observe(resize);
|
||||
|
||||
requestAnimationFrame(step2);
|
||||
requestAnimationFrame(t.step_func(step2));
|
||||
}
|
||||
|
||||
async function step2() {
|
||||
assert_equals(true, didCallback, 'Resize observation should happen in first frame after registering');
|
||||
function step2() {
|
||||
assert_true(didCallback, 'Resize observation should happen in first frame after registering');
|
||||
didCallback = false;
|
||||
|
||||
const container = document.getElementById("container");
|
||||
|
@ -45,31 +45,27 @@ async_test((t) => {
|
|||
// only when the element becomes unhidden.
|
||||
resize.style.width = '100px';
|
||||
|
||||
requestAnimationFrame(step3);
|
||||
requestAnimationFrame(t.step_func(step3));
|
||||
}
|
||||
|
||||
async function step3() {
|
||||
assert_equals(false, didCallback,
|
||||
'ResizeObsever should not run during while unrendered');
|
||||
requestAnimationFrame(step4);
|
||||
function step3() {
|
||||
assert_false(didCallback, 'ResizeObsever should not run during while unrendered');
|
||||
requestAnimationFrame(t.step_func(step4));
|
||||
}
|
||||
|
||||
async function step4() {
|
||||
assert_equals(false, didCallback,
|
||||
'ResizeObsever should not run while unrendered');
|
||||
function step4() {
|
||||
assert_false(didCallback, 'ResizeObsever should not run while unrendered');
|
||||
const container = document.getElementById("container");
|
||||
container.classList.remove("hidden");
|
||||
requestAnimationFrame(step5);
|
||||
requestAnimationFrame(t.step_func_done(step5));
|
||||
}
|
||||
|
||||
async function step5() {
|
||||
assert_equals(true, didCallback,
|
||||
'ResizeObsevers should now run once becoming visible');
|
||||
t.done();
|
||||
function step5() {
|
||||
assert_true(didCallback, 'ResizeObsevers should now run once becoming visible');
|
||||
}
|
||||
|
||||
window.onload = function() {
|
||||
requestAnimationFrame(() => requestAnimationFrame(runTest));
|
||||
requestAnimationFrame(() => requestAnimationFrame(t.step_func(runTest)));
|
||||
};
|
||||
}, "ResizeObserver skipped while hidden");
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче