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

Annoying display of Object <[Object: null prototype] {}> #477

Closed
michaelfig opened this issue Sep 28, 2020 · 4 comments · Fixed by #587
Closed

Annoying display of Object <[Object: null prototype] {}> #477

michaelfig opened this issue Sep 28, 2020 · 4 comments · Fixed by #587
Assignees

Comments

@michaelfig
Copy link
Member

@erights, @kriskowal:

Is there any particular reason why https://github.com/Agoric/SES-shim/blob/54e0b0c910fd19bec14f9e3ff9e556f17f952fd4/packages/ses/src/whitelist.js#L504 effectively forces Object.prototype.__proto__ = null?

This just makes printing of objects under SES extremely annoying (displays Object <[Object: null prototype] {}> { ... } under Node.js instead of just { ... }).

Shouldn't we instead have?

  '%ObjectPrototype%': {
    // 19.1.3 Properties of the Object Prototype Object
    '[[Proto]]': '%ObjectPrototype%',
@erights
Copy link
Contributor

erights commented Sep 28, 2020

The alternative you show is an inheritance cycle, where Object.prototype.__proto__ === Object.prototype. Fortunately, this isn't even possible in JavaScript.

Other than the Object.prototype object itself, what other objects should inherit for Object.prototype that are instead inheriting from null?

@michaelfig
Copy link
Member Author

Here is the behaviour that annoys me:

import 'ses';
console.log({});
lockdown();
console.log({});

I get the following:

node -r esm foo.js
{}
Object <[Object: null prototype] {}> {}

@erights
Copy link
Contributor

erights commented Sep 28, 2020

I agree that is a problem. I've noticed that too. We need to diagnose what's causing it. I think the explanation lies elsewhere, but I do not understand it and have not experimented.

@michaelfig michaelfig changed the title Must Object.prototype.__proto__ be null? Annoying display of Object <[Object: null prototype] {}> Sep 29, 2020
@erights
Copy link
Contributor

erights commented Feb 26, 2021

This is waiting for us to find and fix where something in agoric-sdk associated with xsnap is overriding a constructor property by assignment. Only when that's fixed can we stop tuning Object.prototype.constructor into an accessor and fix this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants