makeSESRootRealm: reject options.sloppyGlobals with advice
MODIFY
realms-shim
realms-shim
-Subproject commit 041e8c404c440e40f405d33bae09e5dece2c0eb4
+Subproject commit 9b8af863f3e1e47153fa77685ad7f325d1e24321

MODIFY
src/bundle/createSES.js
src/bundle/createSES.js
@@ -25,7 +25,7 @@ import whitelist from './whitelist';
import makeConsole from './make-console';
import makeMakeRequire from './make-require';
-const FORWARDED_REALMS_OPTIONS = ['sloppyGlobals', 'transforms'];
+const FORWARDED_REALMS_OPTIONS = ['transforms'];
export function createSESWithRealmConstructor(creatorStrings, Realm) {
function makeSESRootRealm(options) {
@@ -35,6 +35,7 @@ export function createSESWithRealmConstructor(creatorStrings, Realm) {
const {
shims: optionalShims,
+ sloppyGlobals,
whitelist: optWhitelist,
...optionsRest
} = options;
@@ -49,6 +50,13 @@ export function createSESWithRealmConstructor(creatorStrings, Realm) {
}
});
+ if (sloppyGlobals) {
+ throw TypeError(`\
+sloppyGlobals cannot be specified for makeSESRootRealm!
+You probably want a Compartment instead, like:
+ const c = s.global.Realm.makeCompartment({ sloppyGlobals: true })`);
+ }
+
// "allow" enables real Date.now(), anything else gets NaN
// (it'd be nice to allow a fixed numeric value, but too hard to
// implement right now)

makeSESRootRealm: reject options.sloppyGlobals with advice