Enable strict mode testing for sm/Promise

This commit is contained in:
André Bargull 2025-04-30 14:16:35 +02:00 committed by Philip Chimento
parent addfc1f0f0
commit 1b58c83e0a
5 changed files with 7 additions and 17 deletions

View File

@ -2,15 +2,13 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
flags:
- noStrict
description: |
pending
esid: pending
---*/
var promise = Promise.resolve(1);
var FakeCtor = function(exec){ exec(function(){}, function(){}); };
Object.defineProperty(Promise, Symbol.species, {value: FakeCtor});
// This just shouldn't crash. It does without bug 1287334 fixed.
promise.then(function(){});

View File

@ -2,16 +2,14 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
flags:
- noStrict
description: |
pending
esid: pending
---*/
// This just shouldn't trigger a failed assert.
// It does without bug 1288382 fixed.
Promise.all.call(class {
constructor(exec){ exec(()=>{}, ()=>{}); }
static resolve() { return {then(){}}; }
}, [null]);

View File

@ -2,16 +2,14 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
flags:
- noStrict
description: |
pending
esid: pending
---*/
var global = $262.createRealm().global;
Promise.prototype.then = global.Promise.prototype.then;
p1 = new Promise(function f(r) {
var p1 = new Promise(function f(r) {
r(1);
});
p2 = p1.then(function g(){});
var p2 = p1.then(function g(){});

View File

@ -2,12 +2,10 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
flags:
- noStrict
description: |
pending
esid: pending
---*/
assert.sameValue(Object.keys(Promise).length, 0);
assert.sameValue(Object.keys(Promise.prototype).length, 0);

View File

@ -2,16 +2,14 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
flags:
- noStrict
description: |
pending
esid: pending
---*/
assert.sameValue(Promise[Symbol.species], Promise);
let prop = Object.getOwnPropertyDescriptor(Promise, Symbol.species);
assert.sameValue('get' in prop, true);
assert.sameValue(typeof prop.get, 'function');
assert.sameValue('set' in prop, true);
assert.sameValue(prop.set, undefined);