ysard / mintrayr

Mozilla extension: Minimize windows into the system tray (Firefox, Thunderbird, Seamonkey, Instantbird)
https://addons.thunderbird.net/en-US/thunderbird/addon/minimizetotray-reanimated/
Mozilla Public License 2.0
130 stars 14 forks source link

Doesn't work with TB 60.3.3 on Windows 7 #24

Closed neon-dev closed 5 years ago

neon-dev commented 5 years ago

It installs just fine, but none of its functions work. There's no tray icon even when configuring it to always show and minimizing doesn't behave differently either. If I set it to minimize on close, Thunderbird just exits like normally. It doesn't seem like the addon is active, even though the config window shows up. Am I missing something?

Environment:

neon-dev commented 5 years ago

Ok I just found out how to open the console in Thunderbird. Here's the output:

mintrayr - extension path:  ///Server/[…]/extensions/mintray-reanimated@ysard.xpi  trayservice.jsm:66:5
mintrayr - extraction path:  ///Server/[…]/extensions/mintray-reanimated@ysard  trayservice.jsm:72:5
NS_ERROR_FILE_UNRECOGNIZED_PATH: Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsIFile.initWithPath]  trayservice.jsm:78
    _directory< resource://mintrayr/trayservice.jsm:78:5
    <anonym> resource://mintrayr/trayservice.jsm:51:21
    <anonym> resource://mintrayr/mintrayr.jsm:10:1
    <anonym> chrome://mintrayr/content/messenger/messenger.js:14:5

Seems like it doesn't handle correctly being load from a network drive. My whole profile folder is located on this drive.

ysard commented 5 years ago

Thanks for your feedback, you are the first user to use a profile on a network drive. The path to your profile does not contain a drive letter? Could you give me the path that allows you to reach your profile (without sensitive data)? Is it: //Server/[...]/extensions/mintray-reanimated@ysard.xpi with 2 leading slashs?

neon-dev commented 5 years ago

Thanks for looking into it. Path= in profiles.ini starts with A:\, so it is configured with a drive letter. The console output seems to just print the resolved path. Also interesting to you may be that the configured path contains spaces. Otherwise there are no special characters in it.

sonaux commented 5 years ago

I am using network share too and extension does not work. (previous "revived" version worked well until TB60.x) Thunderbird 60.4.0 Windows 10 x64 profile.ini:

Name=natalia
IsRelative=0
Path=\\fs\mail\natalia
Default=1

Console output:

mintrayr - extension path:  ///fs/mail/natalia/extensions/mintray-reanimated@ysard.xpi  trayservice.jsm:66:5
NS_ERROR_FILE_UNRECOGNIZED_PATH: Component returned failure code: 0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsIFile.initWithPath]  trayservice.jsm:78
mintrayr - extraction path:  ///fs/mail/natalia/extensions/mintray-reanimated@ysard  trayservice.jsm:72:5

I looked into code and saw that nsLocalFile::InitWithPath that called by nsIFile.initWithPath actually supports UNC paths, but backslashes in input string are converted into forward slashes and that causes error. Maybe this code in function fixPath

    if (/^\/[A-Z]:\//.test(path)) { // detect if this is broken windows path: '\C:\xxx'
        path = path.substring(1, path.length); // remove leading slash
        path = path.replace(/\//g, '\\'); // also convert slash to backslash
    }
    return path;

should convert slashes to backslashes not only in case of broken windows path: '\C:\xxx' but always do so? At least this dirty hack does the trick on my config (did not test on regular c:\Users\xxx... or some relative paths) and extension is working fine:

    // fix path for windows
    path = path.replace(/\//g, '\\'); // also convert slash to backslash
    path = path.substring(1, path.length); // remove leading slash
    return path;
sonaux commented 5 years ago

Better fix:

    // fix path for windows
    if (/^\/[A-Z]:\//.test(path) || /^\/\/\//.test(path)) { // detect if this is broken windows path: '\C:\xxx' or UNC path '\\\server\share'
        path = path.substring(1, path.length); // remove leading slash
        path = path.replace(/\//g, '\\'); // also convert slash to backslash
    }
    return path;

Console output after fix:

mintrayr - extension path:  \\fs\mail\natalia\extensions\mintray-reanimated@ysard.xpi  trayservice.jsm:66:5
mintrayr - extraction path:  \\fs\mail\natalia\extensions\mintray-reanimated@ysard  trayservice.jsm:72:5
ysard commented 5 years ago

Hi, thank you for your patch, this should be fixed in the version 1.4.8: https://github.com/ysard/mintrayr/releases

Regards.

dougbreaux commented 5 years ago

No XPI for the release?

ysard commented 5 years ago

Sorry there was an error during the upload. It's OK now.

neon-dev commented 5 years ago

Works fine now, thanks :)