mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Replace lavamoat-runtime.js
patch (#15682)
A patch made in #15672 was found to be unnecessary. Instead of setting a `rootGlobals` object upon construction of the root compartment, we are now creating a `sentryHooks` object in the initial top-level compartment. I hadn't realized at the time that the root compartment would inherit all properties of the initial compartment `globalThis`. This accomplishes the same goals as #15672 except without needing a patch.
This commit is contained in:
parent
0d862d4032
commit
35dbdbc438
@ -786,10 +786,7 @@ browser.runtime.onInstalled.addListener(({ reason }) => {
|
||||
});
|
||||
|
||||
function setupSentryGetStateGlobal(store) {
|
||||
if (!global.rootGlobals) {
|
||||
global.rootGlobals = {};
|
||||
}
|
||||
global.rootGlobals.getSentryState = function () {
|
||||
global.sentryHooks.getSentryState = function () {
|
||||
const fullState = store.getState();
|
||||
const debugState = maskObject({ metamask: fullState }, SENTRY_STATE);
|
||||
return {
|
||||
|
@ -1,7 +1,10 @@
|
||||
import setupSentry from './lib/setupSentry';
|
||||
|
||||
// The root compartment will populate this with hooks
|
||||
global.sentryHooks = {};
|
||||
|
||||
// setup sentry error reporting
|
||||
global.sentry = setupSentry({
|
||||
release: process.env.METAMASK_VERSION,
|
||||
getState: () => global.rootGlobals?.getSentryState?.() || {},
|
||||
getState: () => global.sentryHooks?.getSentryState?.() || {},
|
||||
});
|
||||
|
@ -13,19 +13,3 @@ index eb41a0a..3f891ea 100644
|
||||
// deps,
|
||||
// source: sourceMeta.code
|
||||
}
|
||||
diff --git a/node_modules/@lavamoat/lavapack/src/runtime.js b/node_modules/@lavamoat/lavapack/src/runtime.js
|
||||
index 58f76f3..53df0e7 100644
|
||||
--- a/node_modules/@lavamoat/lavapack/src/runtime.js
|
||||
+++ b/node_modules/@lavamoat/lavapack/src/runtime.js
|
||||
@@ -11160,6 +11160,11 @@ function makePrepareRealmGlobalFromConfig ({ createFunctionWrapper }) {
|
||||
rootPackageCompartment.globalThis[ref] = rootPackageCompartment.globalThis
|
||||
}
|
||||
|
||||
+ // Allow root compartment to expose things to the initial execution environment of the realm.
|
||||
+ // This is intended to support passing data to shims run before lockdown.
|
||||
+ globalThis.rootGlobals = {}
|
||||
+ rootPackageCompartment.globalThis.rootGlobals = globalThis.rootGlobals
|
||||
+
|
||||
// save the compartment for use by other modules in the package
|
||||
packageCompartmentCache.set(rootPackageName, rootPackageCompartment)
|
||||
|
||||
|
@ -191,10 +191,7 @@ function setupDebuggingHelpers(store) {
|
||||
});
|
||||
return state;
|
||||
};
|
||||
if (!window.rootGlobals) {
|
||||
window.rootGlobals = {};
|
||||
}
|
||||
window.rootGlobals.getSentryState = function () {
|
||||
window.sentryHooks.getSentryState = function () {
|
||||
const fullState = store.getState();
|
||||
const debugState = maskObject(fullState, SENTRY_STATE);
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user