rearrange whitelist into anonIntrinsics and namedIntrinsics
MODIFY
src/bundle/createSES.js
src/bundle/createSES.js
@@ -46,7 +46,7 @@ export function createSESWithRealmConstructor(creatorStrings, Realm) {
shims.push(`(${tameIntl})();`);
} else {
/*
- wl.Intl = {
+ wl.namedIntrinsics.Intl = {
Collator: true,
DateTimeFormat: true,
NumberFormat: true,
@@ -64,9 +64,9 @@ export function createSESWithRealmConstructor(creatorStrings, Realm) {
// uncaught exceptions as "undefined" instead of a type/message/stack.
// So if we're allowing stack traces, make sure the whitelist is
// augmented to include them.
- wl.Error.captureStackTrace = true;
- wl.Error.stackTraceLimit = true;
- wl.Error.prepareStackTrace = true;
+ wl.namedIntrinsics.Error.captureStackTrace = true;
+ wl.namedIntrinsics.Error.stackTraceLimit = true;
+ wl.namedIntrinsics.Error.prepareStackTrace = true;
}
if (options.regexpMode !== "allow") {

MODIFY
src/bundle/removeProperties.js
src/bundle/removeProperties.js
@@ -150,8 +150,8 @@ export default function removeProperties(global, whitelist) {
});
}
- addToWhiteTable(global, whitelist);
+ addToWhiteTable(global, whitelist.namedIntrinsics);
const intr = getAnonIntrinsics(global);
- addToWhiteTable(intr, whitelist.cajaVM.anonIntrinsics);
+ addToWhiteTable(intr, whitelist.anonIntrinsics);
clean(global, '', 0);
}

MODIFY
src/bundle/whitelist.js
src/bundle/whitelist.js
@@ -109,7 +109,6 @@ const j = true; // included in the Jessie runtime
let TypedArrayWhitelist; // defined and used below
export default {
- cajaVM: { // Caja support
// The accessible intrinsics which are not reachable by own
// property name traversal are listed here so that they are
// processed by the whitelist, although this also makes them
@@ -160,7 +159,7 @@ export default {
}
}
},
- // TODO: 25.5 AsyncFunction
+ // TODO: 25.5 AsyncFunction, also AsyncIterator
TypedArray: TypedArrayWhitelist = { // 22.2
length: '*', // does not inherit from Function.prototype on Chrome
@@ -201,41 +200,7 @@ export default {
}
},
- log: t,
- tamperProof: t,
- constFunc: t,
- Nat: j,
- def: j,
- is: t,
-
- compileExpr: t,
- confine: j,
- compileModule: t, // experimental
- compileProgram: t, // Cannot be implemented in just ES5.1.
- eval: t,
- Function: t,
-
- sharedImports: t,
- makeImports: t,
- copyToImports: t,
-
- GuardT: {
- coerce: t
- },
- makeTableGuard: t,
- Trademark: {
- stamp: t
- },
- guard: t,
- passesGuard: t,
- stamp: t,
- makeSealerUnsealerPair: t,
-
- makeArrayLike: {
- canBeFullyLive: t
- }
- },
-
+ namedIntrinsics: {
// In order according to
// http://www.ecma-international.org/ecma-262/ with chapter
// numbers where applicable
@@ -843,13 +808,22 @@ export default {
// needlessly expensive for current usage.
},
- Realm: { makeRootRealm: t,
+ Realm: {
+ makeRootRealm: t,
makeCompartment: t,
- prototype: { global: "maybeAccessor",
+ prototype: {
+ global: "maybeAccessor",
evaluate: t
}
},
- SES: { confine: t,
+
+ SES: {
+ confine: t,
confineExpr: t
+ },
+
+ Nat: j,
+ def: j
}
+
};

rearrange whitelist into anonIntrinsics and namedIntrinsics