Open Bug 1752676 Opened 2 years ago Updated 4 months ago

Incorrect handler display on about:preferences after "Always Open Similar Files" (can't find default handler for CSS files)

Categories

(Firefox :: Downloads Panel, defect, P3)

Firefox 97
defect

Tracking

()

UNCONFIRMED

People

(Reporter: jscher2000, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0

Steps to reproduce:

In Firefox 97.0b9, download a CSS file. Right-click the download on the panel and choose "Always Open Similar Files". The file launches in Windows Notepad.

Re-download the file and observe that it opens in Windows Notepad automatically.

Actual results:

Open about:preferences and observe that "Style Sheet" is listed with the Use Windows Default Application icon, but the label Always Ask. The drop-down does not list Use Windows Default Application.

This appears to be another instance of bug 1738706.

Expected results:

"Style Sheet" should list both the Use Windows Default Application icon and label, AND Always Ask should be a separate option on the drop-down list.

Blocks: 1710926
Component: Untriaged → Downloads Panel

In case you need a test link with "Content-Disposition: attachment": https://www.userchrome.org/samples/userChrome-color_bookmark_folders_Proton89.css

This will mean that this code in the preferences doesn't think a default system handler exists

This also explains why the icon is still shown for an application - the default action is reflected in an attribute, which is used for the icon, but because there is no default system handler we do not create a "use [name of app] (system default)" entry in the list, which means we cannot select it, which is why "always ask" is shown instead. This would also be the behaviour once you download, and we cannot find a handler at that time. (but clearly, in this case, when you actually download something, we can find a default handler...)

The real question is why hasDefaultHandler is false when we can find one when you actually download something.

jscher: assuming this is your own experience rather than something from SUMO, if you run this in the regular devtools console in the Firefox settings, what does it return:

gMIMEService.getFromTypeAndExtension("text/css", "css").hasDefaultHandler

and what about:

gMIMEService.getFromTypeAndExtension("text/css", "css").defaultDescription

?

Flags: needinfo?(jscher2000)

This is what I get (before the first download of a CSS file, and also afterwards):

  • gMIMEService.getFromTypeAndExtension("text/css", "css").hasDefaultHandler => false
  • gMIMEService.getFromTypeAndExtension("text/css", "css").defaultDescription => ""
Flags: needinfo?(jscher2000)

So, fwiw: on my windows machine, when I try the steps, I get a Windows "How do you want to open this file" prompt, and if I pick notepad and then "always use this app to open .css files", and then refresh Firefox Settings, it correctly says "Use Applications\notepad.exe (default)", with a notepad icon.

(In reply to jscher2000 from comment #3)

This is what I get (before the first download of a CSS file, and also afterwards):

  • gMIMEService.getFromTypeAndExtension("text/css", "css").hasDefaultHandler => false
  • gMIMEService.getFromTypeAndExtension("text/css", "css").defaultDescription => ""

Right, so my suspicion is correct. What I don't understand is how we still end up launching the file. The example in comment #1, at least, gets sent with the right mimetype and extension to match this instruction, but that means that I would expect the file to also not be opened when downloaded, because we'll do the same lookups and also not find a default handler. In other words, why is the download code able to find a system default app when the file is downloaded?

It looks like the answer might be that we just blindly pass the file to Windows and go "open this file" and make it Windows' problem, and in this case Windows ends up using notepad even if we couldn't figure out that it would.

I'd still be curious what is in the registry under HKEY_CLASSES_ROOT\.css , HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/css, and what shows up in Windows' control panel as the default handler for css files...

Molly, is there somewhere else we should be looking in the hasDefaultHandler code?

And, separately, I wonder if we should just show a generic "Use Windows' default application" (obviously changed to "macOS" and "GTK" or something on other OSes) type entry even for file entries where we cannot find an allocated system handler...

Flags: needinfo?(mhowell)
Flags: needinfo?(jscher2000)
Blocks: 1744297
Severity: -- → S3
Priority: -- → P3
Summary: Incorrect handler display on about:preferences after "Always Open Similar Files" → Incorrect handler display on about:preferences after "Always Open Similar Files" (can't find default handler for CSS files)

Hmm. I would really expect there to be something in HKCR\.css. Perhaps it's possible, depending on how the association was set, that there's a UserChoice entry that hasn't been reflected to the Classes key? The value we'd be looking at for that case would be the one named ProgID under the key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.css\UserChoice (it's always HKCU, HKLM isn't used for this).

Flags: needinfo?(mhowell)

(In reply to :Gijs (he/him) from comment #4)

I'd still be curious what is in the registry under HKEY_CLASSES_ROOT\.css , HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/css, and what shows up in Windows' control panel as the default handler for css files...

I can't be sure whether I have changed this setting in the past. On some installations I used Wordpad and on others Notepad++. But this is what I see currently:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.css]
@="CSSfile"
"Content Type"="text/css"
"PerceivedType"="text"

[HKEY_CLASSES_ROOT\.css\PersistentHandler]
@="{eec97550-47a9-11cf-b952-00aa0051fe20}"


[HKEY_CLASSES_ROOT\MIME\Database\Content Type\text/css]
"Extension"=".css"


[HKEY_CLASSES_ROOT\CSSfile]
@="Cascading Style Sheet Document"
"EditFlags"=dword:00010000
"FriendlyTypeName"="@C:\\Windows\\System32\\ieframe.dll,-24585"

[HKEY_CLASSES_ROOT\CSSfile\DefaultIcon]
@="C:\\Windows\\System32\\shell32.dll,-151"

I think "ieframe.dll" is something of a general purpose handler in the plumbing of Internet Explorer, so there probably is a secondary lookup for its default actions by file type.

Flags: needinfo?(jscher2000)

Whoops, that was the wrong screenshot. Here is the one showing I never selected a default app for .css files.

Attachment #9262418 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: