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

« back to all changes in this revision

Viewing changes to js/src/jit-test/tests/debug/Object-defineProperty-09.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
// defineProperty can't re-define non-configurable properties.
 
2
// Also: when defineProperty throws, the exception is native to the debugger
 
3
// compartment, not a wrapper.
 
4
 
 
5
var g = newGlobal('new-compartment');
 
6
var dbg = new Debugger;
 
7
var gw = dbg.addDebuggee(g);
 
8
gw.defineProperty("p", {value: 1});
 
9
g.p = 4;
 
10
assertEq(g.p, 1);
 
11
 
 
12
var threw;
 
13
try {
 
14
    gw.defineProperty("p", {value: 2});
 
15
    threw = false;
 
16
} catch (exc) {
 
17
    threw = true;
 
18
    assertEq(exc instanceof TypeError, true);
 
19
    assertEq(typeof exc.message, "string");
 
20
    assertEq(typeof exc.stack, "string");
 
21
}
 
22
assertEq(threw, true);
 
23
 
 
24
assertEq(g.p, 1);