Badge updates do not trigger excessive background CPU usage
Why it matters
Badge update calls fired on every high-frequency browser event — webRequest.onCompleted, tabs.onUpdated, or sub-5-second polling — create continuous background CPU load even when the user is doing nothing extension-related. ISO 25010:2011 performance-efficiency.resource-utilisation treats unnecessary background CPU consumption as a defect. On laptops, this translates directly to battery drain; on lower-end hardware it causes system-wide slowdown. Chrome surfaces extensions that abuse background resources in its Task Manager, leading to removal.
Severity rationale
Medium because unbounded badge update frequency drains battery and CPU continuously, but the impact is gradual and not immediately catastrophic.
Remediation
Debounce badge updates so high-frequency trigger events coalesce into at most one update per 500ms, and skip the setBadgeText call entirely when the value has not changed.
let currentBadgeText = '';
let badgeUpdateTimer = null;
function scheduleBadgeUpdate() {
clearTimeout(badgeUpdateTimer);
badgeUpdateTimer = setTimeout(async () => {
const count = await computeCount();
const newText = count > 0 ? String(count) : '';
if (newText !== currentBadgeText) {
currentBadgeText = newText;
chrome.action.setBadgeText({ text: newText });
}
}, 500);
}
For polling patterns, use chrome.alarms with a minimum 30-second interval and add idle detection via chrome.idle to pause updates when the system is idle.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Extension UX & Performance Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · performance-efficiency.resource-utilization
Taxons
History
- 2026-04-18·v1.0.0·Initial import from extension-ux-performance·automated