diff truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java @ 22219:1c0f490984d5

Merge with f47b601edbc626dcfe8b3636933b4834c89f7779
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Wed, 16 Sep 2015 15:36:22 -0700
parents dc83cc1f94f2 f47b601edbc6
children b56fe0d3b560
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java	Wed Sep 16 12:27:08 2015 +0200
+++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java	Wed Sep 16 15:36:22 2015 -0700
@@ -24,8 +24,6 @@
  */
 package com.oracle.truffle.api.source;
 
-import com.oracle.truffle.api.CompilerAsserts;
-import com.oracle.truffle.api.TruffleLanguage.Registration;
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.File;
@@ -54,6 +52,9 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import com.oracle.truffle.api.CompilerAsserts;
+import com.oracle.truffle.api.TruffleLanguage.Registration;
+
 /**
  * Representation of a guest language source code unit and its contents. Sources originate in
  * several ways:
@@ -425,7 +426,7 @@
 
     /**
      * The URL if the source is retrieved via URL.
-     * 
+     *
      * @return URL or <code>null</code>
      */
     public abstract URL getURL();
@@ -909,6 +910,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());
@@ -997,6 +1000,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());