Update nsFeedSniffer.cpp (Port part of Bug 589292 Add contentDisposition{Filename} properties to nsIChannel).

RESOLVED FIXED

Status

defect
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: philip.chee, Assigned: philip.chee)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

q.v. Core Bug 589292 Add contentDisposition{Filename} properties to nsIChannel.
Well it compiles and I don't get any errors when I run SeaMonkey but I'm not sure how to test this.
Attachment #563743 - Flags: review?(neil)
Comment on attachment 563743 [details] [diff] [review]
Patch v1.0 straight port.

>+  if (NS_SUCCEEDED(rv) && disp == nsIChannel::DISPOSITION_ATTACHMENT)
>+    return PR_TRUE;
> 
>   return PR_FALSE;
This can of course be improved upon. In fact, the whole function could be written in two lines of code should you so wish, although you would wrap them to four lines so it wouldn't really represent a saving.
Attachment #563743 - Flags: review?(neil) → review+
(In reply to Philip Chee from comment #1)
> I'm not sure how to test this.
You would need to have a server so that you could configure it to send either:
a) a feed with the correct content type (which just displays without sniffing)
b) a feed with a commonly misconfigured content type (which would get sniffed)
c) as b) but with content-disposition: attachment (which would get downloaded)
> This can of course be improved upon. In fact, the whole function could be written in
> two lines of code should you so wish, although you would wrap them to four lines so it
> wouldn't really represent a saving.
Hmm. Well if it ain't broke...

Pushed to comm-central:
http://hg.mozilla.org/comm-central/rev/3f0cb19942bc
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.