Skip to content

Commit

Permalink
feat(ses): enablements needed by (old?) mobx (#2030)
Browse files Browse the repository at this point in the history
  • Loading branch information
erights authored Feb 2, 2024
1 parent eebcb54 commit 553cb52
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/ses/src/enablements.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toStringTagSymbol } from './commons.js';
import { toStringTagSymbol, iteratorSymbol } from './commons.js';

/**
* @file Exports {@code enablements}, a recursively defined
Expand Down Expand Up @@ -97,6 +97,8 @@ export const moderateEnablements = {
'%ArrayPrototype%': {
toString: true,
push: true, // set by "Google Analytics"
concat: true, // set by mobx generated code (old TS compiler?)
[iteratorSymbol]: true, // set by mobx generated code (old TS compiler?)
},

// Function.prototype has no 'prototype' property to enable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ test('enablePropertyOverrides - on', t => {
overrideTester(t, 'Object', {}, ['toString', 'valueOf']);
// We allow 'length' *not* because it is in enablements; it is not;
// but because each array instance has its own.
overrideTester(t, 'Array', [], ['toString', 'length', 'push']);
overrideTester(t, 'Array', [], ['toString', 'length', 'push', 'concat']);
// eslint-disable-next-line func-names, prefer-arrow-callback
overrideTester(t, 'Function', function () {}, [
'constructor',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test('enablePropertyOverrides - on, with debug', t => {

// We allow 'length' *not* because it is in enablements; it is not;
// but because each array instance has its own.
overrideTester(t, 'Array', [], ['toString', 'length', 'push']);
overrideTester(t, 'Array', [], ['toString', 'length', 'push', 'concat']);

const TypedArray = getPrototypeOf(Uint8Array);
overrideTester(
Expand Down
2 changes: 1 addition & 1 deletion packages/ses/test/test-enable-property-overrides-severe.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ test('enablePropertyOverrides - on', t => {

// We allow 'length' *not* because it is in enablements; it is not;
// but because each array instance has its own.
overrideTester(t, 'Array', [], ['toString', 'length', 'push']);
overrideTester(t, 'Array', [], ['toString', 'length', 'push', 'concat']);

const TypedArray = getPrototypeOf(Uint8Array);
overrideTester(
Expand Down

0 comments on commit 553cb52

Please sign in to comment.