зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1556813 Part 5 - Server changes for instrumentation based control logic, r=loganfsmyth.
--HG-- extra : rebase_source : b678f9170a1d2250c5916d9a9dcbfe7ed82c0a0b extra : histedit_source : 548ebf0a3570200dcf856cff249a518a568e9d5a
This commit is contained in:
Родитель
6bc30082c3
Коммит
35c0ee1da7
|
@ -46,7 +46,7 @@ function BreakpointActor(threadActor, location) {
|
||||||
BreakpointActor.prototype = {
|
BreakpointActor.prototype = {
|
||||||
setOptions(options) {
|
setOptions(options) {
|
||||||
for (const [script, offsets] of this.scripts) {
|
for (const [script, offsets] of this.scripts) {
|
||||||
this._updateOptionsForScript(script, offsets, options);
|
this._newOffsetsOrOptions(script, offsets, this.options, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
@ -71,11 +71,7 @@ BreakpointActor.prototype = {
|
||||||
*/
|
*/
|
||||||
addScript: function(script, offsets) {
|
addScript: function(script, offsets) {
|
||||||
this.scripts.set(script, offsets.concat(this.scripts.get(offsets) || []));
|
this.scripts.set(script, offsets.concat(this.scripts.get(offsets) || []));
|
||||||
for (const offset of offsets) {
|
this._newOffsetsOrOptions(script, offsets, null, this.options);
|
||||||
script.setBreakpoint(offset, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
this._updateOptionsForScript(script, offsets, this.options);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,12 +84,20 @@ BreakpointActor.prototype = {
|
||||||
this.scripts.clear();
|
this.scripts.clear();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Update any state affected by changing options on a script this breakpoint
|
/**
|
||||||
// is associated with.
|
* Called on changes to this breakpoint's script offsets or options.
|
||||||
_updateOptionsForScript(script, offsets, options) {
|
*/
|
||||||
|
_newOffsetsOrOptions(script, offsets, oldOptions, options) {
|
||||||
// When replaying, logging breakpoints are handled using an API to get logged
|
// When replaying, logging breakpoints are handled using an API to get logged
|
||||||
// messages from throughout the recording.
|
// messages from throughout the recording.
|
||||||
if (this.threadActor.dbg.replaying && options.logValue) {
|
if (this.threadActor.dbg.replaying && options.logValue) {
|
||||||
|
if (
|
||||||
|
oldOptions &&
|
||||||
|
oldOptions.logValue == options.logValue &&
|
||||||
|
oldOptions.condition == options.condition
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (const offset of offsets) {
|
for (const offset of offsets) {
|
||||||
const { lineNumber, columnNumber } = script.getOffsetLocation(offset);
|
const { lineNumber, columnNumber } = script.getOffsetLocation(offset);
|
||||||
script.replayVirtualConsoleLog(
|
script.replayVirtualConsoleLog(
|
||||||
|
@ -113,6 +117,15 @@ BreakpointActor.prototype = {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// In all other cases, this is used as a script breakpoint handler.
|
||||||
|
// Clear any existing handler first in case this is called multiple times
|
||||||
|
// after options change.
|
||||||
|
for (const offset of offsets) {
|
||||||
|
script.clearBreakpoint(this, offset);
|
||||||
|
script.setBreakpoint(offset, this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -202,12 +215,6 @@ BreakpointActor.prototype = {
|
||||||
const reason = { type: "breakpoint", actors: [this.actorID] };
|
const reason = { type: "breakpoint", actors: [this.actorID] };
|
||||||
const { condition, logValue } = this.options || {};
|
const { condition, logValue } = this.options || {};
|
||||||
|
|
||||||
// When replaying, breakpoints with log values are handled via
|
|
||||||
// _updateOptionsForScript.
|
|
||||||
if (logValue && this.threadActor.dbg.replaying) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (condition) {
|
if (condition) {
|
||||||
const { result, message } = this.checkCondition(frame, condition);
|
const { result, message } = this.checkCondition(frame, condition);
|
||||||
|
|
||||||
|
|
|
@ -163,20 +163,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||||
this._dbg.replayingOnForcedPause = this.replayingOnForcedPause.bind(
|
this._dbg.replayingOnForcedPause = this.replayingOnForcedPause.bind(
|
||||||
this
|
this
|
||||||
);
|
);
|
||||||
const sendProgress = throttle((recording, executionPoint) => {
|
this._dbg.replayingOnPositionChange = this._makeReplayingOnPositionChange();
|
||||||
if (this.attached) {
|
|
||||||
this.conn.send({
|
|
||||||
type: "progress",
|
|
||||||
from: this.actorID,
|
|
||||||
recording,
|
|
||||||
executionPoint,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
this._dbg.replayingOnPositionChange = this.replayingOnPositionChange.bind(
|
|
||||||
this,
|
|
||||||
sendProgress
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
// Keep the debugger disabled until a client attaches.
|
// Keep the debugger disabled until a client attaches.
|
||||||
this._dbg.enabled = this._state != "detached";
|
this._dbg.enabled = this._state != "detached";
|
||||||
|
@ -1849,10 +1836,23 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||||
* changed its position: a checkpoint was reached or a switch between a
|
* changed its position: a checkpoint was reached or a switch between a
|
||||||
* recording and replaying child process occurred.
|
* recording and replaying child process occurred.
|
||||||
*/
|
*/
|
||||||
replayingOnPositionChange: function(sendProgress) {
|
_makeReplayingOnPositionChange() {
|
||||||
const recording = this.dbg.replayIsRecording();
|
return throttle(() => {
|
||||||
const executionPoint = this.dbg.replayCurrentExecutionPoint();
|
if (this.attached) {
|
||||||
sendProgress(recording, executionPoint);
|
const recording = this.dbg.replayIsRecording();
|
||||||
|
const executionPoint = this.dbg.replayCurrentExecutionPoint();
|
||||||
|
const unscannedRegions = this.dbg.replayUnscannedRegions();
|
||||||
|
const cachedPoints = this.dbg.replayCachedPoints();
|
||||||
|
this.conn.send({
|
||||||
|
type: "progress",
|
||||||
|
from: this.actorID,
|
||||||
|
recording,
|
||||||
|
executionPoint,
|
||||||
|
unscannedRegions,
|
||||||
|
cachedPoints,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,6 +42,8 @@ const threadSpec = generateActorSpec({
|
||||||
progress: {
|
progress: {
|
||||||
recording: Option(0, "json"),
|
recording: Option(0, "json"),
|
||||||
executionPoint: Option(0, "json"),
|
executionPoint: Option(0, "json"),
|
||||||
|
unscannedRegions: Option(0, "json"),
|
||||||
|
cachedPoints: Option(0, "json"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче