// XXX: We can consolidate this once bug 1930955 lands // eslint-disable-next-line no-unused-vars const perfMetadata = {
owner: "Accessibility Team",
name: "browser_bounds.js",
description: "Audit a11y performance when computing bounds for a framed (non-display:contents) accessible with 10000 children. Baseline counterpart to browser_displayContentsBounds.js.",
options: { default: {
extra_args: ["headless"],
manifest: "perftest.toml",
manifest_flavor: "browser-chrome",
perfherder: true,
perfherder_metrics: [ // Total time for the entire run (this probe is not process specific)
{ name: "A11Y_TotalTime", unit: "ms", shouldAlert: true },
addAccessibleTask(
`<div id="container" role="group" style="display:none;"></div>`,
async function testBounds(browser, accDoc) {
info("Adding 10000 children to framed container"); const containerShown = waitForEvent(EVENT_SHOW, "container"); // We add the nodes to the container while it is hidden to // ensure we produce a single show event rather than 10000. // This makes the perf comparison more straightforward, i.e. // the perf cost of this test isn't drowned out by the show event cost.
await invokeContentTask(browser, [], () => { const container = content.document.getElementById("container"); for (let c = 0; c < 10000; ++c) { const child = content.document.createElement("div");
child.textContent = c;
container.append(child);
}
container.style.removeProperty("display");
});
await containerShown;
info("Container shown, starting bounds measurement");
const container = findAccessibleChildByID(accDoc, "container");
await timeThis(async () => { const x = {}; const y = {}; const w = {}; const h = {}; for (let i = 0; i < 100; i++) { // Query bounds on the container to exercise the child traversal // Do this 100 times to exacerbate the effect :)
container.getBounds(x, y, w, h);
}
});
}
);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.