refactor: one shared extension-API module, and drive the dApp flows on Firefox (closes #153)
All checks were successful
check / check (push) Successful in 29s
All checks were successful
check / check (push) Successful in 29s
Every call site that touched `browser.*` or `chrome.*` now goes through
`src/shared/browserApi.js`, the only file in the tree that names either.
It exposes lazily-resolved namespace handles for events and synchronous
methods, and promise-returning wrappers for everything that is
callback-shaped on Chrome. Callers await; `runtime.lastError` is gone,
folded into the rejection the wrapper produces on the Chrome path.
`storageGet()` and `storageSet()` reject where `storage.local` is
absent. They carry the wallet: resolving `{}` would make an existing
wallet read back as no wallet, and a no-op write would discard the
user's state with nothing logged. The one caller that genuinely
degrades, `src/shared/phishingDomains.js`, takes `storageLocal()`
directly and keeps its own null check.
The Firefox suite gains the four dApp round trips the issue's definition
of done asks for — `eth_requestAccounts`, `personal_sign`,
`eth_sendTransaction`, and a closed approval window rejecting with
EIP-1193 4001 — driven through the real content script, background page
and approval windows. `--network none` was thought to rule that out
because it leaves no `http://` origin to inject into; loopback survives
it, so the page and a JSON-RPC node are served from 127.0.0.1 inside the
container and the run still reaches nothing but itself.
That harness refutes the premise it was built to verify. On Firefox
153.0.3, `browser.*` honours a trailing Chrome-style callback and does
populate `runtime.lastError`, both measured directly, and all four flows
pass against the unconverted code. So this is a uniformity and coverage
change, not a repair of a broken target; the PR records the measurement
in full, and the comments in `browserApi.js` and the Firefox suite say
that rather than the refuted claim.
An unhandled promise rejection fails a run on both harnesses, measured
by throwing past the first await of the unawaited `approval.show()`:
Firefox reports it from the console-service drain and Chrome as a
`pageerror`. README.md records the demonstration.
One real defect is fixed on the way past: the window id written back
into a pending approval after `windows.create()` was unguarded, so an
approval settled during the open — an address switch will do it —
dereferenced a deleted entry.
This commit is contained in:
18
TODO.md
18
TODO.md
@@ -45,6 +45,24 @@ undefined identifiers, which is how
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-08-17: One shared extension-API module,
|
||||
[`src/shared/browserApi.js`](src/shared/browserApi.js), is the only place in
|
||||
the tree that names `browser` or `chrome`. Every call site returns a promise;
|
||||
`runtime.lastError` is gone. The same commit gives the Firefox suite the four
|
||||
dApp round trips — `eth_requestAccounts`, `personal_sign`,
|
||||
`eth_sendTransaction` and a closed approval window rejecting with EIP-1193
|
||||
4001 — against a page and a JSON-RPC node served from loopback, which survives
|
||||
`--network none`. **The premise of
|
||||
[#153](https://git.eeqj.de/sneak/AutistMask/issues/153) does not survive that
|
||||
harness**: Firefox's `browser.*` honours a trailing Chrome-style callback and
|
||||
populates `runtime.lastError`, both measured directly on Firefox 153.0.3, and
|
||||
all four flows pass against the unconverted code. What landed is a uniformity
|
||||
and coverage change, not a repair of a broken target. `storageGet()` and
|
||||
`storageSet()` **reject** where `storage.local` is absent rather than
|
||||
resolving `{}` and a no-op write — they carry the wallet, and defaulting would
|
||||
read an existing wallet back as none. The one caller that genuinely degrades,
|
||||
[`src/shared/phishingDomains.js`](src/shared/phishingDomains.js), takes
|
||||
`storageLocal()` directly and keeps its own null check.
|
||||
- 2026-08-17: An address total no longer reports `$0.00` for holdings it cannot
|
||||
price. Prices exist for the top 25 tokens only, so the priced-only sum was
|
||||
printed as the total and an address holding nothing but unpriced ERC-20s was
|
||||
|
||||
Reference in New Issue
Block a user