summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Source-element-01.js
blob: c674d2774c7d4ee259d7ab8d9c9dd90b31942f4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Source.prototype.element can be an object or undefined.

var g = newGlobal({newCompartment: true});
var dbg = new Debugger;
var gw = dbg.addDebuggee(g);
g.evaluate("function f(x) { return 2*x; }", {element: { foo: "bar" }});
var fw = gw.getOwnPropertyDescriptor('f').value;
assertEq(typeof fw.script.source.element, "object");
assertEq(fw.script.source.element instanceof Debugger.Object, true);
assertEq(fw.script.source.element.getOwnPropertyDescriptor("foo").value, "bar");
g.evaluate("function f(x) { return 2*x; }");
var fw = gw.getOwnPropertyDescriptor('f').value;
assertEq(typeof fw.script.source.element, "undefined");