Last Comment Bug 303581 - Loading local SVG brings up Save As dialog, and <embed>ded SVG without 'type' attribute fails
: Loading local SVG brings up Save As dialog, and <embed>ded SVG without 'type'...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: SVG (show other bugs)
: Trunk
: x86 Windows XP
: -- normal with 5 votes (vote)
: mozilla26
Assigned To: Robert Longson
:
: Jet Villegas (:jet)
Mentors:
: 314885 368009 908069 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-08-05 08:54 PDT by Jeff Schiller
Modified: 2013-08-25 08:25 PDT (History)
20 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
screenshot of FF dialogue (14.55 KB, image/png)
2005-11-16 06:15 PST, Jonathan Watt [:jwatt]
no flags Details
jwatt's mimeTypes.rdf (17.12 KB, text/plain)
2005-11-16 15:12 PST, Jonathan Watt [:jwatt]
no flags Details
jwatt's download actions dialogue (25.79 KB, image/png)
2005-11-18 14:51 PST, Jonathan Watt [:jwatt]
no flags Details
jwatt's download actions dialogue - empty for step 2 in comment 3 (16.19 KB, image/png)
2005-11-22 02:20 PST, Jonathan Watt [:jwatt]
no flags Details
patch (1.76 KB, patch)
2013-08-22 02:58 PDT, Robert Longson
jst: review+
Details | Diff | Splinter Review

Description Jeff Schiller 2005-08-05 08:54:41 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050728 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b4) Gecko/20050728 Firefox/1.0+

Up until yesterday I was able to open local SVG files in Mozilla Deer Park.  To
my mind I have not changed anything but today I am not able to open up local SVG
files.  I get the "Open or Save File" dialog.  

So, instead of "saving" I thought I'd be clever and click "Open" then chose the
firefox.exe file to handle the content, then checked the "Always use this
action".  When I did this and tried to browse to a local SVG file, it opened a
new tab which opened a new tab which opened a new tab which  ... you get the
idea - a chain reaction of tabs opening.

I had to quickly close all the opening tabs, go into Tools > Options and remove
the "SVG File Type" from the "View & Edit Actions" window.  After doing this, I
could bring up a local SVG file without a problem.

NOTE That none of this hindered my ability to display SVG files online.  This
only seems to be a problem with local SVG files.  There may be two problems
here, the issue of Fx occasionally forgetting what to do with local SVG files
and the ability for a user to have a chain reaction of tabs opening if they
choose firefox.exe to handle the content.

Reproducible: Sometimes

Steps to Reproduce:
1.
2.
3.
Comment 1 Adam Guthrie 2005-08-05 16:42:09 PDT
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8b4) Gecko/20050805 Firefox/1.0+
ID:2005080513

Works for me.
Comment 2 JP Fiset 2005-08-15 10:21:03 PDT
I have downloaded the latest Firefox nightly build (15 Aug 2005) for
Windows, and I am continuing to see a nagging problem that I discovered
with Deer Park 2.

I have no problem viewing SVG files from the network when the proper
MIME type is set. However, when trying to view a local file with .svg
extension, Deer Park keeps offering a dialog box where the file can be
saved. It claims that it is a "SVG Document", but refuses to handle
it itself.

The same happens if I create a HTML file which contains an <object> or
<embed> tag that specifies "image/svg+xml".

I have verified that the native rendering is enabled via about:config
(network files work fine). It just seems to not recognize the MIME
type of the local file. It basically reacts the same as if a file was
sent down the network with the wrong MIME type.

Anyone knows how does Firefox associate a MIME type for a local file? That might
help understanding the mechanics of this bug.
Comment 3 JP Fiset 2005-08-15 10:31:59 PDT
Here is a work around this problem, as offered by the original poster, but with
a change to avoid endless loop of opening tabs:

1. When opening a local SVG file and the "Save As" dialog comes up, select "Open
With" and then select any .exe (does not matter which one, except do not use
firefox.exe to avoid an endless loop). Also, select "Always open this type..."
check box.

2. Go to Tools > Options... > Downloads > View & Edit Actions...  and
remove the file association for SVG (it bogus, evidently)

3. Load local SVG document. It should be rendered correctly by the native renderer.
Comment 4 Matt 2005-10-05 16:01:18 PDT
Just adding this in case it helps anyone else...

I thought I was hitting this bug with Firefox Beta1 - I kept getting the Save-As
dialog with SVG.  However, it turned out that with Windows versions prior to
WinXP you need to install a renderer to view SVG files. Details are at
http://www.mozilla.org/projects/svg/build.html - see the box titled "MS Windows".

Briefly you should probably install GDI+: download from
http://www.microsoft.com/downloads/details.aspx?FamilyId=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&displaylang=en
keep un-zipping until you get the dll and then save the dll in the directory
where you installed Firefox.

I hear rumours that (if all goes to plan) you won't need to do this for much
longer and the Cairo renderer will be supplied with Firefox.
Comment 5 Jeff Schiller 2005-10-05 18:21:31 PDT
Yes, the GDI+ installation issue is something separate from this problem.  I
have been able to successfully view SVG content using the Firefox browser, this
issue only crops up with local SVG files.
Comment 6 Jo Hermans 2005-11-03 02:31:21 PST
*** Bug 314885 has been marked as a duplicate of this bug. ***
Comment 7 Boris Zbarsky [:bz] (still a bit busy) 2005-11-15 20:14:10 PST
I doubt this is an SVG bug.  What do the file associations look like for people seeing this issue?
Comment 8 Jonathan Watt [:jwatt] 2005-11-16 04:00:01 PST
I've now experienced this too. The problem appeared after I installed Adobe Photoshop Elements 1.0.1 and decided to allow it to install the ancient Adobe SVG viewer that's bundled with it (ASV v1.0, build 94). This set up file associations for SVG.

In Windows Explorer I went to the Tools menu and selected Folder Options > File Types. Entries already existed for both SVG and SVGZ due to another application I have, but on selecting either and clicking on "Advanced" I found the entries called "open" in the "Actions:" box had been changed. Selecting the action "open" and clicking on "Edit..." showed the form was filled out as follows:

----------------------------------
Application used to perform action:
"C:\Program Files\Internet Explorer\iexplore.exe" -nohome

Use DDE <checked>

DDE Message:
"file:%1",,-1,,,,,

Application:
IExplore

DDE Application Not Running:
<blank>

Topic:
WWW_OpenURL
----------------------------------

I deleted the "open" entries, restarted Firefox and hoped everything would be back to normal since that left the file associations as they were before I installed Elements. It wasn't. I still get the "What should Firefox do with this file?" dialogue. I guess I could fix the problem using the steps in comment 3 but I'll wait a bit in case anyone can think up any experements to conduct while FF is horked.
Comment 9 Jonathan Watt [:jwatt] 2005-11-16 04:30:35 PST
I seem to have two entries in the registry that may be relevant.

HKEY_CLASSES_ROOT\.svgz
  (Default)     REG_SZ  Adobe.SVGCtl
  Content Type  REG_SZ  image/svg-xml

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.svgz
  (Default)     REG_SZ  Adobe.SVGCtl
  Content Type  REG_SZ  image/svg-xml

Note image/svg-xml is the old MIME, type so these are almost certainly from the old version of ASV. (It should now be image/svg+xml.) I don't know what the Adobe.SVGCtl is thought.
Comment 10 Boris Zbarsky [:bz] (still a bit busy) 2005-11-16 06:06:30 PST
So when you get this dialog, what MIME type is listed in it?  Or does Firefox kindly neglect to list MIME types in dialogs?  If so, what happens in a Seamonkey build?
Comment 11 Jonathan Watt [:jwatt] 2005-11-16 06:15:30 PST
Created attachment 203257 [details]
screenshot of FF dialogue
Comment 12 Boris Zbarsky [:bz] (still a bit busy) 2005-11-16 06:20:49 PST
Yeah, totally not useful.  Please try Seamonkey.

Or do NSPR_LOG_MODULES=HelperAppService:5 and attach the log here (or just read it yourself).
Comment 13 Jonathan Watt [:jwatt] 2005-11-16 09:15:59 PST
My home spun builds and SeaMonkey install (just installed using the Windows installer) aren't affected. They can all open local SVG files just fine. That seems strange since the problem started for me when I installed Elements back while using Deer Park. I thought that the upgrades to the betas and more recently the release candidates (using the Windows installers) would have fixed things, but they didn't. I'll try with NSPR_LOG_MODULES=HelperAppService:5 in RC2 in a bit.
Comment 14 Jonathan Watt [:jwatt] 2005-11-16 09:38:37 PST
0[272ff8]: Found extension 'svg' (filename is 'svg.svg', handling attachment: 0)

0[272ff8]: HelperAppService::DoContent: mime 'image/svg-xml', extension 'svg'
0[272ff8]: Getting mimeinfo from type 'image/svg-xml' ext 'svg'
0[272ff8]: Windows mime database: extension '.'
0[272ff8]: Extension lookup on '.' found: 0x1c8a0a0
0[272ff8]: OS gave back 0x1c8a0a0 - found: 1
0[272ff8]: Data source: Via type: retval 0x00000000
0[272ff8]: Extension 'svg' matches mime info: 1
0[272ff8]: MIME Info Summary: Type 'image/svg-xml', Primary Ext 'svg'
0[272ff8]: Type/Ext lookup found 0x1c8a0a0
0[272ff8]: Getting mimeinfo from type 'image/svg-xml' ext ''
0[272ff8]: Windows mime database: extension '.'
0[272ff8]: Extension lookup on '.' found: 0x261d7f0
0[272ff8]: OS gave back 0x261d7f0 - found: 1
0[272ff8]: Data source: Via type: retval 0x00000000
0[272ff8]: MIME Info Summary: Type 'image/svg-xml', Primary Ext 'svg'
Comment 15 Jonathan Watt [:jwatt] 2005-11-16 09:52:17 PST
That's after changing image/svg-xml to image/svg+xml in the registry entries I mentioned in comment 9. I see that there are still two occurances of image/svg-xml in the registry:

HKEY_CLASSES_ROOT\MIME\DataBase\Content Type\image/svg-xml
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\Content Type\image/svg-xml
Comment 16 Jonathan Watt [:jwatt] 2005-11-16 10:28:55 PST
Using my home spun branch builds (the ones that happily render local SVG) all I get is:

0[3e56d0]: Windows mime database: extension ''
0[3e56d0]: 4.x Registry: extension ''
0[3e56d0]: Extension lookup on '' found: 0x0
0[3e56d0]: Ext. lookup for 'svg' found 0x327ac70
Comment 17 Boris Zbarsky [:bz] (still a bit busy) 2005-11-16 11:42:35 PST
Hmm.  Could you attach the full log from the failing build?
Comment 18 Jonathan Watt [:jwatt] 2005-11-16 14:10:28 PST
comment 14 was all there was. The failing build is FF1.5 RC2 installed from the official win32 installer.
Comment 19 Boris Zbarsky [:bz] (still a bit busy) 2005-11-16 14:43:06 PST
> comment 14 was all there was.

Hmm.  We already have a MIME type by the time DoContent is being called there, and the only way a file channel can come up with a type is by calling GetTypeFromFile, which GetTypeFromExtension, which checks mimeTypes.rdf and if it finds nothing in it calls nsOSHelperAppService::GetMIMEInfoFromOS (which logs).

So sounds like you have that bogus MIME type in your mimeTypes.rdf at this point.  Do you?
Comment 20 Jonathan Watt [:jwatt] 2005-11-16 15:12:40 PST
Created attachment 203313 [details]
jwatt's mimeTypes.rdf

Indeed, the thing's absolutely riddled with image/svg-xml! I already did a search for that string in files in that profile using Windows built in search. Piece of junk turned up no results and I believed it.
Comment 21 Jonathan Watt [:jwatt] 2005-11-16 15:18:02 PST
Question is, how did it get there. Installing ASV 1.0 shouldn't cause that. And how can we stop this happening to other people?
Comment 22 Boris Zbarsky [:bz] (still a bit busy) 2005-11-16 15:33:14 PST
It got there if Firefox added it; you'll have to look at the helper app UI code (the helper app dialog in particular) to see why and where that happened.  I bet it adds an entry any time it comes up and you pick some action (so that it can preselect that action next time?).  So the first time we got bad info from the OS we stashed it in mimeTypes.rdf, and after that mimeTypes.rdf overrides the OS.
Comment 23 Jonathan Watt [:jwatt] 2005-11-16 16:29:22 PST
But why would FF suddenly decide it needs the helper app after happily opening SVG files prior to installing ASV 1.0? Prior to that I had installed ASV 3 and that didn't cause any problems.
Comment 24 Boris Zbarsky [:bz] (still a bit busy) 2005-11-16 21:19:50 PST
If there is no OS type association for the extension, we'll use our built-in fallback one, which has the right type...  

For ASV 3, it probably set the right association, so we used that.
Comment 25 Jonathan Watt [:jwatt] 2005-11-18 12:09:17 PST
Could this also be the reason for SVG not showing for me when it's embedded using <embed> without a 'type' attribute? (The embedded SVG shows fine when viewed standalone.) That would mean we look to the OS for MIME information rather than the HTTP headers sent with the <embed>ded file.
Comment 26 Boris Zbarsky [:bz] (still a bit busy) 2005-11-18 12:11:26 PST
> That would mean we look to the OS for MIME information rather than the HTTP
> headers sent with the <embed>ded file.

For the 1.8 branch, that is exactly what we do.  On trunk we look at the headers.
Comment 27 Jonathan Watt [:jwatt] 2005-11-18 12:17:45 PST
Suddenly everything becomes clear. This probably explains most, if not all, of the mystery "I can't see SVG" posts to the mozillazine forums. Thanks bz!
Comment 28 Boris Zbarsky [:bz] (still a bit busy) 2005-11-18 12:21:22 PST
No problem.

Sounds like the fix is to fix the OS associations and then go into Firefox helper app prefs and fix the associations there too...
Comment 29 Jonathan Watt [:jwatt] 2005-11-18 12:48:07 PST
Hmm, maybe we need a doc for that. I'm not sure about the details of either step though. Is there any reason not to just keep pointing people to the steps in comment 3? They seem to work.

BTW, the whole SVG test suite uses <embed> without a 'type' attribute, so any bugs or complaints that Moz doesn't render any of the test suite are probably dups of this bug.
Comment 30 Boris Zbarsky [:bz] (still a bit busy) 2005-11-18 14:27:09 PST
The steps in comment 3 won't work if the OS association is still broken, will they?  Item 2 of comment 3 is the way to "go into Firefox helper app prefs and fix the associations there too" from comment 28, for what it's worth.
Comment 31 Jonathan Watt [:jwatt] 2005-11-18 14:51:21 PST
Created attachment 203572 [details]
jwatt's download actions dialogue

Those three steps always seem to fix the problem, without any need to mess with the OS file type associations. Also no file association exists for SVG in the dialogue from step 2 (see the attachment), so there's nothing to delete unless you've done step 1.
Comment 32 Boris Zbarsky [:bz] (still a bit busy) 2005-11-18 15:13:20 PST
Er... so your mimeTypes.rdf has entries but they don't show up in the "download actions" thing?  File bugs on Ben as needed if so.  ;)
Comment 33 Jonathan Watt [:jwatt] 2005-11-22 02:20:14 PST
Created attachment 203909 [details]
jwatt's download actions dialogue - empty for step 2 in comment 3

Hmm, okay I take it back. Those three steps seem to work for everyone...except me. Carrying out step 2 I get a list of exactly zero filename extensions, and the following error in the JavaScript console.

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsILocalFileWin.getVersionInfoField]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://browser/content/preferences/downloadactions.js :: anonymous :: line 251"  data: no]
Comment 34 Boris Zbarsky [:bz] (still a bit busy) 2005-11-22 07:03:39 PST
Hey, if there are issues with the Firefox UI, please file Firefox bugs.  All the helper apps stuff got forked enough in Firefox that I have no idea how the UI works anymore, nor do I really care...
Comment 35 Kees Grinwis 2005-11-23 13:20:27 PST
I did try to do the steps in comment 3 and also have an empty dialog as is shown in https://bugzilla.mozilla.org/attachment.cgi?id=203909

So i cannot remove the link from SVG to the application I've choosen (is there a way to update this link manually - I cannot find any reference in the mime.rdf file nor in other files; what file/reg entry is used to store these settings?)


So Jonathan Watt isn't the only one having difficulties. As far i can remember i'd try to execute those steps when using Firefox 1.5 RC1.

Maybe it is interesting to note that I have both Firefox 1.07 (default browser) and Firefox 1.5 installed.
Comment 36 Boris Zbarsky [:bz] (still a bit busy) 2005-11-23 14:10:15 PST
> what file/reg entry is used to store these settings?

The Gecko settings are in mimeTypes.rdf in the profile.

The OS settings are in various places in the registry; see nsOSHelperAppService.cpp (the Windows version) to see where we look.
Comment 37 simon 2005-12-12 09:19:13 PST
i have had what seems to be basically the same thing ever since the first cairo build, ff1.5b1.

file assocations with svg or ANY plugins all stopped functioning for files from this build, on older builds everything is good, ( on the same machine at the same time.), BUT embeds still work, its only files that need to be recongised from the extension, local or web where the server doesn't set the type in the header.

same plugins with IE on same machine with same files, no problem.

found that the remove action button was not available on my plugins, tried comment 3 fix, managed to get remove action button to come on, removed it and reassociated with plugin, but now get infinite series of loads, all to the same tab, so just sits there with the title flipping between untitled and loading? removed the new association, all that happened is the remove action button becomes unavailable, assocation still shown, and i'm back to where i started!
Comment 38 Jonathan Watt [:jwatt] 2006-05-05 04:14:39 PDT
(In reply to comment #32)
> Er... so your mimeTypes.rdf has entries but they don't show up in the "download
> actions" thing?  File bugs on Ben as needed if so.  ;)

They don't show in the "download actions" dialogue if NC:alwaysAsk="true"
Comment 39 jdalbec 2006-08-06 19:41:20 PDT
http://www.mozilla.org/projects/svg/faq.html should have a link to this bug.
Comment 40 Robert Longson 2007-10-27 09:36:06 PDT
*** Bug 368009 has been marked as a duplicate of this bug. ***
Comment 41 Smokey Ardisson (offline for a while; not following bugs - do not email) 2007-11-28 14:17:23 PST
I'm a little unclear where this bug is right now; is it just about Windows, or a general bug for all OSes?
Comment 42 Terrell Kelley 2011-10-11 12:18:18 PDT
I have run into the same symptoms on Firefox 7.0.1 on Windows XP: Firefox would offer to download local .svg files. I found the svg fextension listed under a MIME type of application/x-octetstream in mimetype.rdf. Deleting that entry fixed the problem.
Comment 43 Robert Longson 2013-08-22 01:18:27 PDT
*** Bug 908069 has been marked as a duplicate of this bug. ***
Comment 44 Sebastian Zartner [:sebo] 2013-08-22 02:23:22 PDT
Note that this is a big problem in Firebug 1.12. In that version most of the icons used inside Firebug were replaced by SVG equivalents and now aren't displayed anymore for some users.[1][2][3]

See bug 908069 for more info and a test case.

Sebastian

[1] https://groups.google.com/forum/#!topic/firebug/KFC_jij_F6k
[2] https://groups.google.com/forum/#!topic/firebug/zh3YAcAJWZw
[3] http://code.google.com/p/fbug/issues/detail?id=5746
Comment 45 Robert Longson 2013-08-22 02:58:37 PDT
Created attachment 793933 [details] [diff] [review]
patch

Does this patch fix it?
Comment 46 Sebastian Zartner [:sebo] 2013-08-22 22:32:46 PDT
Never created a Firefox build by my own, so I first need to see how to do that.
Honza, if you want to you can also check that and give feedback.

Sebastian
Comment 47 Simon Lindholm 2013-08-23 03:19:09 PDT
Could we perhaps get a (Win32) try build?
Comment 48 Robert Longson 2013-08-23 07:34:15 PDT
Seems OK when I tested it. If you want to play along at home...

Once completed, builds and logs will be available at:
http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/longsonr@gmail.com-59a9197f3000
Comment 49 Robert Longson 2013-08-23 07:35:08 PDT
To see progress: https://tbpl.mozilla.org/?tree=Try&rev=59a9197f3000
Comment 50 Sebastian Zartner [:sebo] 2013-08-23 17:44:38 PDT
I could finally compile a patched version and can confirm that it's working.

Sebastian

Note You need to log in before you can comment on or make changes to this bug.