Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

opening URL from external application (Thunderbird/LibreOffice) does not work any more #9193

Closed
crysman opened this issue Jun 1, 2017 · 53 comments · Fixed by #10215 or #10375
Closed

Comments

@crysman
Copy link

crysman commented Jun 1, 2017

Xubuntu 16.10
Brave 0.15.310 rev 6b5e4e2
os.platform linux
os.release 4.8.0-53-generic
os.arch x64

  • Issue:
    opening URL from external application (Thunderbird/LibreOffice) does not work any more. It works only when there is no Brave instance running yet. When Brave is running already, it focuses the Brave Window, but no tab is opened :/

  • Steps to reproduce:

    1. Have Brave opened alread with several tabs
    2. click on link URL from Thunderbird and/or other application
  • Actual result:
    When Brave is running already, it focuses the Brave Window, but no tab is opened :/

  • Expected result:
    URL gets opened in Brave as before

  • Will the steps above reproduce in a fresh profile? If not what other info can be added?
    Do not know

  • Is this an issue in the currently released version?
    Yes

  • Can this issue be consistently reproduced?
    Yes, various restarts performed

@imolein
Copy link

imolein commented Jun 6, 2017

Same probleme here at Xubuntu 16.04 with a fresh installed brave browser (0.15.314 rev 75ffa36)

@luixxiul luixxiul added the bug label Jun 6, 2017
@imolein
Copy link

imolein commented Jun 6, 2017

Opening brave over the console, while a other instance of brave is running, the brave window is focused and the console is throwing
hbs@hbs-work:~$ brave [31406:31430:0606/180000.720364:ERROR:connection.cc(1954)] Web sqlite error 5, errno 0: database is locked, sql: PRAGMA auto_vacuum [31406:31430:0606/180000.720467:ERROR:connection.cc(1954)] Web sqlite error 5, errno 0: database is locked, sql: PRAGMA journal_mode = TRUNCATE

@crysman
Copy link
Author

crysman commented Jun 21, 2017

It's still not resolved in
Brave 0.16.12
rev 72624a2

:/

What about you others? You don't have issues?

@frk2
Copy link

frk2 commented Jun 21, 2017

I have the same issue with the latest on Ubuntu 17.04

@bsclifton
Copy link
Member

@crysman do you know if this used to work previously? What window manager are you using?

@bsclifton bsclifton added the needs-info Another team member needs information from the PR/issue opener. label Jun 22, 2017
@imolein
Copy link

imolein commented Jun 22, 2017

Brave 0.16.13
rev 7869803

Tested it on the following distributions and window managers:

Xubuntu 16.04 - XFCE - Problem exists
Debian Testing - XFCE - Problem exists
Ubuntu 16.04 - Mate - Problem exists
Kubuntu 16.04 - KDE - Problem exists

@call-cc
Copy link

call-cc commented Jun 22, 2017

Same problem here. Brave gets the focus, but no link is opened.

Ubuntu 16.04 with Gnome-shell.
Brave 0.16.13 rev 7869803

I'm having this problem since the last 4 or 5 updates from the Brave Xenial repository, probably since version 0.14.something or 0.15.something.

@crysman
Copy link
Author

crysman commented Jun 22, 2017

cca 2 months ago it had been working, it's some 5 brave updates since...

@call-cc
Copy link

call-cc commented Jun 23, 2017

Is it possible to open a new tab in Brave via the command line? e.g. "brave http://brave.com" ? So we could test whether that works.

@bsclifton
Copy link
Member

@call-cc yes- you should be able to do something like:
brave -- "https://brave.com"

That should be the format that executables are calling Brave with. With Windows, some registry hacks were needed to make it work. I'm curious how Linux is calling it?

@crysman
Copy link
Author

crysman commented Jun 23, 2017

@call-cc > nope, it is not working :( in case brave is already running. see below:

myself@machine ~ 11:42:23
❱ brave http://brave.com
[21171:21192:0623/235838.112647:ERROR:connection.cc(1954)] Web sqlite error 5, errno 0: database is locked, sql: PRAGMA auto_vacuum
[21171:21192:0623/235838.113052:ERROR:connection.cc(1954)] Web sqlite error 5, errno 0: database is locked, sql: PRAGMA journal_mode = TRUNCATE

this is what happens when brave is not running (it works):

myself@machine ~ 11:58:38
❱ ps aux | grep -i brave | grep -v grep
1 myself@machine ~ 11:59:27
❱ echo "(brave not running now)"
(brave not running now)
myself@machine ~ 11:59:43
❱ brave http://brave.com
Crash reporting enabled
[21386:21386:0623/235953.983585:ERROR:CONSOLE(33239)] "(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", source: chrome://brave/usr/share/brave/resources/app.asar/app/extensions/brave/gen/app.entry.js (33239)
[21386:21386:0623/235953.988483:ERROR:CONSOLE(33239)] "(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.", source: chrome://brave/usr/share/brave/resources/app.asar/app/extensions/brave/gen/app.entry.js (33239)
[21386:21411:0624/000024.039978:ERROR:service_manager.cc(158)] Connection InterfaceProviderSpec prevented service: content_browser from binding interface: content::mojom::Child exposed by: content_renderer
[21386:21411:0624/000024.040038:ERROR:service_manager.cc(158)] Connection InterfaceProviderSpec prevented service: content_browser from binding interface: IPC::mojom::ChannelBootstrap exposed by: content_renderer
[21386:21411:0624/000024.040145:ERROR:service_manager.cc(158)] Connection InterfaceProviderSpec prevented service: content_browser from binding interface: content::mojom::Child exposed by: content_renderer
[21386:21411:0624/000024.040191:ERROR:service_manager.cc(158)] Connection InterfaceProviderSpec prevented service: content_browser from binding interface: IPC::mojom::ChannelBootstrap exposed by: content_renderer

Name Version
Brave 0.16.12
rev 72624a2

@call-cc
Copy link

call-cc commented Jun 26, 2017

(I can confirm that

brave -- http://y99k.com/

works.)

I did some strace-ing and it seems that the problem is how gnome-terminal (or any other application) calls Brave:

10404 08:24:40.454225 execve("/usr/bin/brave", ["brave", "http://y99k.com/"...], [/* 74 vars */] <unfinished ...>

So, the first argument to Brave is the URL and not '--'. As I understand @bsclifton, Brave expects its first argument to be '--'.

This was working fine before, so I guess there was a change made to Brave.

@crysman
Copy link
Author

crysman commented Jun 28, 2017

Yes it had been working just fine before. It is a real pain now, I am even considering letting Brave go :(

Even using ubuntu-bug tool is impossible with this bug, since it does not open any window in a browser to fill-in the bug details...

@luixxiul luixxiul added needs-investigation A bug not 100% confirmed/fixed that needs QA to better audit. and removed needs-info Another team member needs information from the PR/issue opener. labels Jun 28, 2017
@luixxiul luixxiul added this to the 0.19.x (Nightly Channel) milestone Jun 28, 2017
@luixxiul
Copy link
Contributor

maybe due to muon/cr59 change?

putting a milestone in case.

@ghost
Copy link

ghost commented Jul 6, 2017

I can confirm this on Kubuntu 14.04. Diverging from the standard browser https://url.here will definitely hurt adoption of brave. I had to switch back to another browser because brave doesn't work as a default browser.

@luixxiul luixxiul added QA/test-plan-specified and removed needs-investigation A bug not 100% confirmed/fixed that needs QA to better audit. needs-triage labels Jul 9, 2017
@alexwykoff alexwykoff modified the milestones: 0.21.x (Nightly Channel), 0.19.x (Beta Channel) Jul 18, 2017
@srirambv
Copy link
Collaborator

@ghost
Copy link

ghost commented Aug 9, 2017

@bsclifton I still have the branch locally. Maybe a rebase onto the new master will do.

@mrkskwsnck
Copy link

mrkskwsnck commented Aug 10, 2017

I am new to the Brave browser and have ran into exactly the same issue: Can’t open external Links (from Evolution, Telegram etc.) if the Brave browser is already running. - Very annoying 👎

My System:

  • Xubuntu 17.04 Zesty Zapus
  • Brave 0.18.16

I was doing some research and I think I found an solution especially for XFCE desktop.
The main problem seemed to me that Brave didn't come up in the Favorite Applications settings for setting it as the default browser.
However, I was able to choose another installed browsers but not Brave itself.

So I compared the application starter files provided by Brave, Vivaldi and Google Chrome inside both /usr/share/applications/ and ~/.local/share/xfce4/helpers/ folders.
The XFCE compatible starter files contained four additional lines.

Type=X-XFCE-Helper
X-XFCE-Category=WebBrowser
X-XFCE-Commands=</path/to/binary>
X-XFCE-CommandsWithParameter=<command_to_execute_with_params>

My idea was to supplement these four lines to the original application starter file.
But because I didn't want to edit the original file I copied the brave starter file to the user space.

cp /usr/share/applications/brave.desktop ~/.local/share/xfce4/helpers/brave.desktop

Then I adapted the latter two lines to conform to the installed Brave browser.
Now the Exec and X-XFCE-CommandsWithParameter entries look very similar.

Type=X-XFCE-Helper
X-XFCE-Category=WebBrowser
X-XFCE-Commands=/usr/bin/brave
X-XFCE-CommandsWithParameter=sh -c "brave -- %s"

After all these steps the Brave browser now comes up in the Favorite Applications settings.
So finally I am able to set Brave as default browser AND external links successfully do open in an already running Brave insance 👍

bildschirmfoto_2017-08-10_17-53-26

My complete Brave starter file looks like below

[Desktop Entry]
Name=Brave
Comment=Brave laptop and desktop browser
GenericName=Web Browser
Exec=sh -c "brave -- %U"
Icon=brave
Type=Application
StartupNotify=true
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;
Type=X-XFCE-Helper
X-XFCE-Category=WebBrowser
X-XFCE-Commands=/usr/bin/brave
X-XFCE-CommandsWithParameter=sh -c "brave -- %s"

Hopefully someone will find this helpful...

@NejcZdovc
Copy link
Contributor

NejcZdovc commented Aug 10, 2017

cc @bsclifton @posix4e for this last comment

@crysman
Copy link
Author

crysman commented Aug 13, 2017

after invoking
xdg-settings set default-web-browser brave.desktop
I am opening links from Thunderbird successfully (using the same brave.desktop as here #9193 (comment))

dfperry5 pushed a commit to dfperry5/browser-laptop that referenced this issue Aug 18, 2017
The cased treated before were very limited and unlike other browsers e.g

  - `firefox [OPTIONS] [url]`
  - `chromium-browser [OPTION] [PATH|URL]`

This commit assumes (like other browsers) that the last argument
 is an url and tries to interpret it as such.
 If that fails, then it simply returns `undefined`, as before.

Resolves brave#9193 opening URL from external application (Thunderbird/LibreOffice) does not work any more
@bsclifton bsclifton reopened this Aug 22, 2017
@bsclifton
Copy link
Member

bsclifton commented Aug 22, 2017

Re-opening after reverting #10375 with https://github.com/bsclifton/browser-laptop/commit/027589c3053e4e0581a3c5508b75c6fd600659f4

Myself, @darkdh, and @bridiver noticed issues where launching in dev mode would always open file://usr/local/brave/browser-laptop-bootstrap/src/browser-laptop

The previous fix is still in place (the desktop file). This is a confirmed fix for multiple folks. It would be great to understand the remaining fix. It might be as easy as adding this to the desktop file:

Type=X-XFCE-Helper
X-XFCE-Category=WebBrowser
X-XFCE-Commands=/usr/bin/brave
X-XFCE-CommandsWithParameter=sh -c "brave -- %s"

Repos that would need updating:
https://github.com/brave/electron-installer-debian
https://github.com/brave/electron-installer-redhat

bsclifton added a commit that referenced this issue Aug 22, 2017
This reverts commit d8da991.

Revert "Revert "Use a forked version of electron-installer for debian/redhat which properly sets `Exec` line""
This reverts commit 0721306.

This un-fixes #9193
bsclifton added a commit that referenced this issue Aug 22, 2017
This reverts commit d8da991.

Revert "Revert "Use a forked version of electron-installer for debian/redhat which properly sets `Exec` line""
This reverts commit 0721306.

This un-fixes #9193
@bsclifton
Copy link
Member

Closing this issue as the largest use-cases are resolved

For XFCE, I created the following issue: #10897
cc: @crysman, @mrkskwsnck, @imolein

It sounds like we may need to create a similar issue for KDE (per comment by @aliddell)

@bsclifton bsclifton removed this from the 0.19.x (Beta Channel) milestone Sep 11, 2017
@Hedronmx
Copy link

I'm having this problem on Elementary OS as well... I tried the latest beta and I still can't open links when the browser is already opened

@stefonarch
Copy link

stefonarch commented Sep 19, 2018

Stumbled on this thread, still same issue on arch with generic binary, opens window but no tab no link.
schermata-19-22-28-49

EDIT: my workaround is calling a script instead of brave....

#!/bin/bash
brave -- $1

@smetj
Copy link

smetj commented Oct 26, 2018

This problem still persists and tbh it's a bit hard to imagine it doesn't float to high priority bugs.

A simplified example.
When I have this link displayed in my terminal:
https://www.google.com/search?q=brave%20error

and I click on it, then brave opens following URL:
https://www.google.com/search?q=brave

Firefox and Chrome handle these just fine.

The problem occurs also when opening links from Slack where this becomes annoying very quickly.

@jonathansampson
Copy link
Collaborator

jonathansampson commented Oct 26, 2018

@smetj Have you tried this while one of our new brave-core builds set as your default browser? I suspect the issue is resolved there. We'll be upgrading users from the older Muon build in the near future.

@smetj
Copy link

smetj commented Oct 26, 2018

@jonathansampson thanks for the quick reply. Indeed ... I have now switched to the brave dev version and ... the problem is gone.

@MarshCastle
Copy link

I agree with the above - this is damaging to uptake - I can't get people to use Brave if they can't open a link from an external source :/
I'm running this on Stretch, and none of the above work for me - I can't even find a way to open a link from the command line without quoting the URL, and can't use a script to open as in @stephonarch approach.

I'd rather use a repo than build / install a brave-core builed (not even sure what that is!).

Sorry to be down - but would really like a solution that I can pass on to people to get Brave adopted.

@stefonarch
Copy link

Hm, strange that the script doesn't work for you.
I've switched to the chrome version and with it this issue isn't present anymore.

@MarshCastle
Copy link

has this got to do with my setup only accepting the argument / url as a quoted / escaped string? i.e. I get:

$ brave-browser https://www.google.com/search?ei=UQz0W-CeLIyUgAbKmac4&q=hello+chicken&oq=hello+chicken&gs_l=psy-ab.3..0l10.14437.17340..18005...0.0..0.59.412.8......0....1..gws-wiz.......0i71j0i67j0i131j0i3.4ogVGROI0jk

fails at the first '&', whereas using quotes:

$ brave-browser "https://www.google.com/search?ei=UQz0W-CeLIyUgAbKmac4&q=hello+chicken&oq=hello+chicken&gs_l=psy-ab.3..0l10.14437.17340..18005...0.0..0.59.412.8......0....1..gws-wiz.......0i71j0i67j0i131j0i3.4ogVGROI0jk"

it works without any problem.

I can't seem to push quotes through from a script though. quotes get stripped and I end up in scenario 1, and if i use " to escape them then it pushes it straight to the browser and I get a complete faiulre to load a page.

is there a way to feed a quoted string from a script?

@MarshCastle
Copy link

ps: (sorry) I did try to adapt the Chrome .desktop file, but had no joy :(

Cheers :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.