summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/prototype/no-promise-state.js
blob: 096249ac1d63be4f2d3f3b8434449f8409a87e55 (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
27
28
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-properties-of-the-promise-prototype-object
description: Promise.prototype does not have a [[PromiseState]] internal slot
info: |
  The Promise prototype object is the intrinsic object %PromisePrototype%. The
  value of the [[Prototype]] internal slot of the Promise prototype object is
  the intrinsic object %ObjectPrototype%. The Promise prototype object is an
  ordinary object. It does not have a [[PromiseState]] internal slot or any of
  the other internal slots of Promise instances.

  25.4.5.3 Promise.prototype.then

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

  25.4.1.6 IsPromise

  1. If Type(x) is not Object, return false.
  2. If x does not have a [[PromiseState]] internal slot, return false.
---*/

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

reportCompare(0, 0);