mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 796073: Use Debugger.Object.prototype.makeDebuggeeValue where appropriate, not Debugger.prototype.addDebuggee. r=luke
Many tests use Debugger.prototype.addDebuggee to produce Debugger.Object instances referring to random objects. Now we have Debugger.Object.prototype.makeDebuggeeValue to do that, which is more careful about wrappers. This patch changes all the existing tests that abuse addDebuggee in this way (well, they didn't have any choice when they were written) to use makeDebuggeeValue instead, in preparation for tightening up addDebuggee to only accept global objects.
This commit is contained in:
parent
9e7714919a
commit
b755c3b751
@ -5,10 +5,11 @@ g.eval('function f(){}');
|
|||||||
g.eval('function g(){}');
|
g.eval('function g(){}');
|
||||||
g.eval('function h(){}');
|
g.eval('function h(){}');
|
||||||
|
|
||||||
var dbg = new Debugger(g);
|
var dbg = new Debugger();
|
||||||
var fw = dbg.addDebuggee(g.f);
|
var gw = dbg.addDebuggee(g);
|
||||||
var gw = dbg.addDebuggee(g.g);
|
var fw = gw.makeDebuggeeValue(g.f);
|
||||||
var hw = dbg.addDebuggee(g.h);
|
var gw = gw.makeDebuggeeValue(g.g);
|
||||||
|
var hw = gw.makeDebuggeeValue(g.h);
|
||||||
|
|
||||||
assertEq(dbg.findScripts().indexOf(fw.script) != -1, true);
|
assertEq(dbg.findScripts().indexOf(fw.script) != -1, true);
|
||||||
assertEq(dbg.findScripts().indexOf(gw.script) != -1, true);
|
assertEq(dbg.findScripts().indexOf(gw.script) != -1, true);
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
// findScripts' result includes scripts for nested functions.
|
// findScripts' result includes scripts for nested functions.
|
||||||
var g = newGlobal('new-compartment');
|
var g = newGlobal('new-compartment');
|
||||||
var dbg = new Debugger(g);
|
var dbg = new Debugger();
|
||||||
|
var gw = dbg.addDebuggee(g);
|
||||||
var log;
|
var log;
|
||||||
|
|
||||||
g.eval('function f() { return function g() { return function h() { return "Squee!"; } } }');
|
g.eval('function f() { return function g() { return function h() { return "Squee!"; } } }');
|
||||||
var fw = dbg.addDebuggee(g.f);
|
var fw = gw.makeDebuggeeValue(g.f);
|
||||||
var gw = dbg.addDebuggee(g.f());
|
var gw = gw.makeDebuggeeValue(g.f());
|
||||||
var hw = dbg.addDebuggee(g.f()());
|
var hw = gw.makeDebuggeeValue(g.f()());
|
||||||
|
|
||||||
assertEq(fw.script != gw.script, true);
|
assertEq(fw.script != gw.script, true);
|
||||||
assertEq(fw.script != hw.script, true);
|
assertEq(fw.script != hw.script, true);
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
// In a debugger with multiple debuggees, findScripts finds scripts across all debuggees.
|
// In a debugger with multiple debuggees, findScripts finds scripts across all debuggees.
|
||||||
var g1 = newGlobal('new-compartment');
|
var g1 = newGlobal('new-compartment');
|
||||||
var g2 = newGlobal('new-compartment');
|
var g2 = newGlobal('new-compartment');
|
||||||
var dbg = new Debugger(g1, g2);
|
var dbg = new Debugger();
|
||||||
|
var g1w = dbg.addDebuggee(g1);
|
||||||
|
var g2w = dbg.addDebuggee(g2);
|
||||||
|
|
||||||
g1.eval('function f() {}');
|
g1.eval('function f() {}');
|
||||||
g2.eval('function g() {}');
|
g2.eval('function g() {}');
|
||||||
|
|
||||||
var scripts = dbg.findScripts();
|
var scripts = dbg.findScripts();
|
||||||
assertEq(scripts.indexOf(dbg.addDebuggee(g1.f).script) != -1, true);
|
assertEq(scripts.indexOf(g1w.makeDebuggeeValue(g1.f).script) != -1, true);
|
||||||
assertEq(scripts.indexOf(dbg.addDebuggee(g2.g).script) != -1, true);
|
assertEq(scripts.indexOf(g2w.makeDebuggeeValue(g2.g).script) != -1, true);
|
||||||
|
@ -3,13 +3,15 @@ var g1 = newGlobal('new-compartment');
|
|||||||
var g2 = newGlobal('new-compartment');
|
var g2 = newGlobal('new-compartment');
|
||||||
var g3 = newGlobal('new-compartment');
|
var g3 = newGlobal('new-compartment');
|
||||||
|
|
||||||
var dbg = new Debugger(g1, g2);
|
var dbg = new Debugger();
|
||||||
|
var g1w = dbg.addDebuggee(g1);
|
||||||
|
var g2w = dbg.addDebuggee(g2);
|
||||||
|
|
||||||
g1.eval('function f() {}');
|
g1.eval('function f() {}');
|
||||||
g2.eval('function g() {}');
|
g2.eval('function g() {}');
|
||||||
g2.eval('function h() {}');
|
g2.eval('function h() {}');
|
||||||
var g1fw = dbg.addDebuggee(g1.f);
|
var g1fw = g1w.makeDebuggeeValue(g1.f);
|
||||||
var g2gw = dbg.addDebuggee(g2.g);
|
var g2gw = g2w.makeDebuggeeValue(g2.g);
|
||||||
|
|
||||||
var scripts;
|
var scripts;
|
||||||
|
|
||||||
|
@ -11,12 +11,15 @@ g2.eval('function g2f() {}');
|
|||||||
url2 = scriptdir + "Debugger-findScripts-08-script2";
|
url2 = scriptdir + "Debugger-findScripts-08-script2";
|
||||||
load(url2);
|
load(url2);
|
||||||
|
|
||||||
var dbg = new Debugger(g1, g2, g3);
|
var dbg = new Debugger();
|
||||||
|
var g1w = dbg.addDebuggee(g1);
|
||||||
|
var g2w = dbg.addDebuggee(g2);
|
||||||
|
var g3w = dbg.addDebuggee(g3);
|
||||||
|
|
||||||
var g1fw = dbg.addDebuggee(g1.g1f);
|
var g1fw = g1w.makeDebuggeeValue(g1.g1f);
|
||||||
var g1gw = dbg.addDebuggee(g1.g1g);
|
var g1gw = g1w.makeDebuggeeValue(g1.g1g);
|
||||||
var g2fw = dbg.addDebuggee(g2.g2f);
|
var g2fw = g2w.makeDebuggeeValue(g2.g2f);
|
||||||
var g2gw = dbg.addDebuggee(g2.g2g);
|
var g2gw = g2w.makeDebuggeeValue(g2.g2g);
|
||||||
|
|
||||||
// Find the url of this file.
|
// Find the url of this file.
|
||||||
url = g1fw.script.url;
|
url = g1fw.script.url;
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
// Debugger.prototype.findScripts can filter scripts by line number.
|
// Debugger.prototype.findScripts can filter scripts by line number.
|
||||||
var g = newGlobal('new-compartment');
|
var g = newGlobal();
|
||||||
var dbg = new Debugger(g);
|
var dbg = new Debugger();
|
||||||
|
var gw = dbg.addDebuggee(g);
|
||||||
|
|
||||||
var scriptname = scriptdir + 'Debugger-findScripts-11-script2';
|
var scriptname = scriptdir + 'Debugger-findScripts-11-script2';
|
||||||
g.load(scriptname);
|
g.load(scriptname);
|
||||||
|
|
||||||
var gfw = dbg.addDebuggee(g.f);
|
var gfw = gw.makeDebuggeeValue(g.f);
|
||||||
var ggw = dbg.addDebuggee(g.f());
|
var ggw = gw.makeDebuggeeValue(g.f());
|
||||||
var ghw = dbg.addDebuggee(g.h);
|
var ghw = gw.makeDebuggeeValue(g.h);
|
||||||
|
|
||||||
// Specifying a line outside of all functions screens out all function scripts.
|
// Specifying a line outside of all functions screens out all function scripts.
|
||||||
assertEq(dbg.findScripts({url:scriptname, line:3}).indexOf(gfw.script) != -1, false);
|
assertEq(dbg.findScripts({url:scriptname, line:3}).indexOf(gfw.script) != -1, false);
|
||||||
|
@ -18,7 +18,8 @@ var g3 = newGlobal('new-compartment');
|
|||||||
var dbg = new Debugger(g1, g2, g3);
|
var dbg = new Debugger(g1, g2, g3);
|
||||||
|
|
||||||
function script(func) {
|
function script(func) {
|
||||||
var script = dbg.addDebuggee(func).script;
|
var gw = dbg.addDebuggee(func.global);
|
||||||
|
var script = gw.makeDebuggeeValue(func).script;
|
||||||
script.toString = function ()
|
script.toString = function ()
|
||||||
"[Debugger.Script for " + func.name + " in " + uneval(func.global) + "]";
|
"[Debugger.Script for " + func.name + " in " + uneval(func.global) + "]";
|
||||||
return script;
|
return script;
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
// Debugger.prototype.findScripts can find the innermost script at a given
|
// Debugger.prototype.findScripts can find the innermost script at a given
|
||||||
// source location.
|
// source location.
|
||||||
var g = newGlobal('new-compartment');
|
var g = newGlobal('new-compartment');
|
||||||
var dbg = new Debugger(g);
|
var dbg = new Debugger();
|
||||||
|
var gw = dbg.addDebuggee(g);
|
||||||
|
|
||||||
function script(f) {
|
function script(f) {
|
||||||
return dbg.addDebuggee(f).script;
|
return gw.makeDebuggeeValue(f).script;
|
||||||
}
|
}
|
||||||
|
|
||||||
function arrayIsOnly(array, element) {
|
function arrayIsOnly(array, element) {
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
// Setting onPop handlers from breakpoint handlers works.
|
// Setting onPop handlers from breakpoint handlers works.
|
||||||
var g = newGlobal('new-compartment');
|
var g = newGlobal('new-compartment');
|
||||||
g.eval("function f(){ return 'to normalcy'; }");
|
g.eval("function f(){ return 'to normalcy'; }");
|
||||||
var dbg = new Debugger(g);
|
var dbg = new Debugger();
|
||||||
|
var gw = dbg.addDebuggee(g);
|
||||||
var log;
|
var log;
|
||||||
|
|
||||||
// Set a breakpoint at the start of g.f
|
// Set a breakpoint at the start of g.f
|
||||||
var gf = dbg.addDebuggee(g.f); // addDebuggee used as Debugger.Object factory
|
var gf = gw.makeDebuggeeValue(g.f);
|
||||||
var fStartOffset = gf.script.getLineOffsets(gf.script.startLine)[0];
|
var fStartOffset = gf.script.getLineOffsets(gf.script.startLine)[0];
|
||||||
gf.script.setBreakpoint(fStartOffset, {
|
gf.script.setBreakpoint(fStartOffset, {
|
||||||
hit: function handleHit(frame) {
|
hit: function handleHit(frame) {
|
||||||
|
@ -5,7 +5,8 @@ var obj = g.eval("({x: 1})");
|
|||||||
assertEq(g.Object.isExtensible(obj), true);
|
assertEq(g.Object.isExtensible(obj), true);
|
||||||
|
|
||||||
var dbg = new Debugger;
|
var dbg = new Debugger;
|
||||||
var objw = dbg.addDebuggee(obj);
|
var gw = dbg.addDebuggee(g);
|
||||||
|
var objw = gw.makeDebuggeeValue(obj);
|
||||||
assertEq(objw.isExtensible(), true);
|
assertEq(objw.isExtensible(), true);
|
||||||
|
|
||||||
assertEq(objw.preventExtensions(), undefined);
|
assertEq(objw.preventExtensions(), undefined);
|
||||||
|
@ -13,14 +13,15 @@ var g = newGlobal('new-compartment');
|
|||||||
g.eval("function f(frame) { n++; return 42; }");
|
g.eval("function f(frame) { n++; return 42; }");
|
||||||
g.n = 0;
|
g.n = 0;
|
||||||
|
|
||||||
var dbg = Debugger(g);
|
var dbg = Debugger();
|
||||||
|
var gw = dbg.addDebuggee(g);
|
||||||
|
|
||||||
// Register the debuggee function as the onEnterFrame handler. When we first
|
// Register the debuggee function as the onEnterFrame handler. When we first
|
||||||
// call or eval in the debuggee:
|
// call or eval in the debuggee:
|
||||||
//
|
//
|
||||||
// - The onEnterFrame call reporting that frame's creation is itself an event
|
// - The onEnterFrame call reporting that frame's creation is itself an event
|
||||||
// that must be reported, so we call onEnterFrame again.
|
// that must be reported, so we call onEnterFrame again.
|
||||||
//
|
//
|
||||||
// - SpiderMonkey detects the out-of-control recursion, and generates a "too
|
// - SpiderMonkey detects the out-of-control recursion, and generates a "too
|
||||||
// much recursion" InternalError in the youngest onEnterFrame call.
|
// much recursion" InternalError in the youngest onEnterFrame call.
|
||||||
//
|
//
|
||||||
@ -36,7 +37,7 @@ var dbg = Debugger(g);
|
|||||||
dbg.onEnterFrame = g.f;
|
dbg.onEnterFrame = g.f;
|
||||||
|
|
||||||
// Get a Debugger.Object instance referring to f.
|
// Get a Debugger.Object instance referring to f.
|
||||||
var debuggeeF = dbg.addDebuggee(g.f);
|
var debuggeeF = gw.makeDebuggeeValue(g.f);
|
||||||
|
|
||||||
// Using f.call allows us to catch the termination.
|
// Using f.call allows us to catch the termination.
|
||||||
assertEq(debuggeeF.call(), null);
|
assertEq(debuggeeF.call(), null);
|
||||||
|
Loading…
Reference in New Issue
Block a user