fix: a popup reload no longer logs the requests it cancels, except on the transaction detail and confirmation screens (closes #475)
The transaction lists and ENS name lookups on the address and token screens, the address scan after a wallet is created, the endpoint checks in Settings, the wait screen's receipt check, the Send screen's Max fee estimate and the token lookup on both add-token screens now check the signal the popup aborts on pagehide before reporting a failed request. scanForAddresses(), resolveEnsNames() and lookupTokenInfo() take the signal. End-to-end tests reload the popup on the address screen and during the address scan with their requests held. Jest tests show each of these reports a real failure and stays silent once the popup has closed. The transaction detail and confirmation screens are left out: they discard the popup context that carries the signal. Model: opus-5-5
This commit is contained in:
@@ -50,7 +50,8 @@ function element(id) {
|
||||
return (elements[id] ||= fakeElement());
|
||||
}
|
||||
|
||||
function loadSettingsView() {
|
||||
// `pageClosed` stands in for the popup's: aborting it is the popup closing.
|
||||
function loadSettingsView(pageClosed = new AbortController()) {
|
||||
elements = {};
|
||||
flashes = [];
|
||||
|
||||
@@ -74,7 +75,9 @@ function loadSettingsView() {
|
||||
state.blockscoutUrl = SAVED_BLOCKSCOUT;
|
||||
require("../src/shared/log").setRuntimeDebug(true);
|
||||
|
||||
require("../src/popup/views/settings").init({});
|
||||
require("../src/popup/views/settings").init({
|
||||
pageClosed: pageClosed.signal,
|
||||
});
|
||||
}
|
||||
|
||||
async function save(fieldId, buttonId, typed) {
|
||||
@@ -146,3 +149,21 @@ test("the Blockscout check of a URL with a user name and password", async () =>
|
||||
const line = expectFailedWithoutSecrets("Blockscout validation failed");
|
||||
expect(line).toContain("https://explorer.example.invalid");
|
||||
});
|
||||
|
||||
// In the popup a check its own closing cancelled fails as these do, and is
|
||||
// not reported (https://git.eeqj.de/sneak/AutistMask/issues/475). Nothing is
|
||||
// saved either.
|
||||
test("a check that fails once the popup has closed is not reported", async () => {
|
||||
const pageClosed = new AbortController();
|
||||
pageClosed.abort();
|
||||
loadSettingsView(pageClosed);
|
||||
await save("settings-rpc", "btn-save-rpc", RPC_UNPARSEABLE);
|
||||
await save(
|
||||
"settings-blockscout",
|
||||
"btn-save-blockscout",
|
||||
BLOCKSCOUT_WITH_PASSWORD,
|
||||
);
|
||||
expect(console.error).not.toHaveBeenCalled();
|
||||
expect(state.rpcUrl).toBe(SAVED_RPC);
|
||||
expect(state.blockscoutUrl).toBe(SAVED_BLOCKSCOUT);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user