Closed Bug 2028220 Opened 5 months ago Closed 5 months ago

devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js intermittently fails with stencil navigation enabled

Categories

(DevTools :: Debugger, task)

task

Tracking

(firefox151 fixed)

RESOLVED FIXED
151 Branch
Tracking Status
firefox151 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

derived from bug 2027803 comment #4.

The following assertion intermittently fails with the stencil navigation enabled, at least on linux asan, linux tsan on automation.
I can observe the issue on macOS debug build with test --verify.

https://searchfox.org/firefox-main/rev/9a3317a65545e83f4e32b94fdf1f6860342423ef/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js#264

await assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 87);

The assertion sees the line being 82, which is the previous test's line, but

https://searchfox.org/firefox-main/rev/9a3317a65545e83f4e32b94fdf1f6860342423ef/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js#251-267

info(`Check that breakpoint can be set on "beforeUnload" event`);
await toggleEventBreakpoint(dbg, "Load", "event.load.beforeunload");
let onReload = reload(dbg);
await waitForPaused(dbg);
await assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 82);
await resume(dbg);
await onReload;
await toggleEventBreakpoint(dbg, "Load", "event.load.beforeunload");

info(`Check that breakpoint can be set on "unload" event`);
await toggleEventBreakpoint(dbg, "Load", "event.load.unload");
onReload = reload(dbg);
await waitForPaused(dbg);
await assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 87);
await resume(dbg);
await onReload;
await toggleEventBreakpoint(dbg, "Load", "event.load.unload");

When I forcibly stop at the first assertion failure, the source view indeed stops at line 82, with the breakpoint being set to line 82,
and in the sidebar, both beforeunload and unload are checked.

https://searchfox.org/firefox-main/rev/9a3317a65545e83f4e32b94fdf1f6860342423ef/devtools/client/debugger/test/mochitest/shared-head.js#469-473

is(
  pauseLine,
  expectedLine,
  "Redux state for currently selected frame's line is correct"
);

Then, if I added logging for the checkbox state, in the failure case, the checkbox for the beforeunload is toggled from unchecked to checked, for both toggleEventBreakpoint calls, while the latter is supposed to toggle from checked to unchecked as a cleanup.

So, possibly either:

  • the checkbox state doesn't persist for some reason
  • the checkbox state hasn't been restored after reload at that point

With the following put before the 2nd toggleEventBreakpoint call, I observe that the checkbox's checked property becomes false to true at that point.

{
  const eventCheckbox = await getEventBreakpointCheckbox(
    dbg, "Load", "event.load.beforeunload"
  );
  dump(`@@@@ checked=${eventCheckbox.checked}\n`);
  await waitFor(() => {
    dump(`@@@@ checked=${eventCheckbox.checked}\n`);
    return eventCheckbox.checked == true;
  });
  dump(`@@@@ checked=${eventCheckbox.checked}\n`);
}

It means the onReload promise doesn't wait for the breakpoint state restoration, which would mean that the breakpoint state is restored after the waitForSources's condition.

https://searchfox.org/firefox-main/rev/9a3317a65545e83f4e32b94fdf1f6860342423ef/devtools/client/debugger/test/mochitest/shared-head.js#1029-1032

async function reload(dbg, ...sources) {
  await reloadSelectedTab();
  return waitForSources(dbg, ...sources);
}

Anyway, the testcase (and possibly all others that uses the similar structure) should wait for the breakpoint state restoration before processing to the "uncheck" part.

Pushed by arai_a@mac.com: https://github.com/mozilla-firefox/firefox/commit/225686f76b2e https://hg.mozilla.org/integration/autoland/rev/855e138a4680 Wait for the breakpoint checkbox state to be restored after reloading the page. r=devtools-reviewers,nchevobbe
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch
QA Whiteboard: [qa-triage-done-c152/b151]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: