Bug 1688569 - [devtools] Watch DOM mutation breakpoints on all targets r=ochameau

Differential Revision: https://phabricator.services.mozilla.com/D103072
This commit is contained in:
Julian Descottes 2021-01-29 13:37:47 +00:00
Родитель 692a5351d2
Коммит c61e417a18
2 изменённых файлов: 34 добавлений и 38 удалений

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

@ -68,48 +68,42 @@ add_task(async function() {
const mutationItem = await waitForElement(dbg, "domMutationItem");
ok(mutationItem, "A DOM mutation breakpoint exists");
if (isFissionEnabled()) {
// The behavior of the else branch currently times out on fission.
// See Bug 1688569.
todo(false, "Disabling DOM breakpoints in frames fails with Fission");
} else {
mutationItem.scrollIntoView();
mutationItem.scrollIntoView();
info("Enabling and disabling the DOM mutation breakpoint works");
const checkbox = mutationItem.querySelector("input");
checkbox.click();
await waitFor(() => !checkbox.checked);
info("Enabling and disabling the DOM mutation breakpoint works");
const checkbox = mutationItem.querySelector("input");
checkbox.click();
await waitFor(() => !checkbox.checked);
info(
"Click the button in the remote iframe, should not hit the breakpoint"
);
BrowserTestUtils.synthesizeMouse("button", 0, 0, {}, frameBC);
info(
"Click the button in the remote iframe, should not hit the breakpoint"
);
BrowserTestUtils.synthesizeMouse("button", 0, 0, {}, frameBC);
info("Wait until the input is enabled");
await asyncWaitUntil(() =>
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
return SpecialPowers.spawn(
content.document.querySelector("iframe"),
[],
() => !content.document.querySelector("input").disabled
);
})
);
is(isPaused(dbg), false, "DOM breakpoint should not have been hit");
info("Restore the disabled attribute");
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
info("Wait until the input is enabled");
await asyncWaitUntil(() =>
SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
return SpecialPowers.spawn(
content.document.querySelector("iframe"),
[],
() =>
!content.document.querySelector("input").setAttribute("disabled", "")
() => !content.document.querySelector("input").disabled
);
});
})
);
is(isPaused(dbg), false, "DOM breakpoint should not have been hit");
checkbox.click();
await waitFor(() => checkbox.checked);
}
info("Restore the disabled attribute");
await SpecialPowers.spawn(gBrowser.selectedBrowser, [], function() {
return SpecialPowers.spawn(
content.document.querySelector("iframe"),
[],
() =>
!content.document.querySelector("input").setAttribute("disabled", "")
);
});
checkbox.click();
await waitFor(() => checkbox.checked);
info("Click the button in the remote iframe, to trigger the breakpoint");
BrowserTestUtils.synthesizeMouse("button", 0, 0, {}, frameBC);

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

@ -701,12 +701,14 @@ Toolbox.prototype = {
targetFront.on("navigate", this._onNavigate);
targetFront.on("frame-update", this._updateFrames);
targetFront.on("inspect-object", this._onInspectObject);
targetFront.watchFronts("inspector", async inspectorFront => {
registerWalkerListeners(this.store, inspectorFront.walker);
});
}
// Walker listeners allow to monitor DOM Mutation breakpoint updates.
// All targets should be monitored.
targetFront.watchFronts("inspector", async inspectorFront => {
registerWalkerListeners(this.store, inspectorFront.walker);
});
const { threadFront } = targetFront;
if (threadFront) {
// threadFront listeners are removed when the thread is destroyed