wishlist for Realm: dateNowTrap and randTrap
MODIFY
src/index.js
src/index.js
@@ -12,7 +12,21 @@ const deepFreeze = require('./deepFreeze.js').deepFreeze;
exports.makeRootSESRealm = function() {
- const r = new Realm();
+ const r = new Realm({
+ // wishlist: if set, dateNowTrap is used for 'Date.now()' and 'new
+ // Date()' inside the Realm it should return a number just like
+ // Date.now(). The behavior of dateNowTrap and randTrap must be inherited
+ // by all child Realms, whether constructed with {intrinsics: 'inherit'}
+ // or not. The new Realm will have new identities for the Date
+ // constructor and Math.random even though their behavior delegates.
+
+ //dateNowTrap() {throw TypeError("nondeterministic");},
+
+ // wishlist: if set, randTrap is used for 'Math.random()', and should
+ // either 1: always return a float or 2: always throw
+
+ //randTrap() {throw TypeError("nondeterministic");}
+ });
r.evaluate(prepareSESRealm_js)(r.global); //populate r
tamperProofDataProperties(r.intrinsics);
deepFreeze(r.global);

wishlist for Realm: dateNowTrap and randTrap