blob: 6fe3b172bf9ae9e3170dd6c095f70694c0e6b9e2 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// Copyright 2014 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Ben Murdochda12d292016-06-02 14:46:10 +01005// A non-callable reject function throws eagerly
Ben Murdochb8a8cc12014-11-26 15:28:44 +00006
7var p = new Promise(function(resolve, reject) {
8 log.push("resolve");
9 resolve();
10});
11
12function MyPromise(resolver) {
13 var reject = undefined;
14 var resolve = function() { };
Ben Murdochb8a8cc12014-11-26 15:28:44 +000015 resolver(resolve, reject);
16};
17
18MyPromise.prototype = new Promise(function() {});
Ben Murdochda12d292016-06-02 14:46:10 +010019MyPromise.__proto__ = Promise;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000020p.constructor = MyPromise;
21
Ben Murdochda12d292016-06-02 14:46:10 +010022assertThrows(()=> p.then(function() { }), TypeError);