Open ghost opened 3 years ago
For the SES-shim, we deal with this well. See https://github.com/Agoric/SES-shim/blob/master/packages/ses/src/error/tame-error-constructor.js and https://github.com/Agoric/SES-shim/blob/master/packages/ses/src/error/tame-v8-error-constructor.js
In all cases, the SES-shim first hides the original Error
constructor because of exactly the v8 magic documented at your link.
However, there's the more general issuer of how well do these features play with virtualizability? We can divide this into four questions:
Error
constructor left in the start compartment after calling lockdown()
or lockdown({errorTaming: 'unsafe'});
. This only has v8-like behavior if run on an actual v8 host. But it is a safe subset of the behavior described at that link.Error
constructor installed on all created compartments, i.e., on all compartments other than the start compartment. For all compartments including the start compartment, Error.prototype.constructor
is also the shared Error
constructor. It provides no non-spec magic.where we define "plain vanilla host" as one that implements the ES spec and possibly the magic error.stack
property.
See https://bugs.chromium.org/p/v8/issues/detail?id=10551 for an interesting anomaly of the v8 Error
behavior that is specific to Node. Fortunately, the SES-shim is not vulnerable to it.
I'm going to leave this open because of point 4 above:
For the SES-shim, we deal with this well....
That seems interesting, if I might ask, where can I try running the SES shim myself?
Start at https://medium.com/agoric/ses-support-for-ecmascript-modules-28fc1beb709c attn @kriskowal
V8 provides a few extensions to the Error class that are not there by default, but may instead be assigned by the script author at runtime. Once assigned, they are called by V8 upon any thrown exceptions.
An automated script like SES-shim can remove them easily, as they aren't non-deletable, but, the code that runs afterward can just reassign them.
Would this be problematic for this proprosal?