Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd3700da9d |
No files matched your search
@@ -1642,8 +1642,8 @@ dropdown was filled under the old setting. "Back" cannot render Send again. A
|
||||
change to "Check recipients on Etherscan" leaves the stack as it is.
|
||||
|
||||
Any other popup open meanwhile takes either change from the stored record, as it
|
||||
takes a network switch (below). It then draws its screen on top again under the
|
||||
new setting.
|
||||
takes a network switch (below). It then draws its screen on top again as a
|
||||
reopened popup draws it, so Home takes the place of a screen such as Send.
|
||||
|
||||
A network switch leaves every screen on the page showing the previous network.
|
||||
The user makes it in Settings, or approves a site's request and the background
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
const { networkByChainId } = require("./networks");
|
||||
const { storageGet } = require("./browserApi");
|
||||
const { normalizePersisted } = require("./persistedState");
|
||||
|
||||
// Patterns in the page title that indicate a flagged address.
|
||||
// Title format: "Fake_Phishing184810 | Address: 0x... | Etherscan"
|
||||
@@ -81,7 +82,9 @@ function parseEtherscanPage(html) {
|
||||
*
|
||||
* Etherscan is asked only while "Check recipients on Etherscan" is on in the
|
||||
* stored profile. The page's own copy of the setting is not used, because
|
||||
* another page may have just changed it. While it is off, the answer is null.
|
||||
* another page may have just changed it. The stored setting is read through
|
||||
* normalizePersisted(), so it is on only when a load would find it on. While
|
||||
* it is off, the answer is null.
|
||||
*
|
||||
* @param {string} address - Ethereum address to check.
|
||||
* @param {string} [chainId] - Chain id of the network to look it up on.
|
||||
@@ -90,7 +93,9 @@ function parseEtherscanPage(html) {
|
||||
async function checkEtherscanLabel(address, chainId) {
|
||||
try {
|
||||
const { autistmask } = await storageGet("autistmask");
|
||||
if (!autistmask || !autistmask.checkRecipientsOnEtherscan) return null;
|
||||
if (!normalizePersisted(autistmask).checkRecipientsOnEtherscan) {
|
||||
return null;
|
||||
}
|
||||
// Lazy require to avoid pulling in chrome.storage at module scope
|
||||
// (which breaks unit tests that only exercise parseEtherscanPage).
|
||||
const { currentNetwork } = require("./state");
|
||||
|
||||
@@ -157,6 +157,9 @@ describe("where each request is made", () => {
|
||||
|
||||
await checkWith({});
|
||||
await checkWith({ autistmask: { checkRecipientsOnEtherscan: false } });
|
||||
// Only a stored true is on, as when the profile is loaded.
|
||||
await checkWith({ autistmask: { checkRecipientsOnEtherscan: "true" } });
|
||||
await checkWith({ autistmask: { checkRecipientsOnEtherscan: 42 } });
|
||||
expect(asked).toEqual([]);
|
||||
|
||||
await checkWith({ autistmask: { checkRecipientsOnEtherscan: true } });
|
||||
|
||||
Reference in new issue
Block a user