Skip to content

Commit

Permalink
fixup! patch endo #2408 so we can use it
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Aug 12, 2024
1 parent afacc91 commit a1a3d14
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/SwingSet/test/vat-env.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,17 @@ async function testForExpectedGlobals(t, workerType) {
'VatData.makeScalarBigSetStore: function',
'VatData.makeScalarBigWeakSetStore: function',
'global has passStyleOf: true',
'global passStyleOf is special: true',
'global passStyleOf is special: false',
]);
}

test('expected globals are in the local worker vat environment', async t => {
await testForExpectedGlobals(t, 'local');
});

test('expected globals are in the XS worker vat environment', async t => {
await testForExpectedGlobals(t, 'xs-worker');
});
test.failing(
'expected globals are in the XS worker vat environment',
async t => {
await testForExpectedGlobals(t, 'xs-worker');
},
);
29 changes: 29 additions & 0 deletions patches/@endo+compartment-mapper+1.2.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/node_modules/@endo/compartment-mapper/src/policy.js b/node_modules/@endo/compartment-mapper/src/policy.js
index ee2a8fb..98af69a 100644
--- a/node_modules/@endo/compartment-mapper/src/policy.js
+++ b/node_modules/@endo/compartment-mapper/src/policy.js
@@ -10,7 +10,9 @@ import {
policyLookupHelper,
} from './policy-format.js';

-const { create, entries, values, assign, keys, freeze } = Object;
+const { create, entries, values, assign, freeze, getOwnPropertyDescriptors } =
+ Object;
+const { ownKeys } = Reflect;
const q = JSON.stringify;

/**
@@ -28,7 +30,12 @@ export const ATTENUATORS_COMPARTMENT = '<ATTENUATORS>';
*/
const selectiveCopy = (from, to, list) => {
if (!list) {
- list = keys(from);
+ const descs = getOwnPropertyDescriptors(from);
+ list = ownKeys(from).filter(
+ key =>
+ // @ts-expect-error TypeScript still confused about a symbol as index
+ descs[key].enumerable,
+ );
}
for (let index = 0; index < list.length; index += 1) {
const key = list[index];

0 comments on commit a1a3d14

Please sign in to comment.