Skip to content

Commit a4b2a3d

Browse files
committed
fix: drop jQuery from clients dashboard, fail fast on vanished click targets
clients.html: vanilla DOM + URLSearchParams (jQuery CDN removed), poll backoff while the server is unreachable, inline errors instead of alert(), two-click confirm for close, revoke stale screenshot blob URLs, and only re-render tables when displayed data changes so DOM identity stays stable for automation targeting the page. extension: _elementPosition returns null instead of throwing when the element was removed mid-command, and the click/hover flow turns that into an immediate CLICK_FAILED instead of hanging into a 5s timeout.
1 parent 824aee7 commit a4b2a3d

3 files changed

Lines changed: 250 additions & 166 deletions

File tree

extension/modules/background-click.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ export async function hover(tab, { selector, xpath }, click = false) {
9898
}
9999

100100
const bounds = await getFromContentScript(tabId, '_elementPosition', { id: elementResult.element.id });
101+
if (!bounds) {
102+
// Element was removed from the DOM mid-command (e.g. the page re-rendered)
103+
throw new Error(`Element disappeared before the ${click ? 'click' : 'hover'} completed`);
104+
}
101105
const actualTargetX = bounds.x + bounds.width / 2;
102106
const actualTargetY = bounds.y + bounds.height / 2;
103107
await getFromContentScript(tabId, '_moveMouseSVG', { x: actualTargetX, y: actualTargetY });

extension/page-helpers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,8 @@ const helpers = {
320320
},
321321
_elementPosition: ({ id }) => {
322322
const element = document.getElementById(id);
323-
return element.getBoundingClientRect();
323+
// Null when the element was removed mid-command (e.g. the page re-rendered)
324+
return element ? element.getBoundingClientRect() : null;
324325
},
325326
_connectionStateChanged: ({ status, connected }) => {
326327
// Remove existing connection classes

0 commit comments

Comments
 (0)