зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1455750
- Provide method for server to skip pausing. r=jimb
This commit is contained in:
Родитель
7c89a31ba7
Коммит
167fb861fd
|
@ -149,6 +149,7 @@ let BreakpointActor = ActorClassWithSpec(breakpointSpec, {
|
|||
let url = originalSourceActor.url;
|
||||
|
||||
if (this.threadActor.sources.isBlackBoxed(url)
|
||||
|| this.threadActor.skipBreakpoints
|
||||
|| frame.onStep) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
|
@ -1511,9 +1511,16 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
this.sources.getOriginalLocation(generatedLocation));
|
||||
const url = originalSourceActor ? originalSourceActor.url : null;
|
||||
|
||||
return this.sources.isBlackBoxed(url) || frame.onStep
|
||||
? undefined
|
||||
: this._pauseAndRespond(frame, { type: "debuggerStatement" });
|
||||
if (this.skipBreakpoints || this.sources.isBlackBoxed(url) || frame.onStep) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this._pauseAndRespond(frame, { type: "debuggerStatement" });
|
||||
},
|
||||
|
||||
onSkipBreakpoints: function({ skip }) {
|
||||
this.skipBreakpoints = skip;
|
||||
return { skip };
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1552,7 +1559,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
|
||||
// We ignore sources without a url because we do not
|
||||
// want to pause at console evaluations or watch expressions.
|
||||
if (!url || this.sources.isBlackBoxed(url)) {
|
||||
if (!url || this.skipBreakpoints || this.sources.isBlackBoxed(url)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
@ -1755,7 +1762,8 @@ Object.assign(ThreadActor.prototype.requestTypes, {
|
|||
"releaseMany": ThreadActor.prototype.onReleaseMany,
|
||||
"sources": ThreadActor.prototype.onSources,
|
||||
"threadGrips": ThreadActor.prototype.onThreadGrips,
|
||||
"prototypesAndProperties": ThreadActor.prototype.onPrototypesAndProperties
|
||||
"prototypesAndProperties": ThreadActor.prototype.onPrototypesAndProperties,
|
||||
"skipBreakpoints": ThreadActor.prototype.onSkipBreakpoints
|
||||
});
|
||||
|
||||
exports.ThreadActor = ThreadActor;
|
||||
|
|
|
@ -219,6 +219,16 @@ function waitForPause(threadClient) {
|
|||
return waitForEvent(threadClient, "paused");
|
||||
}
|
||||
|
||||
function waitForProperty(dbg, property) {
|
||||
return new Promise(resolve => {
|
||||
Object.defineProperty(dbg, property, {
|
||||
set(newValue) {
|
||||
resolve(newValue);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function setBreakpoint(sourceClient, location) {
|
||||
dump("Setting breakpoint.\n");
|
||||
return sourceClient.setBreakpoint(location);
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Check basic step-over functionality with pause points
|
||||
* for the first statement and end of the last statement.
|
||||
*/
|
||||
|
||||
var gDebuggee;
|
||||
var gClient;
|
||||
var gCallback;
|
||||
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
run_test_with_server(DebuggerServer, function() {
|
||||
run_test_with_server(WorkerDebuggerServer, do_test_finished);
|
||||
});
|
||||
}
|
||||
|
||||
function run_test_with_server(server, callback) {
|
||||
gCallback = callback;
|
||||
initTestDebuggerServer(server);
|
||||
gDebuggee = addTestGlobal("test-stepping", server);
|
||||
gClient = new DebuggerClient(server.connectPipe());
|
||||
gClient.connect(test_simple_stepping);
|
||||
}
|
||||
|
||||
async function test_simple_stepping() {
|
||||
const [attachResponse,, threadClient] = await attachTestTabAndResume(gClient,
|
||||
"test-stepping");
|
||||
ok(!attachResponse.error, "Should not get an error attaching");
|
||||
|
||||
dumpn("Evaluating test code and waiting for first debugger statement");
|
||||
const dbgStmt = await executeOnNextTickAndWaitForPause(evaluateTestCode, gClient);
|
||||
equal(dbgStmt.frame.where.line, 2, "Should be at debugger statement on line 2");
|
||||
equal(gDebuggee.a, undefined);
|
||||
equal(gDebuggee.b, undefined);
|
||||
|
||||
const source = await getSource(threadClient, "test_stepping-01-test-code.js");
|
||||
|
||||
// Add pause points for the first and end of the last statement.
|
||||
// Note: we intentionally ignore the second statement.
|
||||
source.setPausePoints([{
|
||||
location: {line: 3, column: 8},
|
||||
types: {breakpoint: true, stepOver: true}
|
||||
},
|
||||
{
|
||||
location: {line: 4, column: 14},
|
||||
types: {breakpoint: true, stepOver: true}
|
||||
}]);
|
||||
|
||||
dumpn("Step Over to line 3");
|
||||
const step1 = await stepOver(gClient, threadClient);
|
||||
equal(step1.type, "paused");
|
||||
equal(step1.why.type, "resumeLimit");
|
||||
equal(step1.frame.where.line, 3);
|
||||
equal(step1.frame.where.column, 8);
|
||||
|
||||
equal(gDebuggee.a, undefined);
|
||||
equal(gDebuggee.b, undefined);
|
||||
|
||||
dumpn("Step Over to line 4");
|
||||
const step2 = await stepOver(gClient, threadClient);
|
||||
equal(step2.type, "paused");
|
||||
equal(step2.why.type, "resumeLimit");
|
||||
equal(step2.frame.where.line, 4);
|
||||
equal(step2.frame.where.column, 8);
|
||||
|
||||
equal(gDebuggee.a, 1);
|
||||
equal(gDebuggee.b, undefined);
|
||||
|
||||
dumpn("Step Over to the end of line 4");
|
||||
const step3 = await stepOver(gClient, threadClient);
|
||||
equal(step3.type, "paused");
|
||||
equal(step3.why.type, "resumeLimit");
|
||||
equal(step3.frame.where.line, 4);
|
||||
equal(step3.frame.where.column, 14);
|
||||
equal(gDebuggee.a, 1);
|
||||
equal(gDebuggee.b, 2);
|
||||
|
||||
finishClient(gClient, gCallback);
|
||||
}
|
||||
|
||||
function evaluateTestCode() {
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox(
|
||||
` // 1
|
||||
debugger; // 2
|
||||
var a = 1; // 3
|
||||
var b = 2;`, // 4
|
||||
gDebuggee,
|
||||
"1.8",
|
||||
"test_stepping-01-test-code.js",
|
||||
1
|
||||
);
|
||||
/* eslint-disable */
|
||||
}
|
|
@ -189,6 +189,7 @@ reason = bug 1104838
|
|||
[test_stepping-07.js]
|
||||
[test_stepping-08.js]
|
||||
[test_stepping-with-pause-points.js]
|
||||
[test_stepping-with-skip-breakpoints.js]
|
||||
[test_framebindings-01.js]
|
||||
[test_framebindings-02.js]
|
||||
[test_framebindings-03.js]
|
||||
|
|
|
@ -395,6 +395,17 @@ ThreadClient.prototype = {
|
|||
count: arg(1)
|
||||
}),
|
||||
|
||||
/**
|
||||
* Toggle pausing via breakpoints in the server.
|
||||
*
|
||||
* @param skip boolean
|
||||
* Whether the server should skip pausing via breakpoints
|
||||
*/
|
||||
skipBreakpoints: DebuggerClient.requester({
|
||||
type: "skipBreakpoints",
|
||||
skip: arg(0),
|
||||
}),
|
||||
|
||||
/**
|
||||
* An array of cached frames. Clients can observe the framesadded and
|
||||
* framescleared event to keep up to date on changes to this cache,
|
||||
|
|
Загрузка…
Ссылка в новой задаче