Bug 5029

Summary: Assertion failure in -[NSPasteboard(WebExtras) _web_writeImage:URL:title:archive:types:] when trying to drag an image from a site with no favicon
Product: WebKit Reporter: mitz
Component: WebKit Misc.Assignee: Vicki Murley <vicki>
Status: VERIFIED FIXED    
Severity: Normal    
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
URL: http://forever.dreamers.com/hp/cos/gargamel.gif
Attachments:
Description Flags
Prefer the main resource if it is an image mjs: review+

mitz
Reported 2005-09-17 15:03:53 PDT
Development build of WebKit crashes with the message ASSERTION FAILED: [[[WebImageRendererFactory sharedFactory] supportedMIMETypes] containsObject: [resource MIMEType]] (WebKit/Misc.subproj/WebNSPasteboardExtras.m:245 -[NSPasteboard(WebExtras) _web_writeImage:URL:title:archive:types:]) when opening the image in the URL in Safari and then trying to drag it out of the window. This happens whenever the site hosting the image has sent text/html content (e.g. a 404 page) as its / favicon.ico.
Attachments
Prefer the main resource if it is an image (1.58 KB, patch)
2005-10-12 06:25 PDT, mitz
mjs: review+
Alexey Proskuryakov
Comment 1 2005-09-18 01:58:51 PDT
I cannot reproduce the assertion with ToT. However, I have seen this assertion previously with a site that used 302 Found redirection and lied about content type. Perhaps, one needs to navigate to this picture through the site in order to reproduce the problem?
mitz
Comment 2 2005-09-18 08:06:06 PDT
(In reply to comment #1) > Perhaps, one needs to navigate to this picture through the site in order to reproduce the > problem? My experience is that you can go straight to the picture as well. You should not drag immediately, though, but rather wait a couple of seconds to let WebKit fetch the favicon (you can use tcpdump or something to see when it's done so).
mitz
Comment 3 2005-10-12 05:28:57 PDT
It's not just the assert that fails, you end up with the wrong resource if you're dragging into a TextEdit document. Instead of the image, you get a Safari HTML file icon. The root cause is that the favicon is added as a subresource to the image if it happens not to be loaded by the image (i.e. if it is not already in the cache), so the situation with valid favicons is no different. Even though the assertion doesn't fail, if you drag such an image from Safari into a TextEdit document, you end up with the favicon instead of the image.
mitz
Comment 4 2005-10-12 05:31:17 PDT
s/happens not/happens
mitz
Comment 5 2005-10-12 06:25:44 PDT
Created attachment 4324 [details] Prefer the main resource if it is an image This is an ugly fix that doesn't address the root cause, which is that the icon loader adds the favicon as a subresource. However, I see no easy way to change that behavior or to reject it in addSubResource.
Maciej Stachowiak
Comment 6 2005-10-14 00:30:35 PDT
Comment on attachment 4324 [details] Prefer the main resource if it is an image r=me
Vicki Murley
Comment 7 2005-10-14 13:28:05 PDT
I committed this change.
Note You need to log in before you can comment on or make changes to this bug.