mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Only build LavaMoat runtime once (#18768)
This commit is contained in:
parent
9fcbc554b0
commit
cd7cd45ec5
@ -73,61 +73,65 @@ async function defineAndRunBuildTasks() {
|
|||||||
version,
|
version,
|
||||||
} = await parseArgv();
|
} = await parseArgv();
|
||||||
|
|
||||||
// scuttle on production/tests environment only
|
const isRootTask = ['dist', 'prod', 'test', 'dev'].includes(entryTask);
|
||||||
const shouldScuttle = ['dist', 'prod', 'test'].includes(entryTask);
|
|
||||||
|
|
||||||
console.log(
|
if (isRootTask) {
|
||||||
`Building lavamoat runtime file`,
|
// scuttle on production/tests environment only
|
||||||
`(scuttling is ${shouldScuttle ? 'on' : 'off'})`,
|
const shouldScuttle = ['dist', 'prod', 'test'].includes(entryTask);
|
||||||
);
|
|
||||||
|
|
||||||
// build lavamoat runtime file
|
console.log(
|
||||||
await lavapack.buildRuntime({
|
`Building lavamoat runtime file`,
|
||||||
scuttleGlobalThis: applyLavaMoat && shouldScuttle,
|
`(scuttling is ${shouldScuttle ? 'on' : 'off'})`,
|
||||||
scuttleGlobalThisExceptions: [
|
);
|
||||||
// globals used by different mm deps outside of lm compartment
|
|
||||||
'toString',
|
// build lavamoat runtime file
|
||||||
'getComputedStyle',
|
await lavapack.buildRuntime({
|
||||||
'addEventListener',
|
scuttleGlobalThis: applyLavaMoat && shouldScuttle,
|
||||||
'removeEventListener',
|
scuttleGlobalThisExceptions: [
|
||||||
'ShadowRoot',
|
// globals used by different mm deps outside of lm compartment
|
||||||
'HTMLElement',
|
'toString',
|
||||||
'Element',
|
'getComputedStyle',
|
||||||
'pageXOffset',
|
'addEventListener',
|
||||||
'pageYOffset',
|
'removeEventListener',
|
||||||
'visualViewport',
|
'ShadowRoot',
|
||||||
'Reflect',
|
'HTMLElement',
|
||||||
'Set',
|
'Element',
|
||||||
'Object',
|
'pageXOffset',
|
||||||
'navigator',
|
'pageYOffset',
|
||||||
'harden',
|
'visualViewport',
|
||||||
'console',
|
'Reflect',
|
||||||
'Image', // Used by browser to generate notifications
|
'Set',
|
||||||
// globals chrome driver needs to function (test env)
|
'Object',
|
||||||
/cdc_[a-zA-Z0-9]+_[a-zA-Z]+/iu,
|
'navigator',
|
||||||
'performance',
|
'harden',
|
||||||
'parseFloat',
|
'console',
|
||||||
'innerWidth',
|
'Image', // Used by browser to generate notifications
|
||||||
'innerHeight',
|
// globals chrome driver needs to function (test env)
|
||||||
'Symbol',
|
/cdc_[a-zA-Z0-9]+_[a-zA-Z]+/iu,
|
||||||
'Math',
|
'performance',
|
||||||
'DOMRect',
|
'parseFloat',
|
||||||
'Number',
|
'innerWidth',
|
||||||
'Array',
|
'innerHeight',
|
||||||
'crypto',
|
'Symbol',
|
||||||
'Function',
|
'Math',
|
||||||
'Uint8Array',
|
'DOMRect',
|
||||||
'String',
|
'Number',
|
||||||
'Promise',
|
'Array',
|
||||||
// globals sentry needs to function
|
'crypto',
|
||||||
'__SENTRY__',
|
'Function',
|
||||||
'appState',
|
'Uint8Array',
|
||||||
'extra',
|
'String',
|
||||||
'stateHooks',
|
'Promise',
|
||||||
'sentryHooks',
|
// globals sentry needs to function
|
||||||
'sentry',
|
'__SENTRY__',
|
||||||
],
|
'appState',
|
||||||
});
|
'extra',
|
||||||
|
'stateHooks',
|
||||||
|
'sentryHooks',
|
||||||
|
'sentry',
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const browserPlatforms = ['firefox', 'chrome'];
|
const browserPlatforms = ['firefox', 'chrome'];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user