Open Bug 1835268 Opened 1 year ago Updated 1 year ago

Changing thread-helpers.sys.mjs to import jsdebugger as a system module causes assertion failures in test_javascript_tracer.js

Categories

(DevTools :: Debugger, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: standard8, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

I was trying to land updates to consumers of system modules to bring the tree up to date and I came across an assertion failure.

The assertion is generated when I change these lines to be the ES module import, i.e.:

  const { addDebuggerToGlobal } = ChromeUtils.importESModule(
    "resource://gre/modules/jsdebugger.sys.mjs"
  );

When that happens, there is an assertion failure on debug builds. See here for a full log, excerpt below.

The Reentrancy error occurs without the import changed, so I don't think that is related.

 0:01.11 INFO devtools/shared/test-helpers/test_javascript_tracer.js | Starting pause
 0:01.11 INFO (xpcshell/head.js) | test pause pending (2)
 0:01.13 pid:8762 --[interpreter]--> /Users/mark/dev/gecko/objdir-ff-debug/_tests/xpcshell/devtools/shared/test-helpers/test_javascript_tracer.js @ 57:18 - foo
 0:01.13 pid:8762 JavaScript warning: debugger-javascript-tracer, line 66: debuggee 'resource://gre/modules/Timer.sys.mjs:53' would run
 0:01.13 pid:8762 --[interpreter]--> resource://gre/modules/Timer.sys.mjs @ 55:8 - get name
 0:01.13 pid:8762 JavaScript warning: debugger-javascript-tracer, line 66: debuggee 'resource://testing-common/PromiseTestUtils.sys.mjs:185' would run
 0:01.13 pid:8762  --[interpreter]--> resource://testing-common/PromiseTestUtils.sys.mjs @ 185:22 - onConsumed
 0:01.13 pid:8762 JavaScript warning: debugger-javascript-tracer, line 66: debuggee '/Users/mark/dev/gecko/testing/xpcshell/head.js:152' would run
 0:01.13 pid:8762 [Parent 8762, Main Thread] WARNING: Reentrancy error: some client attempted to display a message to the console while in a console listener. The following message was discarded: "[JavaScript Warning: "debuggee '/Users/mark/dev/gecko/testing/xpcshell/head.js:152' would run" {file: "debugger-javascript-tracer" line: 66}]": file /Users/mark/dev/gecko/xpcom/base/nsConsoleService.cpp:291
 0:01.13 pid:8762   --[interpreter]--> /Users/mark/dev/gecko/testing/xpcshell/head.js @ 153:10 - observe
 0:01.13 pid:8762 Assertion failure: !mDeliveringMessage, at /Users/mark/dev/gecko/xpcom/base/nsConsoleService.h:46
Initializing stack-fixing for the first stack frame, this may take a while...
 0:24.10 pid:8762 #01: nsConsoleService::SetIsDelivering() (/Users/mark/dev/gecko/xpcom/base/nsConsoleService.h:46)
 0:24.10 pid:8762 #02: (anonymous namespace)::LogMessageRunnable::Run() (/Users/mark/dev/gecko/xpcom/base/nsConsoleService.cpp:254)
 0:24.10 pid:8762 #03: mozilla::RunnableTask::Run() (/Users/mark/dev/gecko/xpcom/threads/TaskController.cpp:555)
 0:24.11 pid:8762 #04: mozilla::TaskController::DoExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) (/Users/mark/dev/gecko/xpcom/threads/TaskController.cpp:879)
 0:24.11 pid:8762 #05: mozilla::TaskController::ExecuteNextTaskOnlyMainThreadInternal(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&) (/Users/mark/dev/gecko/xpcom/threads/TaskController.cpp:702)

The Bugbug bot thinks this bug should belong to the 'DevTools::Debugger' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: General → Debugger
Severity: -- → S3
Flags: needinfo?(poirot.alex)
Priority: -- → P3

This thread-helpers file and its tracing feature is redundant with the new tracer:
https://searchfox.org/mozilla-central/source/devtools/server/tracer/tracer.jsm

I should spend some time to remove it but there is one feature still not supported by the new tracer: trace JS from all globals.
I should add such option before removing the old experiment.

All that to say, it is probably not worth trying to fix issues around this to-be-removed code.

Blocks: 1525652
No longer blocks: esm-ification
You need to log in before you can comment on or make changes to this bug.