Bug 73648

Summary: JavaScript and CSS are not subclasses of text/x-csrc
Product: shared-mime-info Reporter: Gordon P. Hemsley <gphemsley>
Component: freedesktop.org.xmlAssignee: Shared Mime Info group <shared_mime_info>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: JavaScript and CSS are not subclasses of text/x-csrc. Add test files for CSS.

Description Gordon P. Hemsley 2014-01-15 06:11:51 UTC
Created attachment 92113 [details] [review]
JavaScript and CSS are not subclasses of text/x-csrc. Add test files for CSS.

JavaScript is derived from ECMAScript, not C source.
And CSS has no real relation to C source at all.

This patch changes the <sub-class-of> values of application/javascript and text/css to reflect their true parent class.

This also adds two CSS test files (the recommended stylesheets for HTML 4 and an old iteration of HTML5) for increased test coverage.

(I wasn't able to find an ECMAScript sample that wasn't reliably uncontaminated by JavaScript extensions, so that hole in the test coverage remains.)
Comment 1 Bastien Nocera 2014-01-15 13:20:38 UTC
There's a good reason why they are subclasses:

commit 15582fdf30c4dc6585d66f977d98cc92c4144c00
Author: Bastien Nocera <hadess@hadess.net>
Date:   Mon Feb 9 15:06:49 2009 +0000

    * freedesktop.org.xml.in: Patch from Robert DaSilva
    <spunit262@Yahoo.com> to make Javascript a sub-class of C sources
    so as to avoid misdetection
    * tests/list:
    * tests/survey.js: Add test-case from the bug above

Did you check that your patch didn't break the test suite?
Comment 2 Gordon P. Hemsley 2014-01-15 15:06:43 UTC
(In reply to comment #1)
> There's a good reason why they are subclasses:
> 
> commit 15582fdf30c4dc6585d66f977d98cc92c4144c00
> Author: Bastien Nocera <hadess@hadess.net>
> Date:   Mon Feb 9 15:06:49 2009 +0000
> 
>     * freedesktop.org.xml.in: Patch from Robert DaSilva
>     <spunit262@Yahoo.com> to make Javascript a sub-class of C sources
>     so as to avoid misdetection
>     * tests/list:
>     * tests/survey.js: Add test-case from the bug above

It's not clear to me where the misdetection was occurring—on the C side or the JavaScript side? Either way, this doesn't revert that change directly; it changes JavaScript to be a subclass of application/ecmascript (which it is), not text/plain (which it was listed as before being changed to text/x-csrc, which it isn't).

> Did you check that your patch didn't break the test suite?

0 errors, 867 comparisons, 141 failed (141 expected)
Comment 3 Bastien Nocera 2014-04-01 13:25:05 UTC
commit 1c302e1cf2db02c4262bcb6501b337a2c9ea09fd
Author: Gordon P. Hemsley <me@gphemsley.org>
Date:   Wed Jan 15 00:56:55 2014 -0500

    JavaScript and CSS are not subclasses of text/x-csrc
    
    and add test files for CSS.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=73648

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.