fefdwef
This commit is contained in:
29
web_process/MetaMask 12.16.1/scripts/use-snow.js
Normal file
29
web_process/MetaMask 12.16.1/scripts/use-snow.js
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
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);
|
||||
}
|
||||
},
|
||||
});
|
||||
})();
|
||||
Reference in New Issue
Block a user