mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1581562 - Empty debugger while debugging watchpoints. r=bhackett
Differential Revision: https://phabricator.services.mozilla.com/D47705 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
8839b4e88b
commit
9c5a0d2916
@ -113,7 +113,9 @@ const proto = {
|
||||
if (this._originalDescriptors.has(property)) {
|
||||
return;
|
||||
}
|
||||
const desc = this.obj.getOwnPropertyDescriptor(property);
|
||||
|
||||
const obj = this.rawValue();
|
||||
const desc = Object.getOwnPropertyDescriptor(obj, property);
|
||||
|
||||
if (desc.set || desc.get || !desc.configurable) {
|
||||
return;
|
||||
@ -151,7 +153,7 @@ const proto = {
|
||||
pauseAndRespond("setWatchpoint");
|
||||
desc.value = v;
|
||||
}),
|
||||
get: this.obj.makeDebuggeeValue(v => {
|
||||
get: this.obj.makeDebuggeeValue(() => {
|
||||
return desc.value;
|
||||
}),
|
||||
});
|
||||
@ -794,7 +796,9 @@ const proto = {
|
||||
} else if (this._originalDescriptors.has(name)) {
|
||||
const watchpointType = this._originalDescriptors.get(name).watchpointType;
|
||||
desc = this._originalDescriptors.get(name).desc;
|
||||
retval.value = this.hooks.createValueGrip(desc.value);
|
||||
retval.value = this.hooks.createValueGrip(
|
||||
this.obj.makeDebuggeeValue(desc.value)
|
||||
);
|
||||
retval.watchpoint = watchpointType;
|
||||
} else {
|
||||
if ("get" in desc) {
|
||||
|
@ -201,6 +201,14 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||
return this._threadLifetimePool;
|
||||
},
|
||||
|
||||
getThreadLifetimeObject(raw) {
|
||||
return this.threadLifetimePool.objectActors.get(raw);
|
||||
},
|
||||
|
||||
createValueGrip(value) {
|
||||
return createValueGrip(value, this.threadLifetimePool, this.objectGrip);
|
||||
},
|
||||
|
||||
get sources() {
|
||||
return this._parent.sources;
|
||||
},
|
||||
|
@ -1285,7 +1285,14 @@ const WebConsoleActor = ActorClassWithSpec(webconsoleSpec, {
|
||||
let resultGrip;
|
||||
if (!awaitResult) {
|
||||
try {
|
||||
resultGrip = this.createValueGrip(result);
|
||||
const objectActor = this.parentActor.threadActor.getThreadLifetimeObject(
|
||||
result
|
||||
);
|
||||
if (objectActor) {
|
||||
resultGrip = this.parentActor.threadActor.createValueGrip(result);
|
||||
} else {
|
||||
resultGrip = this.createValueGrip(result);
|
||||
}
|
||||
} catch (e) {
|
||||
errorMessage = e;
|
||||
}
|
||||
|
@ -17,7 +17,16 @@ add_task(
|
||||
})
|
||||
);
|
||||
|
||||
async function testSetWatchpoint({ threadFront, debuggee }) {
|
||||
async function testSetWatchpoint({ threadFront, debuggee, targetFront }) {
|
||||
async function evaluateJS(input) {
|
||||
const consoleFront = await targetFront.getFront("console");
|
||||
const { result } = await consoleFront.evaluateJSAsync(input, {
|
||||
thread: threadFront.actor,
|
||||
frameActor: packet.frame.actor,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function evaluateTestCode(debuggee) {
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox(
|
||||
@ -25,8 +34,8 @@ async function testSetWatchpoint({ threadFront, debuggee }) {
|
||||
function stopMe(obj) { // 2
|
||||
debugger; // 3
|
||||
obj.a = 2; // 4
|
||||
} //
|
||||
stopMe({a: 1})`,
|
||||
} //
|
||||
stopMe({a: { b: 1 }})`,
|
||||
debuggee,
|
||||
"1.8",
|
||||
"test_watchpoint-01.js",
|
||||
@ -39,21 +48,27 @@ async function testSetWatchpoint({ threadFront, debuggee }) {
|
||||
threadFront
|
||||
);
|
||||
|
||||
//Test that we paused on the debugger statement.
|
||||
info("Test that we paused on the debugger statement.");
|
||||
Assert.equal(packet.frame.where.line, 3);
|
||||
|
||||
//Add set watchpoint.
|
||||
info("Add set watchpoint.");
|
||||
const args = packet.frame.arguments;
|
||||
const obj = args[0];
|
||||
const objClient = threadFront.pauseGrip(obj);
|
||||
await objClient.addWatchpoint("a", "obj.a", "set");
|
||||
|
||||
//Test that watchpoint triggers pause on set.
|
||||
let result = await evaluateJS("obj.a");
|
||||
Assert.equal(result.preview.ownProperties.b.value, 1)
|
||||
|
||||
result = await evaluateJS("obj.a.b");
|
||||
Assert.equal(result, 1);
|
||||
|
||||
info("Test that watchpoint triggers pause on set.");
|
||||
const packet2 = await resumeAndWaitForPause(threadFront);
|
||||
Assert.equal(packet2.frame.where.line, 4);
|
||||
Assert.equal(packet2.why.type, "setWatchpoint");
|
||||
Assert.equal(obj.preview.ownProperties.a.value, 1);
|
||||
|
||||
Assert.equal(obj.preview.ownProperties.a.value.ownPropertyLength, 1);
|
||||
|
||||
await resume(threadFront);
|
||||
}
|
||||
|
||||
@ -66,7 +81,7 @@ async function testGetWatchpoint({ threadFront, debuggee }) {
|
||||
debugger; // 3
|
||||
obj.a + 4; // 4
|
||||
} //
|
||||
stopMe({a: 1})`,
|
||||
stopMe({a: 1})`,
|
||||
debuggee,
|
||||
"1.8",
|
||||
"test_watchpoint-01.js",
|
||||
@ -82,18 +97,18 @@ async function testGetWatchpoint({ threadFront, debuggee }) {
|
||||
//Test that we paused on the debugger statement.
|
||||
Assert.equal(packet.frame.where.line, 3);
|
||||
|
||||
//Add get watchpoint.
|
||||
info("Add get watchpoint.");
|
||||
const args = packet.frame.arguments;
|
||||
const obj = args[0];
|
||||
const objClient = threadFront.pauseGrip(obj);
|
||||
await objClient.addWatchpoint("a", "obj.a", "get");
|
||||
|
||||
//Test that watchpoint triggers pause on get.
|
||||
info('Test that watchpoint triggers pause on get.');
|
||||
const packet2 = await resumeAndWaitForPause(threadFront);
|
||||
Assert.equal(packet2.frame.where.line, 4);
|
||||
Assert.equal(packet2.why.type, "getWatchpoint");
|
||||
Assert.equal(obj.preview.ownProperties.a.value, 1);
|
||||
|
||||
|
||||
await resume(threadFront);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user