raffaeleflorio / qubes-url-redirector

This browser extension, designed for Qubes OS, blocks and/or redirects non whitelisted URLs to another qube of your choice.
GNU General Public License v3.0
35 stars 3 forks source link

The Welcome page shows up for no reason after a few days, upon Firefox startup #41

Closed ghost closed 6 years ago

ghost commented 6 years ago

tl;dr: this happens because > The event `browser.runtime.onInstalled' will be fired also on a Firefox update.

After a few days (I don't know how many) the qubes-url-redirector Welcome page opens up in a new tab. I've Firefox set to restore session and this Welcome page appears as a new tab after startup. I have Automatic Updates off for this extension. Last update was 8 oct 2018. I'm running other extensions: uBlock Origin, uMatrix, NoScript, Https Everywhere.

Firefox Quantum 
63.0 (64-bit) 
Mozilla Firefox for Fedora 
fedora -1.0

on a Fedora 28 Qubes AppVM.

All firefoxes in all other AppVMs showed The Welcome page for qubes-url-redirector right now. This happened before, but I thought maybe it auto-updated behind my back. However, this time I didn't have internet cable connected (though, arguably it could've updated last time browser was running, but I doubt it).

related #17

ghost commented 6 years ago

I forgot to mention, I've installed it manually, so Firefox says: extensionuntitled

ie. it's installed from a .zip file

raffaeleflorio commented 6 years ago

Did you install the extension in a TemplateVM or in AppVM(s)?

I have Automatic Updates off for this extension

This feature is disabled because it doens't verify the authenticity of the updated extension.

ie. it's installed from a .zip file

Why this choice?

ghost commented 6 years ago

Did you install the extension in a TemplateVM or in AppVM(s)?

half in TemplateVM, and half in AppVM(s) So, the repo is cloned in the TemplateVM, somewhere in $HOME, and then I did: make setup which is (unchanged code):

NATIVE_MANIFEST=qvm_open_in_vm.json
NATIVE_BIN=qvm-open-in-vm-we.py
QUR_D=/opt/qubes-url-redirector
PACKAGES_D=packages
ZIP_D=${PACKAGES_D}/zip
FIREFOX_NATIVE_D=~/.mozilla/native-messaging-hosts

setup:
        sudo mkdir -p ${QUR_D}
        sudo cp common/${NATIVE_BIN} ${QUR_D}/
        sudo chmod u+x ${QUR_D}/${NATIVE_BIN}

Then in the AppVM(s), I did: make ff_setup which is (changed):

+ffzip:
+       rm -f ${ZIP_D}/firefox-latest.zip
        cd firefox && zip -x @../${ZIP_D}/exclude.lst -qr ../${ZIP_D}/firefox-latest.zip -9 -X .
+
+ff_setup: ffzip setup
+       mkdir -p ${FIREFOX_NATIVE_D}
+       cp -a -- firefox/native-messaging-hosts/${NATIVE_MANIFEST} ${FIREFOX_NATIVE_D}/
+       @echo "Install '`realpath -- "${ZIP_D}/firefox-latest.zip"`' as extension in Firefox but don't forget to first, in about:config, set xpinstall.signatures.required=false and network.ftp.enabled=false"

I have Automatic Updates off for this extension

This feature is disabled because it doens't verify the authenticity of the updated extension.

Great for me.

ie. it's installed from a .zip file

Why this choice?

Let me try to remember... I guess I wanted to make sure the code that I'm running in Firefox is the same as the source code from the github. And, if I wanted to make any modifications, I could do it.

So installing from .zip required me to manually set xpinstall.signatures.required=false and I also set network.ftp.enabled=false.

ghost commented 6 years ago

I found an AppVM which I didn't bring up until now, and it did show me the Welcome page, so here's some info: The welcome page's url is: moz-extension://5664a9b6-f106-48a1-9abe-39f20f02e08f/common/html/welcome.html and it opened in a new tab, after Firefox restored all the old ones that remained open last time I exited (which it usually does on startup) - so it wasn't an error and it recovered tabs.

ff_welcomepage_screenshot_2018-11-06_01-54-38

Then I opened Firefox console Ctrl+Shift+J: ffconsolefail_screenshot_2018-11-06_01-50-53

[user@virustotallogin-w-s-f-fdr28 ~]$ ls -la /usr/lib64/firefox/browser/features/
total 2976
drwxr-xr-x 2 root root    4096 Oct 29 03:04 .
drwxr-xr-x 5 root root    4096 Oct 29 03:04 ..
-rw-r--r-- 1 root root  897971 Oct 23 12:28 firefox@getpocket.com.xpi
-rw-r--r-- 1 root root  480957 Oct 23 12:28 formautofill@mozilla.org.xpi
-rw-r--r-- 1 root root  563652 Oct 23 12:28 onboarding@mozilla.org.xpi
-rw-r--r-- 1 root root 1045620 Oct 23 12:28 screenshots@mozilla.org.xpi
-rw-r--r-- 1 root root   22630 Oct 23 12:28 webcompat@mozilla.org.xpi
-rw-r--r-- 1 root root   14606 Oct 23 12:28 webcompat-reporter@mozilla.org.xpi

Maybe that aushelper@mozilla.org.xpi existed before the last firefox update?

Then this happened a few minutes later (I must've clicked something I think): ffconsolefail2of2_screenshot_2018-11-06_01-54-22

As far as I remember, aside from adding those extensions(uBlock Origin, uMatrix, https-everywhere from their original webstore), Firefox is vanilla Fedora 28.

So, on the next run, as mentioned in OP, it doesn't display the Welcome page ever again (until who knows how many days into the future), and here's the console: ffnormalrun_screenshot_2018-11-06_02-13-29

ghost commented 6 years ago

so looks like it's because QUR.settings is undefined, but why is it undefined, no idea, seems like it's Firefox's fault.

raffaeleflorio commented 6 years ago

I found an AppVM which I didn't bring up until now, and it did show me the Welcome page, so here's some info: The welcome page's url is: moz-extension://5664a9b6-f106-48a1-9abe-39f20f02e08f/common/html/welcome.html and it opened in a new tab, after Firefox restored all the old ones that remained open last time I exited (which it usually does on startup) - so it wasn't an error and it recovered tabs.

So in this case everything is correct, is that right?

Maybe that aushelper@mozilla.org.xpi existed before the last firefox update?

It's not related to aushelper. However I got it.. The event `browser.runtime.onInstalled' will be fired also on a Firefox update. So because Firefox has been updated recently, so this event has been fired and the welcome page showed. https://github.com/raffaeleflorio/qubes-url-redirector/blob/3b89f3def40124ce312eef615a872f1b496022dd/common/js/backend/main.js#L59

raffaeleflorio commented 6 years ago

so looks like it's because QUR.settings is undefined, but why is it undefined, no idea, seems like it's Firefox's fault.

The affected line: https://github.com/raffaeleflorio/qubes-url-redirector/blob/3b89f3def40124ce312eef615a872f1b496022dd/common/js/backend/messaging/settingsML.js#L26 is related to the opening of the settings page. Was that page restored too?

ghost commented 6 years ago

I found an AppVM which I didn't bring up until now, and it did show me the Welcome page, so here's some info: The welcome page's url is: moz-extension://5664a9b6-f106-48a1-9abe-39f20f02e08f/common/html/welcome.html and it opened in a new tab, after Firefox restored all the old ones that remained open last time I exited (which it usually does on startup) - so it wasn't an error and it recovered tabs.

So in this case everything is correct, is that right? What I meant is that this AppVM shouldn't have displayed the Welcome page either, but it did. So I guess it is because I haven't started it since the last time firefox got updated.

Maybe that aushelper@mozilla.org.xpi existed before the last firefox update?

It's not related to aushelper. agreed. However I got it.. The event `browser.runtime.onInstalled' will be fired also on a Firefox update. So because Firefox has been updated recently, so this event has been fired and the welcome page showed. Well this explains it all. I can thus close this issue I guess.

qubes-url-redirector/common/js/backend/main.js

Line 59 in 3b89f3d browser.runtime.onInstalled.addListener(function () {

so looks like it's because QUR.settings is undefined, but why is it undefined, no idea, seems like it's Firefox's fault.

The affected line:

qubes-url-redirector/common/js/backend/messaging/settingsML.js

Line 26 in 3b89f3d sendResponse(QUR.settings.toJSON());

is related to the opening of the settings page. Was that page restored too?

I don't remember having that open, unless I opened it myself afterward(?), but I think it looked like this: which shows no settings tab for this extension having been opened. Anyway, I guess it doesn't matter now. Thanks for your help!

raffaeleflorio commented 6 years ago

Thanks for your help!

It's a pleasure!