summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Promise/prototype/finally/this-value-then-poisoned.js
blob: 44e41739892d8e23d88f548bfbee9ad2cd757a59 (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) 2017 Jordan Harband. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
author: Jordan Harband
description: >
  Promise.prototype.finally called with a `this` value whose `then` property is
  an accessor property that returns an abrupt completion
esid: sec-promise.prototype.finally
features: [Promise.prototype.finally]
---*/

var poisonedThen = Object.defineProperty(new Promise(function() {}), 'then', {
  get: function() {
    throw new Test262Error();
  }
});

assert.throws(Test262Error, function() {
  Promise.prototype.finally.call(poisonedThen);
});

assert.throws(Test262Error, function() {
  poisonedThen.finally();
});

reportCompare(0, 0);