summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/prototype/then/context-check-on-entry.js
blob: 794407fa72294a92e9dafd6e006f410de0612fa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
es6id: 25.4.5.3
description: >
  Throws a TypeError if `this` is not a Promise object.
info: |
  Promise.prototype.then ( onFulfilled , onRejected )

  1. Let promise be the this value.
  2. If IsPromise(promise) is false, throw a TypeError exception.
  ...
---*/

var object = {
  get constructor() {
    throw new Test262Error("get constructor called");
  }
};

assert.throws(TypeError, function() {
  Promise.prototype.then.call(object);
});

reportCompare(0, 0);