Closed Bug 1580394 Opened 5 years ago Closed 3 years ago

Paused overlay does not show when pausing during load

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(firefox96 verified)

VERIFIED FIXED
96 Branch
Tracking Status
firefox96 --- verified

People

(Reporter: Harald, Assigned: emilio)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

What were you doing?

  1. Open Debugger on http://react-compare-app.surge.sh/
  2. Set BP in index.js and reload
  3. BP is being hit

What happened?

Pause overlay missing.

What should have happened?

Pause overlay shows.

P2, as not showing it is a confusing state after we trained devs to wait for it.

Blocks: dbg-71
Flags: needinfo?(jlaster)

P2 as this flaky behavior can really confuse users who expect the overlay when being paused.

Flags: needinfo?(jlaster)

Hmm, I'm not sure why this is happening. The server is correctly calling showOverlay correctly.

I had happen this in a few cases as well for non-pageload pausing as well, but no clear STR yet.

Brian, could you take a look at this? I'm worried there might be something in the highlighters logic that makes it a no-op in this state?

Flags: needinfo?(bhackett1024)

Is the overlay supposed to be shown when the pause happens during page load? It seems to me like it doesn't on much simpler cases if I set a breakpoint somewhere in a page's global script. From what I can tell on this example, if I set a breakpoint early in index.js then it is also hitting while the page is loading and the overlay similarly wouldn't be shown.

Flags: needinfo?(bhackett1024)

Another STRs coming from: https://bugzilla.mozilla.org/show_bug.cgi?id=1554054#c10

  1. Open new window
  2. Load http://janodvarko.cz/tests/bugzilla/1554054/example.html
  3. F12 to open DevTools
  4. Insert a BP, say line 3
  5. Refresh and observe that it correctly stops on line 3
  6. Hit continue
  7. Observe that in the top middle, a widget now incorrectly appears saying "Paused on breakpoint". The "continue" triangle icon is not clickable. You then have to click the "Pause" icon in the DevTools window.

Honza

(In reply to Jan Honza Odvarko [:Honza] (always need-info? me) from comment #6)

  1. Observe that in the top middle, a widget now incorrectly appears saying "Paused on breakpoint". The "continue" triangle icon is not clickable. You then have to click the "Pause" icon in the DevTools window.

When testing this again I am seeing that the problem disappears after the page is refreshed

Moving to P3

Honza

Priority: P2 → P3

New STR:

  1. Open a tab with data:text/html,<meta charset=utf8><script>debugger;</script>Hello
  2. Open DevTools
  3. Reload

The debugger statement is hit, the debugger pauses but the page overlay is not displayed.
Worse, when resuming, the overlay does appear, although the debugger isn't paused anymore and clicking on any buttons does not hide it :/

Depends on: 1678636

It looks like it has been slightly improved. By bug 1678636? Or server targets?

But from comment 8, the "worse, ... " part no longer reproduce.
We do not see any overlay, even when resuming.

In addition to comment 9 It might be worth mentioning , with the browser toolbox open i still get the overlay appearing later after resume and when the browser load is cancelled.

The overlay fails appearing because we end up stuck on this line:
https://searchfox.org/mozilla-central/rev/bc5e79f3ae0f42cb4a6ebd05fc32f48a3829059d/devtools/server/actors/thread.js#484

      await this.pauseOverlay.isReady;

This isReady promise is actually the promise returned by this initialize method of the pause overlay highlighter:
https://searchfox.org/mozilla-central/rev/bc5e79f3ae0f42cb4a6ebd05fc32f48a3829059d/devtools/server/actors/highlighters/utils/markup.js#213-227

    // _insert will resolve this promise once the markup is displayed
    const onInitialized = new Promise(resolve => {
      this._initialized = resolve;
    });
    // Only try to create the highlighter when the document is loaded,
    // otherwise, wait for the window-ready event to fire.
    const doc = this.highlighterEnv.document;
    if (
      doc.documentElement &&
      (isDocumentReady(doc) || doc.readyState !== "uninitialized")
    ) {
      this._insert();
    }

    return onInitialized;

So that the breakpoint pauses the document load, but the paused highlighter is actually waiting for the document to be done loading.
With 1741808, we also hit this issue when hitting a breakpoint during any iframe load.

Unfortunately, we can't simply not wait.
InsertAnonymousContent needs the PresShell to have access to a CustomContentContainer, and if we don't have one, it simply bails out, without any hint for the callsite that something went wrong (the anonymousContent is still returned, see https://searchfox.org/mozilla-central/rev/702199bca53babc925e47fd8f86ed56487d42492/dom/base/Document.cpp#8127,8136-8138,8163)

I tried to tweak that so we could at least get a null reference, and maybe try to poll the InsertAnonymousContent every x ms until we do have access to a CustomContentContainer, but since we're paused, it seems like it only becomes available once we resume.


Emilio, as discussed on Element, do you think there's something we could do here, either directly in InsertAnonymousContent, or with some other APIs we didn't think of ?

A simple STR:

  1. Go to data:text/html,<meta charset=utf8><script>debugger</script>top
  2. Open the debugger
  3. Reload the page

-> the paused debugger overlay isn't displayed, although the debugger UI does show that we're paused.

Flags: needinfo?(emilio)

Can you provide a patch so that I hit the codepath linked above? I don't hit InsertAnonymousContent at all following those STR (as expected given the waiting there)

Flags: needinfo?(nchevobbe)
Assignee: nobody → emilio
Status: NEW → ASSIGNED

Anyhow I think something like that should help.

Assignee: emilio → nobody
Status: ASSIGNED → NEW
Flags: needinfo?(emilio)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #13)

Can you provide a patch so that I hit the codepath linked above? I don't hit InsertAnonymousContent at all following those STR (as expected given the waiting there)

oh sure, sorry I forgot. This should be enough: https://phabricator.services.mozilla.com/D132037

Flags: needinfo?(nchevobbe)

(In reply to Emilio Cobos Álvarez (:emilio) from comment #15)

Anyhow I think something like that should help.

thanks a lot, I'll check this

Assignee: nobody → emilio
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/db068d3108a2
Add an InsertAnonymousContent version which tries to update layout synchronously if needed. r=nchevobbe,smaug
https://hg.mozilla.org/integration/autoland/rev/6d96da07e581
[devtools] Don't wait for document to be ready to show PausesDebuggerOverlay. r=ochameau.
Flags: needinfo?(emilio) → needinfo?(nchevobbe)

I'm going to have a look. From the screenshot taken during the failure, the overlay isn't displayed. There doesn't seem to be anything showing up in the logs, I'll debug that

Flags: needinfo?(nchevobbe)
Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0ceda05fc737
Add an InsertAnonymousContent version which tries to update layout synchronously if needed. r=nchevobbe,smaug
https://hg.mozilla.org/integration/autoland/rev/e692ec7d440f
[devtools] Don't wait for document to be ready to show PausesDebuggerOverlay. r=ochameau.

Backed out for causing dt failures in browser_dbg-paused-overlay-loading

Backout link: https://hg.mozilla.org/integration/autoland/rev/1893ac7500dc3ed86746da17cb1668c147705b23

Push with failures

Failure log

 INFO - TEST-PASS | devtools/client/debugger/test/mochitest/browser_dbg-paused-overlay-loading.js | We're paused - 
[task 2021-12-01T08:45:58.516Z] 08:45:58     INFO - Check that the paused overlay is displayed
[task 2021-12-01T08:45:58.516Z] 08:45:58     INFO - Buffered messages finished
[task 2021-12-01T08:45:58.518Z] 08:45:58     INFO - TEST-UNEXPECTED-FAIL | devtools/client/debugger/test/mochitest/browser_dbg-paused-overlay-loading.js | Uncaught exception - at chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js:1012 - Error: Failed waitFor(): 
[task 2021-12-01T08:45:58.518Z] 08:45:58     INFO - Failed condition: async () => {
[task 2021-12-01T08:45:58.518Z] 08:45:58     INFO -     const visible = await highlighterTestFront.isPausedDebuggerOverlayVisible();
[task 2021-12-01T08:45:58.518Z] 08:45:58     INFO -     return visible;
[task 2021-12-01T08:45:58.519Z] 08:45:58     INFO -   }
Flags: needinfo?(nchevobbe)

groumpf, would I be pushing a different version than what I have locally?

Flags: needinfo?(nchevobbe)

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #25)

groumpf, would I be pushing a different version than what I have locally?

it wasn't this. I rebased the patches against latest mozilla-central and now I can see devtools/client/debugger/test/mochitest/browser_dbg-paused-overlay-loading.js failing locally, because of what I added in Bug 1742541 🤦‍♂️
It should be good now

Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/bc45075bbcd3
Add an InsertAnonymousContent version which tries to update layout synchronously if needed. r=nchevobbe,smaug
https://hg.mozilla.org/integration/autoland/rev/8755bec3a47d
[devtools] Don't wait for document to be ready to show PausesDebuggerOverlay. r=ochameau.
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 96 Branch
Regressions: 1743594
QA Whiteboard: [qa-96b-p2]

Reproduced this issue on an affected Nightly build from 2019-09-10 on Windows 10.
Verified fixed on Firefox 96.0 (20220106144528), across the following platforms: Win 10 x64, Ubuntu 21 and macOS 10.15. The debugger overlay is displayed after every refresh.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: