• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
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() { };
15  resolver(resolve, reject);
16};
17
18MyPromise.prototype = new Promise(function() {});
19MyPromise.__proto__ = Promise;
20p.constructor = MyPromise;
21
22assertThrows(()=> p.then(function() { }), TypeError);
23