-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ses): Support an incomplete shimmed globalThis.process #1923
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fatal-assert.js
change will result in problems on non node environments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With caveats. Thank you!
const globalProcess = aGlobal.process || undefined; | ||
const globalEnv = | ||
(typeof globalProcess === 'object' && globalProcess.env) || undefined; | ||
if (typeof globalEnv === 'object') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this regresses if env === null
. Unlikely, I’m sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't given the || undefined
@@ -10,7 +10,7 @@ let abandon; | |||
// below). Currently it only checks for the `process.abort` or `process.exit` | |||
// found on Node. It should also sniff for a vat terminating function expected | |||
// to be found within the start compartment of SwingSet vats. What else? | |||
if (typeof process === 'object') { | |||
if (process && typeof process === 'object') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps invert the order these so we don’t get a ReferenceError if process
is not defined in scope.
if ( | ||
errorTrapping !== 'none' && | ||
typeof globalProcess === 'object' && | ||
typeof globalProcess.on === 'function' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should test for existence of abort and exit as well.
@mhofman ready for re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Eager to land! Thanks. |
25ba699
to
08cbae5
Compare
Fixes #1917
Description
Updates packages/ses/src/error/tame-console.js to check for a
globalThis.process.on
function rather than assuming it whenglobalThis.process
is defined.Also updates general patterns for checking
globalThis
properties for better uniformity.Security Considerations
n/a
Scaling Considerations
n/a
Documentation Considerations
n/a
Testing Considerations
n/a
Upgrade Considerations
n/a