1 // 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 5 // A non-callable reject function throws eagerly 6 7 var p = new Promise(function(resolve, reject) { 8 log.push("resolve"); 9 resolve(); 10 }); 11 12 function MyPromise(resolver) { 13 var reject = undefined; 14 var resolve = function() { }; 15 resolver(resolve, reject); 16 }; 17 18 MyPromise.prototype = new Promise(function() {}); 19 MyPromise.__proto__ = Promise; 20 p.constructor = MyPromise; 21 22 assertThrows(()=> p.then(function() { }), TypeError); 23