fix(ses): comments
MODIFY
packages/ses/src/intrinsic-names.js
packages/ses/src/intrinsic-names.js
/**
* intrinsicNames
- * The following list contains all intrisics names as defined in the specs, except
- * that the leading an trailing '%' characters have been removed. We want to design
- * from the specs so we can better track changes to the specs.
+ * The following list contains all intrisics names as defined in the specs,
+ * except that the leading and trailing '%' characters have been removed. We
+ * want to design from the specs so we can better track changes to the specs.
*/
export const intrinsicNames = [
// 6.1.7.4 Well-Known Intrinsic Objects

MODIFY
packages/ses/src/tame-function-constructors.js
packages/ses/src/tame-function-constructors.js
+const { defineProperties, getPrototypeOf, setPrototypeOf } = Object;
+
// This module replaces the original `Function` constructor, and the original
-// `%GeneratorFunction%`, `%AsyncFunction%` and `%AsyncGeneratorFunction%`, with
-// safe replacements that throw if invoked.
+// `%GeneratorFunction%`, `%AsyncFunction%` and `%AsyncGeneratorFunction%`,
+// with safe replacements that throw if invoked.
//
// These are all reachable via syntax, so it isn't sufficient to just
// replace global properties with safe versions. Our main goal is to prevent
// access to the `Function` constructor through these starting points.
//
-// After modules block is done, the originals must no longer be reachable, unless
-// a copy has been made, and funtions can only be created by syntax (using eval)
-// or by invoking a previously saved reference to the originals.
+// After modules block is done, the originals must no longer be reachable,
+// unless a copy has been made, and functions can only be created by syntax
+// (using eval) or by invoking a previously saved reference to the originals.
//
-// Typically, this module will not be used directly, but via the [lockdown-shim] which handles all necessary repairs and taming in SES.
+// Typically, this module will not be used directly, but via the
+// [lockdown - shim] which handles all necessary repairs and taming in SES.
//
// Relation to ECMA specifications
//
-// The taming of constructors really wants to be part of the standard, because new
-// constructors may be added in the future, reachable from syntax, and this
+// The taming of constructors really wants to be part of the standard, because
+// new constructors may be added in the future, reachable from syntax, and this
// list must be updated to match.
//
// In addition, the standard needs to define four new intrinsics for the safe
@@ -42,8 +45,6 @@ export default function tameFunctionConstructors() {
return;
}
- const { defineProperties, getPrototypeOf, setPrototypeOf } = Object;
-
/**
* The process to repair constructors:
* 1. Create an instance of the function by evaluating syntax
@@ -100,16 +101,16 @@ export default function tameFunctionConstructors() {
prototype: { value: FunctionPrototype },
});
- // This line ensures that all functions meet "instanceof Function" in
- // a give realm.
+ // Reconstructs the inheritance among the new tamed constructors
+ // to mirror the original specified in normal JS.
if (constructor !== Function.prototype.constructor) {
setPrototypeOf(constructor, Function.prototype.constructor);
}
}
// Here, the order of operation is important: Function needs to be repaired
- // first since the other repaired constructors need to inherit from the tamed
- // Function function constructor.
+ // first since the other repaired constructors need to inherit from the
+ // tamed Function function constructor.
repairFunction('Function', '(function(){})');
repairFunction('GeneratorFunction', '(function*(){})');

MODIFY
packages/ses/src/whitelist-intrinsics.js
packages/ses/src/whitelist-intrinsics.js
// algorithm and improve the accuracy and maintainability of the whitelist.
//
// 1. The indicators "maybeAccessor" and "\*" are replace with more explicit
-// mapping. This memoved the implicit recursive structure.
+// mapping. This removed the implicit recursive structure.
//
// 2. Instead, the `prototype`, `__proto__`, and `constructor` must be
// specified and point to top level entries in the map. For example,
// `Object.__proto__` leads to `FunctionPrototype` which is a top level entry
// in the map.
//
-// 3. The whitelist defines all prototypoe properties `\*Prototype` as top
+// 3. The whitelist defines all prototype properties `\*Prototype` as top
// level entries. This creates a much more maintainable two level map, which is
// closer to how the languare is spefified.
//
-// 4. The indicator `true` has been removed. Instead, the map value must the
+// 4. The indicator `true` has been removed. Instead, the map value must be the
// name of a primitive for type-checking (for example, `Error.stackTraceLimit`
// leads to 'number'), the name of an intrinsic (for example,
-// `ErrorPrototype.constructor` leads to 'Error'), or a internal constant (for
+// `ErrorPrototype.constructor` leads to 'Error'), or an internal constant (for
// example, `eval` leads to `fn` which is an alias for `FunctionInstance`, a
// record that whitelist all properties on allows on such instance).
//
@@ -218,7 +218,10 @@ export default function whitelistIntrinsics(intrinsics) {
}
}
- // console.log(`Removing ${subPath}`);
+ // console.log(
+ // `Removing ${subPath}`,
+ // Object.getOwnPropertyDescriptor(obj, prop),
+ // );
delete obj[prop];
}
}

fix(ses): comments (#254)