mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
a3f811957e
* 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>
30 lines
861 B
JavaScript
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);
|
|
}
|
|
},
|
|
});
|
|
})();
|