mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
Remove web3 shim usage event (#20376)
Removes the `Website Accessed window.web3 Shim` event from the `metamask_logWeb3ShimUsage` RPC method implementation. The method itself displays an alert to the user if a website attempts to access the `window.web3` shim, which we replaced the original, functional `window.web3` object with after said object was removed. This seems potentially useful, because we still get 5-star reviews on [the legacy web3 extension](https://addons.mozilla.org/en-US/firefox/addon/metamask-legacy-web3/). The associated metrics event, on the other hand, is useless. It is rife with false positives, and doesn't tell us anything that we can't learn from download data for the legacy web3 extension. It's time to get rid of it.
This commit is contained in:
parent
79d9c18cb1
commit
4a9316317f
@ -1,18 +1,15 @@
|
|||||||
import { MESSAGE_TYPE } from '../../../../../shared/constants/app';
|
import { MESSAGE_TYPE } from '../../../../../shared/constants/app';
|
||||||
import { MetaMetricsEventCategory } from '../../../../../shared/constants/metametrics';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This RPC method is called by the inpage provider whenever it detects the
|
* This RPC method is called by the inpage provider whenever it detects the
|
||||||
* accessing of a non-existent property on our window.web3 shim.
|
* accessing of a non-existent property on our window.web3 shim. We use this
|
||||||
* We collect this data to understand which sites are breaking due to the
|
* to alert the user that they are using a legacy dapp, and will have to take
|
||||||
* removal of our window.web3.
|
* further steps to be able to use it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const logWeb3ShimUsage = {
|
const logWeb3ShimUsage = {
|
||||||
methodNames: [MESSAGE_TYPE.LOG_WEB3_SHIM_USAGE],
|
methodNames: [MESSAGE_TYPE.LOG_WEB3_SHIM_USAGE],
|
||||||
implementation: logWeb3ShimUsageHandler,
|
implementation: logWeb3ShimUsageHandler,
|
||||||
hookNames: {
|
hookNames: {
|
||||||
sendMetrics: true,
|
|
||||||
getWeb3ShimUsageState: true,
|
getWeb3ShimUsageState: true,
|
||||||
setWeb3ShimUsageRecorded: true,
|
setWeb3ShimUsageRecorded: true,
|
||||||
},
|
},
|
||||||
@ -21,7 +18,6 @@ export default logWeb3ShimUsage;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {object} LogWeb3ShimUsageOptions
|
* @typedef {object} LogWeb3ShimUsageOptions
|
||||||
* @property {Function} sendMetrics - A function that registers a metrics event.
|
|
||||||
* @property {Function} getWeb3ShimUsageState - A function that gets web3 shim
|
* @property {Function} getWeb3ShimUsageState - A function that gets web3 shim
|
||||||
* usage state for the given origin.
|
* usage state for the given origin.
|
||||||
* @property {Function} setWeb3ShimUsageRecorded - A function that records web3 shim
|
* @property {Function} setWeb3ShimUsageRecorded - A function that records web3 shim
|
||||||
@ -40,24 +36,11 @@ function logWeb3ShimUsageHandler(
|
|||||||
res,
|
res,
|
||||||
_next,
|
_next,
|
||||||
end,
|
end,
|
||||||
{ sendMetrics, getWeb3ShimUsageState, setWeb3ShimUsageRecorded },
|
{ getWeb3ShimUsageState, setWeb3ShimUsageRecorded },
|
||||||
) {
|
) {
|
||||||
const { origin } = req;
|
const { origin } = req;
|
||||||
if (getWeb3ShimUsageState(origin) === undefined) {
|
if (getWeb3ShimUsageState(origin) === undefined) {
|
||||||
setWeb3ShimUsageRecorded(origin);
|
setWeb3ShimUsageRecorded(origin);
|
||||||
|
|
||||||
sendMetrics(
|
|
||||||
{
|
|
||||||
event: `Website Accessed window.web3 Shim`,
|
|
||||||
category: MetaMetricsEventCategory.InpageProvider,
|
|
||||||
referrer: {
|
|
||||||
url: origin,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
excludeMetaMetricsId: true,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res.result = true;
|
res.result = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user