filips123 / PWAsForFirefox

A tool to install, manage and use Progressive Web Apps (PWAs) in Mozilla Firefox
https://pwasforfirefox.filips.si
Mozilla Public License 2.0
2.28k stars 52 forks source link

UserChrome modifications are not always copied when copying is not forced #165

Open Nerpson opened 2 years ago

Nerpson commented 2 years ago

Since last update, when I try to open any PWA from Windows' start menu, it just opens the Firefox used for PWAs. image image

I already tried to reinstall both the extension and the software, without success.

filips123 commented 2 years ago

Please check what Windows shows as a created and last modified date/times for C:\Program Files\FirefoxPWA\userchrome\profile\chrome\pwa\chrome.jsm and for %APPDATA%\FirefoxPWA\profiles\00000000000000000000000000\chrome\pwa\chrome.jsm (replace zeros with your profile ID if your PWA is not in a default profile). Also, please check if these two files differ in any way.

Because it seems that the program does not detect properly that a file has been modified so it does not copy a fix (see also #154). You should be able to fix it by enabling "Always patch runtime" in the extension settings, but first please check what I said above because I need that information for a proper fix.

Nerpson commented 2 years ago

Thanks for the quick answer. Both files have creation and last modification datetimes. I programmatically compared those two files and found no difference. Checking "Always patch runtime" once did fix the issue, indeed.

filips123 commented 2 years ago

I don't know why this happened and how to fix it. Basically, PWAsForFirefox has all code necessary to modify Firefox stored in C:\Program Files\FirefoxPWA\userchrome (on Windows) or /usr/share/firefoxpwa/userchrome (on Linux). This code is updated by the installer/Linux package, and copied to %APPDATA%\FirefoxPWA\runtime (code from runtime dir) and %APPDATA%\FirefoxPWA\profiles\PROFILE-ID (code from profile dir) when you launch a PWA.

I implemented some checks that get last modified datetime of userchrome/profile/chrome/pwa/chrome.jsm both in source and target directory and only copy files (here and here) when they are different. This should work fine because that file contains version info, so when a new version is released and downloaded (by the installer/package), the last modified date will also be newer, and PWAsForFirefox will copy all files to the correct directories. This way, files should only be copied the first time a PWA is launched after an update (well, the first time for each profile).

However, something doesn't work and I'm not sure what... It appears userchrome/profile/chrome/pwa/chrome.jsm has been copied, but some other files (specifically, userchrome/runtime/_autoconfig.cfg and userchrome/profile/chrome/pwa/boot.jsm, which contain a fix for Firefox 101.0) haven't been. But because userchrome/profile/chrome/pwa/chrome.jsm has been copied, PWAsForFirefox thinks all other files have also been copied and doesn't actually copy them (unless copying is forced with that option in the extension).

First I thought it might just be some random issue, but considering at least 4 people have this issue, it's probably some actual problem. However, I cannot reproduce it. If anyone knows what this might be, I will appreciate any help.

Nerpson commented 2 years ago

I saw in the issue mentioned above that the OP has installed an extension just before. Now it reminds me that I also did. The extension was EditThisCookie2. Hope it helps

filips123 commented 2 years ago

Thanks for trying to help, but it's probably just a coincidence. I don't think the extension could affect something like this.