зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1505895 Part 2 - Avoid some default breakpoint behaviors for position changes, r=lsmyth.
--HG-- extra : rebase_source : 8cd3d6e3e4fc5008822eac4c1891948e6f5c0846
This commit is contained in:
Родитель
1b3775d3b2
Коммит
b5b531436f
|
@ -585,8 +585,7 @@ SpawnReplayingChildren()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hit any installed breakpoints with the specified kind.
|
// Hit any installed breakpoints with the specified kind.
|
||||||
static void HitBreakpointsWithKind(js::BreakpointPosition::Kind aKind,
|
static void HitBreakpointsWithKind(js::BreakpointPosition::Kind aKind);
|
||||||
bool aRecordingBoundary = false);
|
|
||||||
|
|
||||||
// Change the current active child, and select a new role for the old one.
|
// Change the current active child, and select a new role for the old one.
|
||||||
static void
|
static void
|
||||||
|
@ -1058,8 +1057,7 @@ Resume(bool aForward)
|
||||||
// Don't rewind if we are at the beginning of the recording.
|
// Don't rewind if we are at the beginning of the recording.
|
||||||
if (targetCheckpoint == CheckpointId::Invalid) {
|
if (targetCheckpoint == CheckpointId::Invalid) {
|
||||||
SendMessageToUIProcess("HitRecordingBeginning");
|
SendMessageToUIProcess("HitRecordingBeginning");
|
||||||
HitBreakpointsWithKind(js::BreakpointPosition::Kind::ForcedPause,
|
HitBreakpointsWithKind(js::BreakpointPosition::Kind::ForcedPause);
|
||||||
/* aRecordingBoundary = */ true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1086,8 +1084,7 @@ Resume(bool aForward)
|
||||||
MOZ_RELEASE_ASSERT(!gActiveChild->IsRecording());
|
MOZ_RELEASE_ASSERT(!gActiveChild->IsRecording());
|
||||||
if (!gRecordingChild) {
|
if (!gRecordingChild) {
|
||||||
SendMessageToUIProcess("HitRecordingEndpoint");
|
SendMessageToUIProcess("HitRecordingEndpoint");
|
||||||
HitBreakpointsWithKind(js::BreakpointPosition::Kind::ForcedPause,
|
HitBreakpointsWithKind(js::BreakpointPosition::Kind::ForcedPause);
|
||||||
/* aRecordingBoundary = */ true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1216,34 +1213,47 @@ RecvHitCheckpoint(const HitCheckpointMessage& aMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
HitBreakpoint(uint32_t* aBreakpoints, size_t aNumBreakpoints, bool aRecordingBoundary)
|
HitBreakpoint(uint32_t* aBreakpoints, size_t aNumBreakpoints,
|
||||||
|
js::BreakpointPosition::Kind aSharedKind)
|
||||||
{
|
{
|
||||||
if (!gActiveChild->IsPaused()) {
|
if (!gActiveChild->IsPaused()) {
|
||||||
if (aNumBreakpoints) {
|
|
||||||
Print("Warning: Process resumed before breakpoints were hit.\n");
|
|
||||||
}
|
|
||||||
delete[] aBreakpoints;
|
delete[] aBreakpoints;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MarkActiveChildExplicitPause();
|
switch (aSharedKind) {
|
||||||
|
case js::BreakpointPosition::ForcedPause:
|
||||||
gResumeForwardOrBackward = true;
|
MarkActiveChildExplicitPause();
|
||||||
|
MOZ_FALLTHROUGH;
|
||||||
// Call breakpoint handlers until one of them explicitly resumes forward or
|
case js::BreakpointPosition::PositionChange:
|
||||||
// backward travel.
|
// Call all breakpoint handlers.
|
||||||
for (size_t i = 0; i < aNumBreakpoints && gResumeForwardOrBackward; i++) {
|
for (size_t i = 0; i < aNumBreakpoints; i++) {
|
||||||
AutoSafeJSContext cx;
|
AutoSafeJSContext cx;
|
||||||
if (!js::HitBreakpoint(cx, aBreakpoints[i])) {
|
if (!js::HitBreakpoint(cx, aBreakpoints[i])) {
|
||||||
Print("Warning: hitBreakpoint hook threw an exception.\n");
|
Print("Warning: hitBreakpoint hook threw an exception.\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
default:
|
||||||
|
gResumeForwardOrBackward = true;
|
||||||
|
|
||||||
// If the child was not explicitly resumed by any breakpoint handler, and we
|
MarkActiveChildExplicitPause();
|
||||||
// are not at a forced pause at the recording boundary, resume travel in
|
|
||||||
// whichever direction it was going previously.
|
// Call breakpoint handlers until one of them explicitly resumes forward or
|
||||||
if (gResumeForwardOrBackward && !aRecordingBoundary) {
|
// backward travel.
|
||||||
ResumeForwardOrBackward();
|
for (size_t i = 0; i < aNumBreakpoints && gResumeForwardOrBackward; i++) {
|
||||||
|
AutoSafeJSContext cx;
|
||||||
|
if (!js::HitBreakpoint(cx, aBreakpoints[i])) {
|
||||||
|
Print("Warning: hitBreakpoint hook threw an exception.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the child was not explicitly resumed by any breakpoint handler,
|
||||||
|
// resume travel in whichever direction we were going previously.
|
||||||
|
if (gResumeForwardOrBackward) {
|
||||||
|
ResumeForwardOrBackward();
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] aBreakpoints;
|
delete[] aBreakpoints;
|
||||||
|
@ -1256,11 +1266,11 @@ RecvHitBreakpoint(const HitBreakpointMessage& aMsg)
|
||||||
PodCopy(breakpoints, aMsg.Breakpoints(), aMsg.NumBreakpoints());
|
PodCopy(breakpoints, aMsg.Breakpoints(), aMsg.NumBreakpoints());
|
||||||
gMainThreadMessageLoop->PostTask(NewRunnableFunction("HitBreakpoint", HitBreakpoint,
|
gMainThreadMessageLoop->PostTask(NewRunnableFunction("HitBreakpoint", HitBreakpoint,
|
||||||
breakpoints, aMsg.NumBreakpoints(),
|
breakpoints, aMsg.NumBreakpoints(),
|
||||||
/* aRecordingBoundary = */ false));
|
js::BreakpointPosition::Invalid));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
HitBreakpointsWithKind(js::BreakpointPosition::Kind aKind, bool aRecordingBoundary)
|
HitBreakpointsWithKind(js::BreakpointPosition::Kind aKind)
|
||||||
{
|
{
|
||||||
Vector<uint32_t> breakpoints;
|
Vector<uint32_t> breakpoints;
|
||||||
gActiveChild->GetMatchingInstalledBreakpoints([=](js::BreakpointPosition::Kind aInstalled) {
|
gActiveChild->GetMatchingInstalledBreakpoints([=](js::BreakpointPosition::Kind aInstalled) {
|
||||||
|
@ -1271,7 +1281,7 @@ HitBreakpointsWithKind(js::BreakpointPosition::Kind aKind, bool aRecordingBounda
|
||||||
PodCopy(newBreakpoints, breakpoints.begin(), breakpoints.length());
|
PodCopy(newBreakpoints, breakpoints.begin(), breakpoints.length());
|
||||||
gMainThreadMessageLoop->PostTask(NewRunnableFunction("HitBreakpoint", HitBreakpoint,
|
gMainThreadMessageLoop->PostTask(NewRunnableFunction("HitBreakpoint", HitBreakpoint,
|
||||||
newBreakpoints, breakpoints.length(),
|
newBreakpoints, breakpoints.length(),
|
||||||
aRecordingBoundary));
|
aKind));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче