зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1656726 - Pause On Exceptions, DOM mutation breakpoints, debugger statements pause in blackboxed original sources r=davidwalsh
Differential Revision: https://phabricator.services.mozilla.com/D85718
This commit is contained in:
Родитель
d2811763c6
Коммит
f4757d7c63
|
@ -73,7 +73,28 @@ add_task(async function() {
|
|||
await waitForPaused(dbg);
|
||||
await resume(dbg);
|
||||
|
||||
info("Blackboxing the source prevents debugger pause");
|
||||
await waitForSource(dbg, "dom-mutation.original.js");
|
||||
|
||||
const source = findSource(dbg, "dom-mutation.original.js");
|
||||
|
||||
await selectSource(dbg, source);
|
||||
await clickElement(dbg, "blackbox");
|
||||
await waitForDispatch(dbg, "BLACKBOX");
|
||||
|
||||
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
|
||||
content.document.querySelector("#blackbox").click();
|
||||
});
|
||||
|
||||
await waitForPaused(dbg, "click.js");
|
||||
await resume(dbg);
|
||||
|
||||
await selectSource(dbg, source);
|
||||
await clickElement(dbg, "blackbox");
|
||||
await waitForDispatch(dbg, "BLACKBOX");
|
||||
|
||||
info("Removing breakpoints works");
|
||||
dbg.win.document.querySelector(".dom-mutation-list .close-btn").click();
|
||||
await waitForAllElements(dbg, "domMutationItem", 1, true);
|
||||
|
||||
});
|
||||
|
|
|
@ -11,14 +11,7 @@
|
|||
<body>
|
||||
<button title="Hello" id="attribute" onclick="changeAttribute()">Click me!</button>
|
||||
<button id="subtree" onclick="changeSubtree()">Click me!</button>
|
||||
<script>
|
||||
function changeAttribute() {
|
||||
document.body.setAttribute("title", "Goodbye");
|
||||
}
|
||||
|
||||
function changeSubtree() {
|
||||
document.body.appendChild(document.createElement("div"));
|
||||
}
|
||||
</script>
|
||||
<button id="blackbox" onclick="changeAttribute();
debugger;
//# sourceURL=click.js">Click me!</button>
|
||||
<script src="dom-mutation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
function changeAttribute() {
|
||||
const title = document.body.title === "Goodbye" ? "Hello" : "Goodbye";
|
||||
document.body.setAttribute("title", title);
|
||||
}
|
||||
|
||||
function changeSubtree() {
|
||||
document.body.appendChild(document.createElement("div"));
|
||||
}
|
||||
//# sourceMappingURL=dom-mutation.js.map
|
|
@ -0,0 +1 @@
|
|||
{"version":3,"sources":["dom-mutation.original.js"],"names":[],"mappings":"AAAA,QAAQ,CAAC,eAAe,IAAI;EAC1B,KAAK,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,MAAM,OAAO,KAAK,KAAK,KAAK,OAAO,EAAE;EACtE,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,KAAK,EAAE;CAC5C;AACD;AACA,QAAQ,CAAC,aAAa,IAAI;EACxB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,IAAI;CAC1D;IACG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG;AACxC","file":"dom-mutation.js","sourcesContent":["function changeAttribute() {\n const title = document.body.title === \"Goodbye\" ? \"Hello\" : \"Goodbye\";\n document.body.setAttribute(\"title\", title);\n}\n\nfunction changeSubtree() {\n document.body.appendChild(document.createElement(\"div\"));\n}\n"]}
|
|
@ -765,9 +765,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
} else if (!notification.phase && !this._activeEventPause) {
|
||||
const frame = this.dbg.getNewestFrame();
|
||||
if (frame) {
|
||||
const { sourceActor } = this.sources.getFrameLocation(frame);
|
||||
const { url } = sourceActor;
|
||||
if (this.sources.isBlackBoxed(url)) {
|
||||
if (this.sources.isFrameBlackBoxed(frame)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -778,11 +776,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
|
||||
_makeEventBreakpointEnterFrame(eventBreakpoint) {
|
||||
return frame => {
|
||||
const location = this.sources.getFrameLocation(frame);
|
||||
const { sourceActor, line, column } = location;
|
||||
const { url } = sourceActor;
|
||||
|
||||
if (this.sources.isBlackBoxed(url, line, column)) {
|
||||
if (this.sources.isFrameBlackBoxed(frame)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
@ -1805,9 +1799,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
const location = this.sources.getFrameLocation(frame);
|
||||
|
||||
if (this.skipBreakpoints || this.sources.isBlackBoxed(location.sourceUrl)) {
|
||||
if (this.skipBreakpoints || this.sources.isFrameBlackBoxed(frame)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
@ -1852,8 +1844,6 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
* The stack frame that contained the debugger statement.
|
||||
*/
|
||||
onDebuggerStatement: function(frame) {
|
||||
const location = this.sources.getFrameLocation(frame);
|
||||
|
||||
// Don't pause if
|
||||
// 1. we have not moved since the last pause
|
||||
// 2. breakpoints are disabled
|
||||
|
@ -1862,7 +1852,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
if (
|
||||
!this.hasMoved(frame, "debuggerStatement") ||
|
||||
this.skipBreakpoints ||
|
||||
this.sources.isBlackBoxed(location.sourceUrl) ||
|
||||
this.sources.isFrameBlackBoxed(frame) ||
|
||||
this.atBreakpointLocation(frame)
|
||||
) {
|
||||
return undefined;
|
||||
|
@ -1922,16 +1912,13 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
const { sourceActor } = this.sources.getFrameLocation(youngestFrame);
|
||||
const url = sourceActor ? sourceActor.url : null;
|
||||
|
||||
// Don't pause on exceptions thrown while inside an evaluation being done on
|
||||
// behalf of the client.
|
||||
if (this.insideClientEvaluation) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (this.skipBreakpoints || this.sources.isBlackBoxed(url)) {
|
||||
if (this.skipBreakpoints || this.sources.isFrameBlackBoxed(youngestFrame)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,29 @@ add_task(
|
|||
"We should stop at the debugger statement again"
|
||||
);
|
||||
await threadFront.resume();
|
||||
|
||||
// Test the debugger statement in the black boxed range
|
||||
threadFront.setBreakpoint({ sourceUrl: source.url, line: 4 }, {});
|
||||
|
||||
await blackBox(sourceFront, {
|
||||
start: { line: 1, column: 0 },
|
||||
end: { line: 9, column: 0 },
|
||||
});
|
||||
|
||||
const packet4 = await executeOnNextTickAndWaitForPause(
|
||||
debuggee.runTest,
|
||||
threadFront
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
packet4.why.type,
|
||||
"breakpoint",
|
||||
"We should pass over the debugger statement."
|
||||
);
|
||||
|
||||
threadFront.removeBreakpoint({ sourceUrl: source.url, line: 4 }, {});
|
||||
await unBlackBox(sourceFront);
|
||||
await threadFront.resume();
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -31,6 +31,30 @@ add_task(
|
|||
SOURCE_URL,
|
||||
"We shouldn't pause while in the black boxed source."
|
||||
);
|
||||
|
||||
await unBlackBox(sourceFront);
|
||||
await blackBox(sourceFront, {
|
||||
start: { line: 1, column: 0 },
|
||||
end: { line: 4, column: 0 },
|
||||
});
|
||||
|
||||
await threadFront.resume();
|
||||
|
||||
await executeOnNextTickAndWaitForPause(
|
||||
() => evalCode(debuggee),
|
||||
threadFront
|
||||
);
|
||||
|
||||
threadFront.resume();
|
||||
const packet2 = await waitForPause(threadFront);
|
||||
const source2 = await getSourceById(threadFront, packet2.frame.where.actor);
|
||||
|
||||
Assert.equal(
|
||||
source2.url,
|
||||
SOURCE_URL,
|
||||
"We shouldn't pause while in the black boxed source."
|
||||
);
|
||||
|
||||
await threadFront.resume();
|
||||
})
|
||||
);
|
||||
|
|
Загрузка…
Ссылка в новой задаче