Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Promise/S25.4.3.1_A5.1_T2.js

raw
1 // Copyright 2014 Cubane Canada, Inc. All rights reserved.
2 // See LICENSE for details.
3
4 /*---
5 info: |
6 Promise executor has predictable environment
7 'this' should be global object in sloppy mode,
8 undefined in strict mode
9 es6id: S25.4.3.1_A5.1_T2
10 author: Sam Mikes
11 description: Promise executor gets default handling for 'this'
12 flags: [async, onlyStrict]
13 ---*/
14
15 var expectedThis = undefined;
16
17 var p = new Promise(function(resolve) {
18 if (this !== expectedThis) {
19 $ERROR("'this' must be undefined, got " + this);
20 }
21
22 resolve();
23 }).then($DONE, $DONE);