зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
8ec2e36c2d
Коммит
878f6df197
|
@ -840,6 +840,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||||
|
|
||||||
frame.onStep = onStep;
|
frame.onStep = onStep;
|
||||||
frame.onPop = onPop;
|
frame.onPop = onPop;
|
||||||
|
frame.waitingOnStep = true;
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -1025,19 +1026,25 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||||
steppingType = "next";
|
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({
|
const { onEnterFrame, onPop, onStep } = this._makeSteppingHooks({
|
||||||
steppingType,
|
steppingType,
|
||||||
completion,
|
completion,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Make sure there is still a frame on the stack if we are to continue
|
if (steppingType === "step") {
|
||||||
// stepping.
|
this.dbg.onEnterFrame = onEnterFrame;
|
||||||
const stepFrame = this._getNextStepFrame(frame);
|
}
|
||||||
|
|
||||||
if (stepFrame) {
|
if (stepFrame) {
|
||||||
switch (steppingType) {
|
switch (steppingType) {
|
||||||
case "step":
|
case "step":
|
||||||
this.dbg.onEnterFrame = onEnterFrame;
|
|
||||||
// Fall through.
|
|
||||||
case "break":
|
case "break":
|
||||||
case "next":
|
case "next":
|
||||||
if (stepFrame.script) {
|
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-14.js]
|
||||||
[test_stepping-15.js]
|
[test_stepping-15.js]
|
||||||
[test_stepping-16.js]
|
[test_stepping-16.js]
|
||||||
|
[test_stepping-17.js]
|
||||||
[test_stepping-with-skip-breakpoints.js]
|
[test_stepping-with-skip-breakpoints.js]
|
||||||
[test_framebindings-01.js]
|
[test_framebindings-01.js]
|
||||||
[test_framebindings-02.js]
|
[test_framebindings-02.js]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче