Closed ricewind012 closed 1 year ago
Mmm, yeah I should do that, thanks for reporting.
This is actually more interesting than I thought it would be.
The loader handles the file just fine. However, it seems there is a restriction with chrome:
resolution such that the path must always start with [a-zA-Z0-9]
per searchfox
Note that just the top-level path must start with with alpanumeric characters - if your file would be in a sub-folder then starting its name with an underscore works fine. Of course, then the loader won't find it, but the chrome uri resolver doesn't restrict the filename in such case.
Also, since it is about Firefox internal chrome uri resolution this same limitation affects other resources as well. So, if you were to say, create a file _icon.png
in the resources directory, then you cannot use with chrome url - so this won't work:
#preferences-button{
list-style-image: url("chrome://userchrome/content/_icon.png") !important;
}
But if you move the file into a sub-folder then it works fine:
#preferences-button{
list-style-image: url("chrome://userchrome/content/newdir/_icon.png") !important;
}
I'm not sure how I should handle this. I could just completely ignore all scripts that don't start with [a-zA-Z0-9]
or I could potentially just not load them and instead give show a clear error that loading a file with this name won't work. That sounds neat, but then I would give such a warning for every non-matching file - not just those starting with an underscore.
I'm not sure how I should handle this
it already says "invalid filename?", so you could put the name restriction in the readme, or link to this issue
That sounds neat, but then I would give such a warning for every non-matching file - not just those starting with an underscore.
is there an issue with that ?
is there an issue with that ?
The only technical issue is that then the loader (boot.sys.mjs) would do work on more files (I mean, you probably shouldn't store other files in the scripts directory, but there's nothing stopping you from doing so).
But I can realistically only warn about script files (and manifests) starting with non-alphanumeric character while the issue still applies to files in resources, and the loader can't possibly warn about those because it doesn't do anything with the itself - the only thing it does is make resources (and scripts) directories accessible via chrome:
protocol.
So, I'm leaning towards just adding a section to readme and then make the loader ignore files script files that don't start with an alphanumeric character - right now the loader tries to use such files which leads to an invalid uri error currently.
I got the following error for filename
_replace-window-title.uc.js
, but notreplace-window-title.uc.js
: