Fix CDP click submit navigation parity (#69)

* Fix Runtime.evaluate awaitPromise settling

* Fix DOM event navigation side effects

* Fix CDP click-triggered navigation parity

* Strengthen CDP inline script click parity test

* Handle positions-like submit URLs in CDP parity


Co-authored-by: SGavrl <[email protected]>
This commit is contained in:
Alexandr KondakovandSGavrl authored and GitHub committed 2026-05-15 20:38:54 +00:00
1 parent 3a6f3e6c22
commit 6dd1e4e65f
11 files changed
+450 -43

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
# Obscura DOM Event + Navigation Side Effects Report
Status: Completed locally on branch `fix/dom-event-navigation-side-effects`.
Base/dependency note: branch was created from current `fix/runtime-evaluate-await-promise` state as requested, so this work depends on that branch until it is merged/rebased.
## Changes
- `crates/obscura-js/js/bootstrap.js`
- Preserves the original `event.target` during bubbling.
- Allows bubbling even when `preventDefault()` was called, matching browser behavior.
- Implements propagation stop flags for `stopPropagation()` and `stopImmediatePropagation()`.
- Makes `preventDefault()` honor `cancelable`.
- `crates/obscura-js/src/ops.rs`
- `op_navigate` now updates runtime URL state immediately as well as recording pending navigation.
- `crates/obscura-js/src/runtime.rs`
- Added acceptance tests for:
1. `button.click()` runs click listener and updates `dataset`.
2. `dispatchEvent(new MouseEvent('click', { bubbles: true }))` runs listener.
3. `location.href = '/next'` updates URL/navigation state.
4. Submit button click runs submit handler; handler `preventDefault(); location.href='/submitted'` updates URL/navigation state.
## Verification
- `cargo test -p obscura-js` — passed, 58 tests.
- `cargo test -p obscura-cdp` — passed, 0 tests.
Existing warnings remain in `obscura-net`, `obscura-js`, and `obscura-cdp`; no new failure observed.
## Remaining gaps
- I did not open a PR or push because remote permissions were not attempted/confirmed in this environment.
- `cargo fmt` was tested earlier but it reformats many unrelated existing files in this repo, so I reverted those broad formatting-only changes and kept the final diff scoped to this task.