Bug 75031 - *.jsm files should be part of mime application/javascript
Summary: *.jsm files should be part of mime application/javascript
Status: RESOLVED FIXED
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: freedesktop.org.xml (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Shared Mime Info group
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-15 18:54 UTC by Alexander Schlarb
Modified: 2014-04-01 12:16 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Alexander Schlarb 2014-02-15 18:54:53 UTC
The file extension .jsm is used by Mozilla on several ocations in for shared javascript modules and is also used when developing JetPack SDK addons.
Since there are no conflicting extension types and the extensions meaning is pretty self-explenatory (JavaScript Module) I believe it can and should be added as should be added ASAP to the database.

Just change:
  ...
  <mime-type type="application/javascript">
    <comment>JavaScript program</comment>
    ...
    <glob pattern="*.js"/>
  </mime-type>
  ...

to:
  ...
  <mime-type type="application/javascript">
    <comment>JavaScript program</comment>
    ...
    <glob pattern="*.js"/>
    <glob pattern="*.jsm"/>
  </mime-type>
  ...
Comment 1 Bastien Nocera 2014-03-31 14:56:29 UTC
Do you have a test file for that?
Comment 2 Alexander Schlarb 2014-03-31 21:32:55 UTC
What Mozilla says about (JavaScript) Code Modules:
  https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Using#The_URL_for_a_code_module (They don't put any emphasis on the *.jsm extension through)
Check out their code module overview through:
  https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules
If your are using Firefox also check out this URL:
  resource://gre/modules/

Seems to be a generally accepted by (at least some) addon developers as a way of keeping the distinction between module files and "executable" files:
  http://stackoverflow.com/questions/2591368/jsm-vs-js-files

However there is a conflict with the "JAWS Scripting Header" file extension (JAWS is popular screenreader software for Windows btw):
  http://www.freedomscientific.com/PDF/visionloss/manuals/ScriptManual/04-1_ScriptManagerFiles.htm

Here is what the extension trolls say:
  Some side with Firefox...
    http://www.filesuffix.com/en/extension/jsm
    http://www.filedesc.com/en/file/jsm
  Others with JAWS...
    http://www.registryfileextension.com/fileextension.php/JSM
    http://dotwhat.net/jsm/7210
  And one mentions both...
    http://jsm.fileextensionguide.com/
  This one says .jsm is Chrome specific???
    http://extensions.awdit.com/jsm/

I couldn't find any noticeable, non-Mozilla JavaScript use for *.jsm unfortunately...



The file format is 1:1 the same as plain JavaScript, however there is a high likelihood that the file will contain the word "EXPORTED_SYMBOLS" (Usually in the form of "var EXPORTED_SYMBOLS = ..." or "this.EXPORTED_SYMBOLS = ..."). However (with JavaScript being a text format) there is a high chance that this text will not be at the start of the document nor will it be at any other known offset (i.e.: magic detection will probably not work).

Here is your sample: http://pastebin.com/Qm8rjzse

Best regards,
Alexander Schlarb
Comment 3 Bastien Nocera 2014-04-01 12:16:32 UTC
commit a6d00cedc6eafe9af825f3f4267f27abfff65baa
Author: Bastien Nocera <hadess@hadess.net>
Date:   Tue Apr 1 10:11:32 2014 +0200

    Add *.jsm glob for Javascript
    
    As used in Gecko/Firefox related projects.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=75031


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.