d9c45337a4
This check is guaranteed by the Promise spec and tested by test262 tests. It only has to run for subclasses. This patch adds the check to the Promise code. BUG=v8:4633 R=adamk LOG=Y Review URL: https://codereview.chromium.org/1780823003 Cr-Commit-Position: refs/heads/master@{#34693}
23 lines
592 B
JavaScript
23 lines
592 B
JavaScript
// Copyright 2014 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// A non-callable reject function throws eagerly
|
|
|
|
var p = new Promise(function(resolve, reject) {
|
|
log.push("resolve");
|
|
resolve();
|
|
});
|
|
|
|
function MyPromise(resolver) {
|
|
var reject = undefined;
|
|
var resolve = function() { };
|
|
resolver(resolve, reject);
|
|
};
|
|
|
|
MyPromise.prototype = new Promise(function() {});
|
|
MyPromise.__proto__ = Promise;
|
|
p.constructor = MyPromise;
|
|
|
|
assertThrows(()=> p.then(function() { }), TypeError);
|