1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +01:00

Turn off LM scuttling feature for dev builds (#17771)

This commit is contained in:
weizman 2023-02-28 13:29:24 +02:00 committed by GitHub
parent 3678894df2
commit afed985b48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -73,9 +73,17 @@ async function defineAndRunBuildTasks() {
version,
} = await parseArgv();
// scuttle on production/tests environment only
const shouldScuttle = ['dist', 'prod', 'test'].includes(entryTask);
console.log(
`Building lavamoat runtime file`,
`(scuttling is ${shouldScuttle ? 'on' : 'off'})`,
);
// build lavamoat runtime file
await lavapack.buildRuntime({
scuttleGlobalThis: true,
scuttleGlobalThis: applyLavaMoat && shouldScuttle,
scuttleGlobalThisExceptions: [
// globals used by different mm deps outside of lm compartment
'toString',

View File

@ -163,7 +163,7 @@ function wrapAgainstScuttling(content, bag = {}) {
const proxy = new Proxy(bag, {
set: function set(target, prop, value) {
if (bag.hasOwnProperty(prop) || prop.startsWith('on')) {
return bag[prop] = global[prop] = value;
return (bag[prop] = global[prop] = value) || true;
}
},
});