Printing fails on Ubuntu

Description of the issue:

Printing fails 100% of the time to any printer. The dialog/preview work and I can see my printers. When I launch the print dialog I see the following error messages in the console:

[2098339:2098339:0108/122912.888999:ERROR:CONSOLE:1] “Uncaught (in promise) ReferenceError: Mojo is not defined”, source: chrome://resources/mojo/mojo/public/js/bindings.js (1) [2098339:2098339:0108/122913.152436:ERROR:CONSOLE:1] “Uncaught (in promise) ReferenceError: Mojo is not defined”, source: chrome://resources/mojo/mojo/public/js/bindings.js (1) [2098339:2098339:0108/123119.515260:ERROR:mojo/public/cpp/bindings/lib/interface_endpoint_client.cc:732] Message 0 rejected by interface blink.mojom.WidgetHost

Using the normal method to print or the system dialog both fail.

How can this issue be reproduced?

  1. Run Brave on Ubuntu 24.04

  2. Attempt to print

Expected result:

Document should be sent to CUPS

Brave Version( check About Brave):

1.85.120

1 Like

A bit more info here. The package in the beta channel prints successfully, but still displays this error message. Chromium does not display this message (and also prints fine).

So, I tried to replicate this for you but I cannot for the life of me get any of my 3 Linux VM’s to connect to my networked Brother laser printer to try this for you.

With that said, the forum software here absolutely cut off your errors. I’m going to attach a screenshot as it does show up when pasted, but visually it’s truncated on-screen. (Yes, I had to paste your “using the normal method” line to get the last line to actually show.)

@Mattches this appears to be a mojo binding issue?

1 Like

Yeah, seems like its a race condition or initialization issue where the print object can’t be found or accessed by Mojo during the process. The last part of the error message (Message 0 rejected by interface blink.mojom.WidgetHost) seems to imply that the communication between Mojo and the browser is lost/destroyed/etc.which results in the object not being printed. That said I’d expect you to see the same problem with all Chromium browsers so its strange that its only occurring in Brave.

@sproctor I would be interested to know if you’re printing straight from Brave’s print preview or if you’re using the system dialog? I believe they used different code paths so you may try printing using the opposite of what you typically do to see if that makes any difference.

Additionally, since printing works in Beta, it may be something specific to your main profile that’s blocking/rejecting/otherwise conflicting with the communication between the browser and Mojo. I would suggest creating a fresh profile and trying to print something from there to see if you get the same results. If you do this make sure you only have the fresh profile window open.

I’ve tried printing straight from the preview and with the system dialog, both fail. I’ve tried using a new profile. I’ve tried uninstalling brave, clearing everything and reinstalling. The only thing that worked was switching to the beta. It’s weird that it has the same error messages, but still works.

That’s weird. I see what you mean. In the preview, there’s a vertical scrollbar. on the actual forum there isn’t. I changed the format. It looks terrible either way, but at least this way you can see all of the text.

@sproctor did you open this issue on Github? https://github.com/brave/brave-browser/issues/50219