fix: the address and token screens and the address scan no longer log requests a popup reload cancels (closes #475)
The transaction lists on the address and token screens, the address scan after a wallet is created, and the endpoint checks in Settings now check the signal the popup aborts on pagehide before reporting a failed request, as the home screen and the balance refresh already do. scanForAddresses() takes the signal ahead of its gap limit. End-to-end tests reload the popup on the address screen with Blockscout held, and during the address scan with its requests held. Jest tests show the transaction lists, the scan and the Settings checks report a real failure and stay silent once the popup has closed. The transaction detail and confirmation screens are left out: they do not keep the popup context. 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