summaryrefslogtreecommitdiff
path: root/test/built-ins/Promise/prototype/then/S25.4.2.1_A3.1_T1.js
blob: 18bb36f6f75b92f6a5eafe9e2daadb5225e55ec0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
// See LICENSE for details.

/*---
info: >
    Promise reaction jobs have predictable environment
author: Sam Mikes
description: Promise.onFulfilled gets undefined as 'this'
flags: [noStrict]
includes: [fnGlobalObject.js]
---*/

var expectedThis = fnGlobalObject(),
    obj = {};

var p = Promise.resolve(obj).then(function(arg) {
    if (this !== expectedThis) {
        $ERROR("'this' must be global object, got " + this);
    }
    if (arg !== obj) {
        $ERROR("Expected promise to be fulfilled by obj, actually " + arg);
    }
}).then($DONE, $DONE);