From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 30 15:47:22 2012 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 95E5C106564A for ; Mon, 30 Apr 2012 15:47:22 +0000 (UTC) (envelope-from evanm@google.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2EC2E8FC0A for ; Mon, 30 Apr 2012 15:47:22 +0000 (UTC) Received: by yenl9 with SMTP id l9so1657886yen.13 for ; Mon, 30 Apr 2012 08:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-system-of-record; bh=Uf0zfmiul03oHBR0eAoUEyljZWQWku9UsWf1hQrR4bo=; b=h5KdAFY5IPtJEulAe5jgxrhLXv4mdjemxKBRvsa6H6QS3BQiJcaiXYx2hhum3yyeS5 jOOCplq8XfFlMs9vGAu3DyK2AftPqoIidQXrU3jR6T5zX+cROANf7YL6ZJnGCcOZ/2EA FCzXggYReFjdMLWMLr9p+o1kiTXTIXbSbQpLbcKpY4esQlUwn1J8C8DpDPytaL4PTK7N BaiMjJmIOF/3vdSnz/bWF2Ppz5xdpOA0j5XcOfM7Q8fJNFTexe9PkinENbmnqWVC+eYj 3ruz4rYcSkusIe/ZH9S0kW4IpcRWQyOMMvMDJxfLAzhrJQAVg8rPj6uss/zfSjVYqOB0 s9mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding:x-system-of-record:x-gm-message-state; bh=Uf0zfmiul03oHBR0eAoUEyljZWQWku9UsWf1hQrR4bo=; b=bQCQTJYAYkaokZXvNaPKSOBdQU6wuI4MVG8Cvn6KUdCJXVLDmj9C9q/AXt+Vi1eJ/H SC6zwW4bCWh0i9nRv5ZAp+A7R0WzCq8nmOY1P7RRD63FRGA+TF0UEm920Z3uLEUYJ9gr Wmz1wKl9hkyZIFTHf2jyXy9BZB/4AiRWYrL5Jartl4eXkI+1gvlbXZPQtweD+tQRrx+u MJ0dMA99s+LyDivlPw6vbf6Bo6sMTF0gTIHw5TxOep5/UqBNNahYKsrmIs2xgomexGns TJcEhfsXGYNXeeAk6EG5+R6+a1jVCCEAUBqJUioOl2ZWVRQyeiBpjyN2dPpoL0dn1mqT uufA== Received: by 10.236.78.70 with SMTP id f46mr22309142yhe.99.1335800841394; Mon, 30 Apr 2012 08:47:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.236.78.70 with SMTP id f46mr22309126yhe.99.1335800841276; Mon, 30 Apr 2012 08:47:21 -0700 (PDT) Sender: evanm@google.com Received: by 10.101.156.21 with HTTP; Mon, 30 Apr 2012 08:47:21 -0700 (PDT) In-Reply-To: <20120428144745.GA40844@onelab2.iet.unipi.it> References: <20120428144745.GA40844@onelab2.iet.unipi.it> Date: Mon, 30 Apr 2012 08:47:21 -0700 X-Google-Sender-Auth: vRdajpDd6hFBFODYfDitrja6oWM Message-ID: From: Evan Martin To: Luigi Rizzo Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-Gm-Message-State: ALoCoQkzyXTdEYAeqmvWOay7VkcrMnESB5mWPgS3gVr7y5S6GoLYdd2jlqM9VFoC2GsbjcMfCsHyyTk0TneV3vIsyAh9YftG2E/mO+Mh++IC/llmfuxzSB6Io1Zoq1eOevZitypIcmqAgKCOfFeARqb7gQHpH1TGwg== X-Mailman-Approved-At: Mon, 30 Apr 2012 15:53:33 +0000 Cc: chromium@freebsd.org, hackers@freebsd.org Subject: Re: how to display C sources in Chromium (file:/// only) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2012 15:47:22 -0000 On Sat, Apr 28, 2012 at 7:47 AM, Luigi Rizzo 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.