vscode-firefox-debug icon indicating copy to clipboard operation
vscode-firefox-debug copied to clipboard

Unverified breakpoints after 2.12.1 release

Open AnrDaemon opened this issue 11 months ago • 14 comments

Type: Bug

launch.json configuration:

{
            "log": {
                "fileLevel": {
                    "default": "Debug"
                },
                "fileName": "${workspaceFolder}/logs/ffdebug.log"
            },
            "name": "FFdebug",
            "pathMappings": [
                {
                    "path": "${workspaceFolder}/app/",
                    "url": "http://127.0.0.1:5500"
                },
                {
                    "path": "${workspaceFolder}/app/",
                    "url": "https://proto.example.com/"
                },
                {
                    "path": "${workspaceFolder}/app/",
                    "url": "https://stage.example.com/"
                }
            ],
            "preLaunchTask": "Firefox debugger",
            "request": "attach",
            "skipFiles": [
                "**/js.stripe.com/**/*",
                "**/static.sumsub.com/**/*",
                "**/node_modules/**/*",
                "**/*.min.js",
                "${workspaceFolder}/app/lib/tools.js"
            ],
            "host": "127.0.0.1",
            "type": "firefox"
        }

After upgrading to 2.12.1 release and restarting the debugger, I'm unable to verify any of the breakpoints. I have tried to restart both the IDE and the browser to get it to work, but then it would catch a breakpoint in the newly opened tab and don't show it in the IDE. I have to close all tabs in the browser but one and restart the debugger to connect it again.

Extension version: 2.12.1 VS Code version: Code 1.96.2 (fabdb6a30b49f79a7aba0f2ad9df9b399473380f, 2024-12-19T10:22:47.216Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i3-8145U CPU @ 2.10GHz (4 x 2304)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 7.86GB (0.24GB free)
Process Argv --folder-uri file:///d%3A/Profiles/anrdaemon/Documents/hk/invapi-php
Screen Reader no
VM 0%

AnrDaemon avatar Jan 10 '25 10:01 AnrDaemon

This could be caused by a bug that I just fixed in version 2.13.0. Could you retry with that version?

hbenl avatar Jan 10 '25 10:01 hbenl

Tested, not fixed. To shed a little more light (I don't think that's relevant, but just in case): The application uses custom click handlers over internal protocol prefixes (like <a href="smth:ID"> … </a> will open the entity smth with specified ID, the ctrl/middle click will window.open() a specific URL with GET params (like, http://example.com/?entity=smth&id=ID). There's the problem starts. The log shows that breakpoints are recognized, the browser will correctly stop at the breakpoints, but IDE will not show the interface, and it still shows the ghost tabs in threads list.

Restarting the debugger in the IDE may help to revive the system. Or not. Or in the last try it outright forgot that we're debugging and breakpoints ceased to work.

Had to reduce tabs to one and reload debugger again to make it behave.

AnrDaemon avatar Jan 10 '25 11:01 AnrDaemon

Which version of Firefox do you use? I've noticed a bug in the current Developer and Nightly editions that could cause this. If you've used one of those, try with the stable edition and tell me if that works better.

hbenl avatar Jan 10 '25 18:01 hbenl

I'm using current stable releases. Right now it's 134.0 (64-bit)

AnrDaemon avatar Jan 10 '25 19:01 AnrDaemon

OK, so this is a different issue. Could you share your logs/ffdebug.log?

hbenl avatar Jan 13 '25 10:01 hbenl

I'll have to try and reproduce it with a safe data. Will take a day or two. Sorry for delays.

AnrDaemon avatar Jan 14 '25 14:01 AnrDaemon

I think I understand the tripping point.

When I start to open and close a lot of tabs with window.open like

            return void window.open(window.location.origin + window.location.pathname + `?${link.proto}:${link.href}`);

either FF itself or the extension lose its mind and produce results like

Image

Note that it correctly recognize that only 3 tabs are open, but shows a lot of sessions. This is after debugger reload.

AnrDaemon avatar Feb 13 '25 09:02 AnrDaemon

Those extra threads (with undefined URL) are for WebExtensions - in the latest version of this extension (2.14.1) they will not show up anymore (unless your launch configuration specifies a WebExtension to debug). But I don't think that is the cause of this issue, I think it is caused by a Firefox issue that seems to have a bigger impact than I initially thought. We're currently discussing how to fix this issue.

hbenl avatar Feb 14 '25 16:02 hbenl

Version 2.15.0 fixes various issues with debugging multiple tabs but the fix also required some changes in Firefox, so it's only enabled when debugging with Firefox 137 or later. Please try debugging your application with the current Nightly edition of Firefox and tell me if it fixes your issue.

hbenl avatar Feb 28 '25 16:02 hbenl

It says it is 135 latest right now. Will wait a few days to report.

AnrDaemon avatar Mar 01 '25 14:03 AnrDaemon

It says it is 135 latest right now.

Yes, the stable edition will go to version 137 next month. If you want to test the fix earlier than that you'll need to install the Nightly edition.

hbenl avatar Mar 03 '25 09:03 hbenl

Damn, that's long wait. Will have to put it on the calendar. I don't have time to play with nightlies.

AnrDaemon avatar Mar 03 '25 16:03 AnrDaemon

Doesn't seems to have been fixed with 137 release. If I have two tabs open, and they contain slightly different runtime, it's a big "if", if the right breakpoint will be set in the browser. I still have to close all other tabs and reload the debugger to get it to senses.

AnrDaemon avatar Apr 10 '25 17:04 AnrDaemon

A good indication of a "wrong" breakpoint is when an inline breakpoint mark appears in the middle of a symbol. Like, node.queryS<>electorAll(…).

AnrDaemon avatar Apr 10 '25 17:04 AnrDaemon