Skip to content

Commit

Permalink
chore(ses): Revert ModuleSource shared intrinsic (#2468)
Browse files Browse the repository at this point in the history
This reverts commit 0d210a3.

## Description

This change caused a failure for Lockdown on XS in Agoric SDK,
indicating that it is a breaking change.

### Testing Considerations

Reverting this change is a temporary mitigation.
We will first address the gap in XS CI coverage and then persue a fix.

### Compatibility Considerations

We will pursue a follow-up change that addresses XS coverage in CI #2463
and then consider repairing the native `ModuleSource` intrinsic under
`repairIntrinsics` in SES.
  • Loading branch information
kriskowal authored Sep 24, 2024
2 parents 349f0e8 + 6a88166 commit 67d7187
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 56 deletions.
2 changes: 0 additions & 2 deletions packages/ses/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ User-visible changes in `ses`:
- Node 18, Node 20, and all browsers have `structuredClone`
- Node <= 16 have neither, but are also no longer supported by Endo.
- Now exports separate layer for console shim: `ses/console-shim.js`.
- Adds permits for `ModuleSource` if present, either the native implementation
or from `@endo/module-source/shim.js`.

# v1.8.0 (2024-08-27)

Expand Down
14 changes: 0 additions & 14 deletions packages/ses/src/get-anonymous-intrinsics.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,5 @@ export const getAnonymousIntrinsics = () => {
);
}

if (globalThis.ModuleSource) {
const AbstractModuleSourcePrototype = getPrototypeOf(
globalThis.ModuleSource.prototype,
);
intrinsics['%AbstractModuleSourcePrototype%'] =
AbstractModuleSourcePrototype;
intrinsics['%AbstractModuleSource%'] =
AbstractModuleSourcePrototype.constructor;
}

if (globalThis.ModuleSource) {
intrinsics['%ModuleSourcePrototype%'] = globalThis.ModuleSource.prototype;
}

return intrinsics;
};
23 changes: 0 additions & 23 deletions packages/ses/src/permits.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,8 @@ export const universalPropertyNames = {

// ESNext

// https://github.com/tc39/proposal-source-phase-imports?tab=readme-ov-file#js-module-source
ModuleSource: 'ModuleSource',

lockdown: 'lockdown',
harden: 'harden',

HandledPromise: 'HandledPromise', // TODO: Until Promise.delegate (see below).
};

Expand Down Expand Up @@ -1509,25 +1505,6 @@ export const permitted = {
resolve: fn,
},

// https://github.com/tc39/proposal-source-phase-imports?tab=readme-ov-file#js-module-source
'%AbstractModuleSourcePrototype%': {
constructor: '%AbstractModuleSource%',
'@@toStringTag': getter,
},
'%AbstractModuleSource%': {
'[[Proto]]': '%FunctionPrototype%',
prototype: '%AbstractModuleSourcePrototype%',
},
'%ModuleSourcePrototype%': {
'[[Proto]]': '%AbstractModuleSourcePrototype%',
constructor: 'ModuleSource',
'@@toStringTag': getter,
},
ModuleSource: {
'[[Proto]]': '%AbstractModuleSource%',
prototype: '%ModuleSourcePrototype%',
},

Promise: {
// Properties of the Promise Constructor
'[[Proto]]': '%FunctionPrototype%',
Expand Down
17 changes: 0 additions & 17 deletions packages/ses/test/module-source.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ import '@endo/module-source/shim.js';

lockdown();

test('module source property/prototype graph and hardening', t => {
const AbstractModuleSource = Object.getPrototypeOf(ModuleSource);
t.is(
Object.getPrototypeOf(ModuleSource.prototype),
AbstractModuleSource.prototype,
);

t.truthy(Object.isFrozen(ModuleSource));
t.truthy(Object.isFrozen(AbstractModuleSource));
t.truthy(Object.isFrozen(ModuleSource.prototype));
t.truthy(Object.isFrozen(AbstractModuleSource.prototype));
});

test('module source constructor', t => {
const msr = new ModuleSource(`
import foo from 'import-default-export-from-me.js';
Expand Down Expand Up @@ -57,7 +44,3 @@ test('module source constructor', t => {
'ModuleSource imports should be frozen',
);
});

test('ModuleSource is a shared intrinsic', t => {
t.truthy(ModuleSource === new Compartment().globalThis.ModuleSource);
});

0 comments on commit 67d7187

Please sign in to comment.