Open-source AI browser agent for Chrome and Firefox (monorepo) ðŸ§
JavaScript ai-agentai-agentsai-toolsbrowser-aibrowser-automationbrowser-extensionchrome-aichrome-devtoolschrome-extensionchrome-extensionsfirefox-addonfirefox-addonsfirefox-extensionfirefox-extensionsgemmagemma4minimaxoffline-aioffline-llmqwen
track form validation bypass changes
Barack Sokullu8a47800ee460
diff --git a/src/chrome/src/content/page-monitor.js b/src/chrome/src/content/page-monitor.jsindex 067491118..09d86b3d8 100644--- a/src/chrome/src/content/page-monitor.js+++ b/src/chrome/src/content/page-monitor.js@@ -392,6 +392,7 @@el.getAttribute('type'),el.getAttribute('href'), el.getAttribute('target'), el.getAttribute('download'), el.getAttribute('action'), el.getAttribute('method'),el.getAttribute('formaction'), el.getAttribute('formmethod'), el.getAttribute('formtarget'),+ el.hasAttribute('novalidate'), el.hasAttribute('formnovalidate'),el.getAttribute('popover'), popoverOpen(el),el.selected === true, el.defaultSelected === true,Number.isInteger(el.selectedIndex) ? el.selectedIndex : null,@@ -491,7 +492,7 @@attributeFilter: ['role', 'aria-label', 'id', 'for', 'form', 'name', 'placeholder', 'title', 'alt', 'aria-labelledby', 'rel', 'media', 'data-selected','aria-required', 'aria-readonly', 'contenteditable', 'tabindex', 'onclick', 'required','aria-expanded', 'aria-selected', 'aria-checked', 'aria-pressed', 'aria-disabled',- 'type', 'href', 'target', 'download', 'action', 'method', 'formaction', 'formmethod', 'formtarget',+ 'type', 'href', 'target', 'download', 'action', 'method', 'formaction', 'formmethod', 'formtarget', 'novalidate', 'formnovalidate','aria-valuenow', 'aria-valuetext', 'aria-hidden', 'hidden', 'disabled', 'readonly', 'checked', 'selected', 'open', 'popover', 'inert', 'class', 'style'] });for (const name of ['animationend', 'animationcancel', 'transitionend', 'transitioncancel'])listen(root, name, checkSettledAnimation);diff --git a/src/firefox/src/content/page-monitor.js b/src/firefox/src/content/page-monitor.jsindex 067491118..09d86b3d8 100644--- a/src/firefox/src/content/page-monitor.js+++ b/src/firefox/src/content/page-monitor.js@@ -392,6 +392,7 @@el.getAttribute('type'),el.getAttribute('href'), el.getAttribute('target'), el.getAttribute('download'), el.getAttribute('action'), el.getAttribute('method'),el.getAttribute('formaction'), el.getAttribute('formmethod'), el.getAttribute('formtarget'),+ el.hasAttribute('novalidate'), el.hasAttribute('formnovalidate'),el.getAttribute('popover'), popoverOpen(el),el.selected === true, el.defaultSelected === true,Number.isInteger(el.selectedIndex) ? el.selectedIndex : null,@@ -491,7 +492,7 @@attributeFilter: ['role', 'aria-label', 'id', 'for', 'form', 'name', 'placeholder', 'title', 'alt', 'aria-labelledby', 'rel', 'media', 'data-selected','aria-required', 'aria-readonly', 'contenteditable', 'tabindex', 'onclick', 'required','aria-expanded', 'aria-selected', 'aria-checked', 'aria-pressed', 'aria-disabled',- 'type', 'href', 'target', 'download', 'action', 'method', 'formaction', 'formmethod', 'formtarget',+ 'type', 'href', 'target', 'download', 'action', 'method', 'formaction', 'formmethod', 'formtarget', 'novalidate', 'formnovalidate','aria-valuenow', 'aria-valuetext', 'aria-hidden', 'hidden', 'disabled', 'readonly', 'checked', 'selected', 'open', 'popover', 'inert', 'class', 'style'] });for (const name of ['animationend', 'animationcancel', 'transitionend', 'transitioncancel'])listen(root, name, checkSettledAnimation);diff --git a/test/page-monitor-ui.mjs b/test/page-monitor-ui.mjsindex cd87f20a4..50ec1e7bc 100644--- a/test/page-monitor-ui.mjs+++ b/test/page-monitor-ui.mjs@@ -2150,6 +2150,35 @@ for (const [build, engine] of [['chrome', chromium], ['firefox', firefox]]) {} finally { await browser.close(); }});+ test(`${build}: validation bypass changes invalidate a prepared submit click`, async () => {+ const { browser, page } = await fixture(engine, build);+ try {+ await page.evaluate(() => {+ const form = document.createElement('form'); form.id = 'validation-form';+ form.innerHTML = '<input required><button id="validation-submit" type="submit">Continue</button>';+ form.addEventListener('submit', event => event.preventDefault());+ document.body.append(form);+ });+ await page.waitForTimeout(150);+ for (const [attribute, target] of [['novalidate', '#validation-form'], ['formnovalidate', '#validation-submit']]) {+ const operationId = `validation-${attribute}`;+ await page.evaluate(id => {+ feedback = [];+ deliver('page_monitor_prepare', { operationId: id, tool: 'click', selector: '#validation-submit' });+ deliver('page_monitor_dispatch', { operationId: id, kind: 'click', selector: '#validation-submit', fenceOnly: true });+ }, operationId);+ await page.locator(target).evaluate((element, name) => element.setAttribute(name, ''), attribute);+ await page.waitForFunction(() => feedback.some(event => event.kind === 'dom' && event.source === 'page'), null, { timeout: 1000 });+ const blocked = await page.evaluate(id => {+ try { __wbPageMonitor.activatePreparedDispatch({ operationId: id, kind: 'click' }); return null; }+ catch (error) { return error.code; }+ }, operationId);+ assert.equal(blocked, 'page_feedback_pending', `${attribute} must stale the prepared submit click`);+ await page.waitForTimeout(180);+ }+ } finally { await browser.close(); }+ });+test(`${build}: GET submitter activity omits serialized form values from its navigation marker`, async () => {const { browser, page } = await fixture(engine, build);try {