1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00
metamask-extension/app/scripts/use-snow.js
weizman a3f811957e
fix: skip snow usage for MV3 test build (#19827)
* try fix

* fix lint for app-init.js

* fix lint for use-snow.js

* remove comment in app-init.js

---------

Co-authored-by: Danica Shen <zhaodanica@gmail.com>
2023-06-30 13:22:07 +01:00

30 lines
861 B
JavaScript

/*
NOTICE:
This Snow + LavaMoat scuttling integration is currently being used
with an experimental API (https://github.com/LavaMoat/LavaMoat/pull/462).
Changing this code must be done cautiously to avoid breaking the app!
*/
// eslint-disable-next-line import/unambiguous
(function () {
const log = console.log.bind(console);
// eslint-disable-next-line no-undef
const isWorker = !self.document;
const msg =
'Snow detected a new realm creation attempt in MetaMask. Performing scuttling on new realm.';
// eslint-disable-next-line no-undef
Object.defineProperty(self, 'SCUTTLER', {
value: (realm, scuttle) => {
if (isWorker) {
scuttle(realm);
} else {
// eslint-disable-next-line no-undef
self.SNOW((win) => {
log(msg, win);
scuttle(win);
}, realm);
}
},
});
})();