Bug 1548469 - Step in to the next script r=jlast

Depends on D65008

Differential Revision: https://phabricator.services.mozilla.com/D65009

--HG--
extra : moz-landing-system : lando
This commit is contained in:
wartmanm 2020-03-03 18:44:43 +00:00
Родитель 8ec2e36c2d
Коммит 878f6df197
3 изменённых файлов: 88 добавлений и 5 удалений

Просмотреть файл

@ -840,6 +840,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
frame.onStep = onStep;
frame.onPop = onPop;
frame.waitingOnStep = true;
return undefined;
};
},
@ -1025,19 +1026,25 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
steppingType = "next";
}
// If there are no more frames on the stack, use "step" mode so that we will
// pause on the next script to execute.
const stepFrame = this._getNextStepFrame(frame);
if (!stepFrame) {
steppingType = "step";
}
const { onEnterFrame, onPop, onStep } = this._makeSteppingHooks({
steppingType,
completion,
});
// Make sure there is still a frame on the stack if we are to continue
// stepping.
const stepFrame = this._getNextStepFrame(frame);
if (steppingType === "step") {
this.dbg.onEnterFrame = onEnterFrame;
}
if (stepFrame) {
switch (steppingType) {
case "step":
this.dbg.onEnterFrame = onEnterFrame;
// Fall through.
case "break":
case "next":
if (stepFrame.script) {

Просмотреть файл

@ -0,0 +1,75 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/*
* Check that you can step from one script or event to another
*/
add_task(
threadFrontTest(async ({ threadFront, targetFront, debuggee }) => {
const consoleFront = await targetFront.getFront("console");
Cu.evalInSandbox(
`function blackboxed(callback) { return () => callback(); }`,
debuggee,
"1.8",
"http://example.com/blackboxed.js",
1
);
const { sources } = await getSources(threadFront);
const blackboxedSourceFront = threadFront.source(
sources.find(source => source.url == "http://example.com/blackboxed.js")
);
blackBox(blackboxedSourceFront);
const testStepping = async function(wrapperName, stepHandler, message) {
consoleFront.evaluateJSAsync(
`(function () {
const p = Promise.resolve();
p.then(${wrapperName}(() => { debugger; }))
.then(${wrapperName}(() => { }));
})();`
);
await waitForEvent(threadFront, "paused");
const step = await stepHandler(threadFront);
Assert.equal(step.frame.where.line, 4, message);
await resume(threadFront);
};
const stepTwice = async function() {
await stepOver(threadFront);
return stepOver(threadFront);
};
await testStepping("", stepTwice, "Step over on the outermost frame");
await testStepping("blackboxed", stepTwice, "Step over with blackboxing");
await testStepping("", stepOut, "Step out on the outermost frame");
await testStepping("blackboxed", stepOut, "Step out with blackboxing");
consoleFront.evaluateJSAsync(
`(async function () {
const p = Promise.resolve();
const p2 = p.then(() => {
debugger;
return "async stepping!";
});
debugger;
await p;
const result = await p2;
return result;
})();
`
);
await waitForEvent(threadFront, "paused");
await stepOver(threadFront);
await stepOver(threadFront);
const step = await stepOut(threadFront);
await resume(threadFront);
Assert.equal(step.frame.where.line, 9, "Step out of promise into async fn");
})
);

Просмотреть файл

@ -183,6 +183,7 @@ skip-if = true # breakpoint sliding is not supported bug 1525685
[test_stepping-14.js]
[test_stepping-15.js]
[test_stepping-16.js]
[test_stepping-17.js]
[test_stepping-with-skip-breakpoints.js]
[test_framebindings-01.js]
[test_framebindings-02.js]