Closed Bug 1544820 Opened 5 years ago Closed 5 years ago

Console doesn't work via about:debugging for xpcshell-tests

Categories

(DevTools :: about:debugging, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1549388

People

(Reporter: standard8, Assigned: jdescottes)

References

(Blocks 2 open bugs)

Details

(Whiteboard: high-priority-reserve)

STR

  1. Set devtools.aboutdebugging.process-debugging preference to true
  2. Start an xpcshell-test with --jsdebugger
  3. Visit about:debugging.
  4. Setup a network connection to localhost:6000 if you haven't already.
  5. Click Connect for it, then click the localhost entry.
  6. Scroll to the bottom, click inspect.
  7. Either try to show the split console, or switch to the console tab.

Actual Results

  • A blank area is shown.

Expected Results

  • The console is shown, and I can interact with it.
Blocks: 1541517

I just happened to leave the split console open for some new tests I'm working on. I was happening to have a debugger statement somewhere in the early setup cycle, and that was actually showing the console. However, continuing the console would disappear.

When I removed that debugger statement and started again with the split console still open, I ended up in the state where I couldn't see the debugger either. I had to re-add the debugger statement to get the split console back, disable it, and then restart everything.

The priority flag is not set for this bug.
:jdescottes, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jdescottes)

I can't reproduce the issue with the console. I am not sure how you were opening the split console, but there was a race condition that I recently fixed in Bug 1544692.
For the debugger, I get the same issue with WebIDE, so it's probably something wrong with the Debugger itself.

My STRs are:

  • add "debugger" in devtools/client/shared/remote-debugging/test/unit/test_remote_client_manager.js
    (right before for (const type of Object.values(CONNECTION_TYPES)) { for instance)
  • start firefox, open about:debugging, add localhost:6000 to the list of remote runtimes (don't try to connect yet)
  • run ./mach xpcshell-test devtools/client/shared/remote-debugging/test/unit/test_remote_client_manager.js --jsdebugger
  • connect to localhost:6000 in about:debugging
  • open the runtime page for localhost:6000
  • scroll down, click inspect for main process
  • (toolbox tab should focus the debugger, stopped on the debugger statement)
  • try to hover remoteClientManager at line 6

Then I get a blank debugger.

I get the following exception everytime:

console.error: (new TypeError("item is undefined", "resource://devtools/client/shared/components/reps/reps.js", 1497))
JavaScript error: resource://devtools/client/shared/components/reps/reps.js, line 1497: TypeError: item is undefined

It seems to happen when hovering some variables in the debugger source editor. The stack is (removed everything not-devtools related):

nodeHasChildren@resource://devtools/client/shared/components/reps/reps.js:1497:15
nodeIsPrimitive@resource://devtools/client/shared/components/reps/reps.js:1560:33
[...]
setPreview/<@resource://devtools/client/debugger/src/actions/preview.js:68:11
[...]
updatePreview/<@resource://devtools/client/debugger/src/actions/preview.js:62:5
[...]
Preview/this.onTokenEnter@resource://devtools/client/debugger/src/components/Editor/Preview/index.js:57:9
[...]
dispatch@resource://devtools/client/debugger/src/utils/editor/token-events.js:46:26
onMouseOver/<@resource://devtools/client/debugger/src/utils/editor/token-events.js:88:7

It seems we are trying to render an object inspector without roots? Jason, any idea?

Flags: needinfo?(jdescottes) → needinfo?(jlaster)

Mark, can you confirm the Console issue is fixed for you as well on the latest central? Or provide other STRs?

Flags: needinfo?(standard8)
Blocks: remote-debugging-ng
No longer blocks: 1541517
Priority: -- → P3
Blocks: 1541517
See Also: → 1548256

Turns out the issue I have with the debugger was introduced only 9 days ago (Bug 1536116), so probably not directly related to this, since you filed the bug 15days ago.

Hoping we can get more STRs, clearing the ni? for Jason here, since I already pinged him on a dedicated bug I filed for the Debugger regression.

Flags: needinfo?(jlaster)

I'm not quite sure, but I think there may be something related to specific tests or timing?... I was trying this with search tests today, and most weren't hitting an issue.

I then went back to where I was seeing it consistently yesterday, and reproduced. The tests I'm running here have a bit of setup (starting up add-on manager & other things) before the breakpoint gets hit, hence taking a second or so before the breakpoint fires (the other experiements I did were probably hitting the breakpoint more-or-less straight away).

Here's what I did:

  • Latest master, 083106d8fc7407c880a3a044c83d4e15e5961063, Mac Artifact Opt build.
  • In toolkit/components/search/tests/xpcshell/searchconfigs/head_searchconfig.js, change this._testDebug = false to this._testDebug = true (this just makes the test not take > 5 mins to run).
  • At the start of _assertDefaultEngines, add a debugger; statement.
  • Run ./mach xpcshell-test toolkit/components/search/tests/xpcshell/searchconfigs/test_google.js --jsdebugger
  • Open about:debugging
  • Hit connect for the localhost entry, click it, scroll to the bottom
  • Hit the inspect button
  • Once the debugger opens, click the three-dot menu at the top-right and select Show split console

-> At this point the console flashes briefly, and then blanks out.

  • It also reproduces if I just hit the Console tab, rather than doing the split console.

I'm seeing these errors on the browser console when this happens:

Removed unsafe attribute. Element: svg. Attribute: xmlns. 4 Breakpoint.js:29
Removed unsafe attribute. Element: svg. Attribute: xmlns. 4 ColumnBreakpoint.js:26
Invariant Violation: "Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Btype%2C%20initial%2C%20length%2C%20actor%7D&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings. "
    invariant resource://devtools/client/shared/vendor/react-dom.js:33
    reactProdInvariant resource://devtools/client/shared/vendor/react-dom.js:63
    throwOnInvalidObjectType resource://devtools/client/shared/vendor/react-dom.js:9240
    createChild resource://devtools/client/shared/vendor/react-dom.js:9436
    reconcileChildrenArray resource://devtools/client/shared/vendor/react-dom.js:9610
    reconcileChildFibers resource://devtools/client/shared/vendor/react-dom.js:9900
    reconcileChildrenAtExpirationTime resource://devtools/client/shared/vendor/react-dom.js:10161
    reconcileChildren resource://devtools/client/shared/vendor/react-dom.js:10152
    updateHostComponent resource://devtools/client/shared/vendor/react-dom.js:10475
    beginWork resource://devtools/client/shared/vendor/react-dom.js:10898
    performUnitOfWork resource://devtools/client/shared/vendor/react-dom.js:12713
    workLoop resource://devtools/client/shared/vendor/react-dom.js:12730
    renderRoot resource://devtools/client/shared/vendor/react-dom.js:12770
    performWorkOnRoot resource://devtools/client/shared/vendor/react-dom.js:13359
    performWork resource://devtools/client/shared/vendor/react-dom.js:13281
    performSyncWork resource://devtools/client/shared/vendor/react-dom.js:13253
    requestWork resource://devtools/client/shared/vendor/react-dom.js:13153
    scheduleWork$1 resource://devtools/client/shared/vendor/react-dom.js:13022
    enqueueSetState resource://devtools/client/shared/vendor/react-dom.js:8845
    setState React
    Redux 5
    eventTelemetryMiddleware resource://devtools/client/webconsole/middleware/event-telemetry.js:21
    historyPersistenceMiddleware resource://devtools/client/webconsole/middleware/history-persistence.js:33
    thunk resource://devtools/client/webconsole/middleware/thunk.js:14
    throttledDispatchPromise resource://devtools/client/webconsole/webconsole-wrapper.js:600
    setTimeout handler*setTimeoutIfNeeded/this.throttledDispatchPromise< resource://devtools/client/webconsole/webconsole-wrapper.js:590
    setTimeoutIfNeeded resource://devtools/client/webconsole/webconsole-wrapper.js:589
    throttledDispatchPromise resource://devtools/client/webconsole/webconsole-wrapper.js:596
    setTimeout handler*setTimeoutIfNeeded/this.throttledDispatchPromise< resource://devtools/client/webconsole/webconsole-wrapper.js:590
    setTimeoutIfNeeded resource://devtools/client/webconsole/webconsole-wrapper.js:589
    batchedMessageAdd resource://devtools/client/webconsole/webconsole-wrapper.js:558
    dispatchMessageAdd resource://devtools/client/webconsole/webconsole-wrapper.js:410
    dispatchMessageAdd resource://devtools/client/webconsole/webconsole-connection-proxy.js:208
    _onPageError resource://devtools/client/webconsole/webconsole-connection-proxy.js:276
    emit resource://devtools/shared/event-emitter.js:186
    emit resource://devtools/shared/event-emitter.js:267
    onPacket resource://devtools/shared/protocol.js:1424
    onPacket resource://devtools/shared/client/debugger-client.js:601
    _onJSONObjectReady resource://devtools/shared/transport/transport.js:451
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:109
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:109
react-dom.js:11273:13
    logCapturedError resource://devtools/client/shared/vendor/react-dom.js:11273
    logError resource://devtools/client/shared/vendor/react-dom.js:11302
    callback resource://devtools/client/shared/vendor/react-dom.js:11942
    callCallback resource://devtools/client/shared/vendor/react-dom.js:8540
    commitUpdateQueue resource://devtools/client/shared/vendor/react-dom.js:8584
    commitLifeCycles resource://devtools/client/shared/vendor/react-dom.js:11426
    commitAllLifeCycles resource://devtools/client/shared/vendor/react-dom.js:12348
    commitRoot resource://devtools/client/shared/vendor/react-dom.js:12492
    completeRoot resource://devtools/client/shared/vendor/react-dom.js:13417
    performWorkOnRoot resource://devtools/client/shared/vendor/react-dom.js:13362
    performWork resource://devtools/client/shared/vendor/react-dom.js:13281
    performSyncWork resource://devtools/client/shared/vendor/react-dom.js:13253
    requestWork resource://devtools/client/shared/vendor/react-dom.js:13153
    scheduleWork$1 resource://devtools/client/shared/vendor/react-dom.js:13022
    enqueueSetState resource://devtools/client/shared/vendor/react-dom.js:8845
    setState React
    Redux 5
    eventTelemetryMiddleware resource://devtools/client/webconsole/middleware/event-telemetry.js:21
    historyPersistenceMiddleware resource://devtools/client/webconsole/middleware/history-persistence.js:33
    thunk resource://devtools/client/webconsole/middleware/thunk.js:14
    throttledDispatchPromise resource://devtools/client/webconsole/webconsole-wrapper.js:600
    throttledDispatchPromise resource://devtools/client/webconsole/webconsole-wrapper.js:590
    setTimeoutIfNeeded resource://devtools/client/webconsole/webconsole-wrapper.js:589
    throttledDispatchPromise resource://devtools/client/webconsole/webconsole-wrapper.js:596
    throttledDispatchPromise resource://devtools/client/webconsole/webconsole-wrapper.js:590
    setTimeoutIfNeeded resource://devtools/client/webconsole/webconsole-wrapper.js:589
    batchedMessageAdd resource://devtools/client/webconsole/webconsole-wrapper.js:558
    dispatchMessageAdd resource://devtools/client/webconsole/webconsole-wrapper.js:410
    dispatchMessageAdd resource://devtools/client/webconsole/webconsole-connection-proxy.js:208
    _onPageError resource://devtools/client/webconsole/webconsole-connection-proxy.js:276
    emit resource://devtools/shared/event-emitter.js:186
    emit resource://devtools/shared/event-emitter.js:267
    onPacket resource://devtools/shared/protocol.js:1424
    onPacket resource://devtools/shared/client/debugger-client.js:601
    _onJSONObjectReady resource://devtools/shared/transport/transport.js:451
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:109
    makeInfallible resource://devtools/shared/ThreadSafeDevToolsUtils.js:109
Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7Btype%2C%20initial%2C%20length%2C%20actor%7D&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings. react-dom.js:33:15
Error: Can't find the actor ID for stylesheets from root or target actor's form. 3 protocol.js:1664:11
Flags: needinfo?(standard8)
Whiteboard: high-priority-reserve
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED

Did some investigation here. First this is not specific to the new remote debugging, the same issue occurs with WebIDE.
When enabling the JS debug modules, we get the following stack trace from React:

JavaScript error: resource://devtools/client/shared/vendor/react-dom-dev.js, line 59: Error: Objects are not valid as a React child (found: object with keys {type, initial, length, actor}). If you meant to render a collection of children, use an array instead.
    in span (created by Message)
    in span (created by Message)
    in span (created by Message)
    in div (created by Message)
    in Message (created by MessageContainer)
    in MessageContainer (created by ConsoleOutput)
    in div (created by ConsoleOutput)
    in ConsoleOutput
    in VisibilityHandler
    in Unknown (created by Connect(Component))
    in Connect(Component) (created by App)
    in div (created by App)
    in div (created by App)
    in App
    in VisibilityHandler
    in Unknown (created by Connect(Component))
    in Connect(Component)
    in Provider

Looking in Message.js, the .message-body span is failing to render:

      dom.span({ className: "message-body-wrapper" },
        dom.span({
          className: "message-flex-body",
          onClick: collapsible ? this.toggleMessage : undefined,
        },
          // Add whitespaces for formatting when copying to the clipboard.
          timestampEl ? " " : null,
          dom.span({ className: "message-body devtools-monospace" },
            ...bodyElements,
            learnMore,
          ),
          repeat ? " " : null,
          repeat,
          " ", location
        ),
        attachment,
        ...notesNodes
      ),

It seems that bodyElements contains a single longStringActor.
It is actually a grip from https://searchfox.org/mozilla-central/rev/cc280c4be94ff8cf64a27cc9b3d6831ffa49fa45/devtools/server/actors/object/long-string.js#42-50

The stack that leads to create this grip is:

 1:06.91 pid:52278 grip@resource://devtools/server/actors/object/long-string.js:43:17
 1:06.91 pid:52278 longStringGrip@resource://devtools/server/actors/webconsole.js:461:18
 1:06.91 pid:52278 _createStringGrip@resource://devtools/server/actors/webconsole.js:476:19
 1:06.91 pid:52278 onConsoleServiceMessage@resource://devtools/server/actors/webconsole.js:1462:23
 1:06.91 pid:52278 observe@resource://devtools/server/actors/webconsole/listeners/console-service.js:83:19

After that, I suppose we go to transformLogMessagePacket but I am not sure where we are supposed to process the long string into an actual string?

The message itself seems to be a debug message from the following method:
https://searchfox.org/mozilla-central/rev/cc280c4be94ff8cf64a27cc9b3d6831ffa49fa45/toolkit/mozapps/extensions/internal/XPIProvider.jsm#594

If that helps, changing logger.debug(...) to logger.error(...), then the issue doesn't occur.

Nicolas, any idea?

Flags: needinfo?(nchevobbe)

Yes, we fixed a bug yesterday about the same thing (I think), Bug 1549388.
It landed on mozilla-central a few hours ago, could you check if the issue still occurs?

Flags: needinfo?(nchevobbe)

Thanks Nicolas! Looks like it's fixed on central indeed. Closing.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE

great 👍

You need to log in before you can comment on or make changes to this bug.