fregante / GhostText

👻 Use your text editor to write in your browser. Everything you type in the editor will be instantly updated in the browser (and vice versa).
https://GhostText.fregante.com
MIT License
3.28k stars 117 forks source link

silently failing when blocked by uMatrix #105

Closed anarcat closed 3 years ago

anarcat commented 6 years ago

Hi,

I'm trying to see how to make this work in my setup, as a replacement for the obsolete It's all text. I have installed the extension from the Mozilla add-ons site (version GhostText 17.6.1.407) and I have installed the Emacs extension as well (atomic-chrome 20161213.730). I'm using GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian, in Debian stretch.

I have also tested the "atomic chrome" extension in Chrome itself, to no avail: nothing happens on the Emacs side at all. I can confirm port 4001 is open on Emacs' side and that the same port is configured in the Firefox extension:

[998]anarcat@curie:anarc.at$ lsof -i tcp:4001
COMMAND   PID    USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
emacs   32395 anarcat   15u  IPv4 7026340      0t0  TCP localhost:4001 (LISTEN)

Nothing in the Messages buffer and no traffic flowing on port 4001 according to tcpdump. When I disable the uMatrix extension, traffic flows however, so it seems that local XHR requests are blocked by uMatrix. When I fix that, the extension mostly works.

It would be nice if GhostText would notice it cannot send XHR requests because of some block and pop an error message instead of just silently failing. It doesn't say anything in the Javascript console either.

fregante commented 6 years ago

True, most of the time the error message is not very useful. Would you be mind sending a PR to improve it?

anarcat commented 6 years ago

not sure where i would start - any suggestions?

fregante commented 6 years ago

Are you sure you don't get any error like this in the console?

screen shot 2017-10-25 at 20 26 27
anarcat commented 6 years ago

yup, no error. it looks like the XHR calls just hang because when i re-allow localhost in umatrix, emacs pops right back up.

fregante commented 6 years ago

The fetch is being made from background.js so you'd have to enable the developer mode and inspect the background script to see any errors. Honestly I'm very surprised that an extension is able to block another extension's network request, AFAIK this wasn't possible.

chrome settings

I'm not sure what you can do about it either, fetch probably fails without much information so maybe it can't be detected.

fregante commented 3 years ago

Can you test the new version? It hasn't been published to the stores yet: https://github.com/GhostText/GhostText/issues/172

The connection is now being done from background.js, which I don't think is covered by uMatrix. However there's still a lot of communication between the various parts of the extension itself.

fregante commented 3 years ago

If you still have this problem, hand me a red pill in the comments.