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

{Array,%TypedArray%}.prototype.sort should throw on a non-undefined non-function #1059

Merged
merged 1 commit into from
Jun 12, 2017

Conversation

ljharb
Copy link
Member

@ljharb ljharb commented Jun 10, 2017

Per TC39 consensus on tc39/ecma262#785

@leobalter
Copy link
Member

These tests are great.

Too bad the specs doesn't allow us to observe the order of TypeError if the this value is not Object.

We can also follow up (in another PR) with extra tests using a poisoned get length operation confirming the order of this TypeError:

var obj = {
  get length() {
    throw new Test262Error('wrong verification order');
  }
};
var sort = Array.prototype.sort;

assert.throws(TypeError, () => {
  sort.call(obj, null);
});

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 this pull request may close these issues.

2 participants