Skip to content
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

test: add a test to check if arguments prototype is frozen under lockdown #1252

Merged
merged 1 commit into from
Aug 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/ses/test/test-frozen-primordials.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@ import test from 'ava';
import '../index.js';
import { getOwnPropertyDescriptor } from '../src/commons.js';

test('check if override-protected primordials are frozen', t => {
test.before(() => {
lockdown();
});

test('check if override-protected primordials are frozen', t => {
// After removing the detachedProperties mechanism and without
// the originalValue mechanism, this test failed.
t.truthy(Object.isFrozen(Object.prototype.toString));

const desc = getOwnPropertyDescriptor(Object.prototype, 'toString');
t.is(desc.get.originalValue, Object.prototype.toString);
});

test('check if arguments prototype is frozen', t => {
naugtur marked this conversation as resolved.
Show resolved Hide resolved
(function gimmeArguments() {
// eslint-disable-next-line no-proto
t.truthy(Object.isFrozen(arguments.__proto__));
})();
});