~ubuntu-branches/ubuntu/vivid/mozjs24/vivid

« back to all changes in this revision

Viewing changes to js/src/jit-test/tests/proxy/testDirectProxyValidateProperty3.js

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2014-02-11 21:55:34 UTC
  • Revision ID: package-import@ubuntu.com-20140211215534-m1zyq5aj59md3y07
Tags: upstream-24.2.0
ImportĀ upstreamĀ versionĀ 24.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
load(libdir + "asserts.js");
 
2
 
 
3
/*
 
4
 * Throw a TypeError if the current descriptor is a data descriptor and the
 
5
 * descriptor returned by the trap is not, or vice versa, and the current
 
6
 * descriptor is non-configurable
 
7
 */
 
8
var target = {};
 
9
Object.defineProperty(target, 'foo', {
 
10
    value: 'bar',
 
11
    configurable: false
 
12
});
 
13
var caught = false;
 
14
assertThrowsInstanceOf(function () { 
 
15
    Object.getOwnPropertyDescriptor(new Proxy(target, {
 
16
        getOwnPropertyDescriptor: function (target, name) {
 
17
            return {
 
18
                get: function () {
 
19
                    return 'bar';
 
20
                },
 
21
                configurable: false
 
22
            };
 
23
        }
 
24
    }), 'foo');
 
25
}, TypeError);
 
26
 
 
27
var target = {};
 
28
Object.defineProperty(target, 'foo', {
 
29
    value: function () {
 
30
        return 'bar';
 
31
    },
 
32
    configurable: false
 
33
});
 
34
assertThrowsInstanceOf(function () { 
 
35
    Object.getOwnPropertyDescriptor(new Proxy(target, {
 
36
        getOwnPropertyDescriptor: function (target, name) {
 
37
            return {
 
38
                value: 'bar',
 
39
                configurable: false
 
40
            };
 
41
        }
 
42
    }), 'foo');
 
43
}, TypeError);