changeset 22218:f47b601edbc6

Truffle/Source: add the ".js" and ".JS" extensions to the hard-wired getMimeType() implementations
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 15 Sep 2015 16:41:09 -0700
parents 7c8c03389f0f
children 1c0f490984d5
files truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java	Tue Sep 15 14:49:24 2015 -0700
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java	Tue Sep 15 16:41:09 2015 -0700
@@ -409,7 +409,7 @@
 
     /**
      * The URL if the source is retrieved via URL.
-     * 
+     *
      * @return URL or <code>null</code>
      */
     public abstract URL getURL();
@@ -893,6 +893,8 @@
                 return "text/x-c";
             } else if (file.getName().endsWith(".R") || file.getName().endsWith(".r")) {
                 return "application/x-r";
+            } else if (file.getName().endsWith(".js") || file.getName().endsWith(".JS")) {
+                return "application/javascript";
             } else {
                 try {
                     return Files.probeContentType(file.toPath());
@@ -981,6 +983,8 @@
                 return "text/x-c";
             } else if (file.getName().endsWith(".R") || file.getName().endsWith(".r")) {
                 return "application/x-r";
+            } else if (file.getName().endsWith(".js") || file.getName().endsWith(".JS")) {
+                return "application/javascript";
             } else {
                 try {
                     return Files.probeContentType(file.toPath());