Date: Mon, 30 Apr 2012 08:47:21 -0700 From: Evan Martin <evan@chromium.org> To: Luigi Rizzo <rizzo@iet.unipi.it> Cc: chromium@freebsd.org, hackers@freebsd.org Subject: Re: how to display C sources in Chromium (file:/// only) Message-ID: <CAFzwtj3TDpxHs93dc0PGM-JcxFPNL%2B2kUtsfcZDi-AhqZBS2hQ@mail.gmail.com> In-Reply-To: <20120428144745.GA40844@onelab2.iet.unipi.it> References: <20120428144745.GA40844@onelab2.iet.unipi.it>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Apr 28, 2012 at 7:47 AM, Luigi Rizzo <rizzo@iet.unipi.it> wrote: > (hoping this is of interest for hackers- too) > > One of the most annoying features of chromium is that it downloads > instead of displaying various types of files (.c, .h and so on). This has long annoyed me too! > it seems that a partial fix can be achieved by arring the list of > types we want to display to the array > > =A0 =A0static const char* const supported_non_image_types[] =3D { > =A0 =A0 =A0 =A0... > + =A0 =A0 =A0 "text/x-csrc", > + =A0 =A0 =A0 "text/x-chdr", > =A0 =A0 =A0 =A0... > =A0 =A0} There's a comment at the end of the block: // Note: ADDING a new type here will probably render it AS HTML. This can // result in cross site scripting. I wonder how to tell? If you follow the references back from the definition of this variable it appears to end up used here: http://code.google.com/searchframe#OAMlx_jo-ck/src/third_party/WebKit/Sourc= e/WebCore/loader/FrameLoader.cpp&exact_package=3Dchromium&ct=3Drc&cd=3D10&q= =3DIsSupportedNonImageMimeType&l=3D859 which just indicates it's used when WebKit is deciding whether to inline the content or not. It seems to me like you could adjust the code in MimeUtil::IsSupportedNonImageMimeType to always return true for any text/* mime type.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFzwtj3TDpxHs93dc0PGM-JcxFPNL%2B2kUtsfcZDi-AhqZBS2hQ>