Add inert constructor tests
MODIFY
packages/ses/src/whitelist.js
packages/ses/src/whitelist.js
@@ -461,7 +461,7 @@ export const whitelist = {
apply: fn,
bind: fn,
call: fn,
- constructor: '%InertFunction%', // TODO test
+ constructor: '%InertFunction%',
toString: fn,
'@@hasInstance': fn,
// proposed but not yet std yet. To be removed if there

MODIFY
packages/ses/test/test-whitelist.js
packages/ses/test/test-whitelist.js
@@ -67,3 +67,19 @@ x.slice;
'prototype __proto__ inheritance works',
);
});
+
+test('Function constructor is inert', t => {
+ t.throws(
+ () => Function.prototype.constructor(),
+ { message: 'Not available' },
+ 'Function constructor is disabled',
+ );
+});
+
+test('Compartment constructor is inert', t => {
+ t.throws(
+ () => Compartment.prototype.constructor(),
+ { message: 'Not available' },
+ 'Compartment constructor is disabled',
+ );
+});

Add inert constructor tests