Bug 1258892 - Cannot inspect imported scripts in worker. r=ejpbruel
authorJason Laster <jlaster@mozilla.com>
Wed, 13 Apr 2016 09:18:00 +0200
changeset 331040 15d2b8a78f3bc025cbc107d49777c5817fe1ecd5
parent 331039 7ea05f1a9b989319dc4a7a963d907f38afb829f4
child 331041 387bd412040f3e2601880cea09681a8717271e1b
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersejpbruel
bugs1258892
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1258892 - Cannot inspect imported scripts in worker. r=ejpbruel
devtools/server/actors/utils/TabSources.js
--- a/devtools/server/actors/utils/TabSources.js
+++ b/devtools/server/actors/utils/TabSources.js
@@ -324,17 +324,23 @@ TabSources.prototype = {
               // it's an xml page.
               spec.isInlineSource = true;
             }
             else if (extension === "js") {
               spec.contentType = "text/javascript";
             }
           } catch (e) {
             // This only needs to be here because URL is not yet exposed to
-            // workers.
+            // workers. (BUG 1258892)
+            const filename = url;
+            const index = filename.lastIndexOf(".");
+            const extension = index >= 0 ? filename.slice(index + 1) : "";
+            if (extension === "js") {
+              spec.contentType = "text/javascript";
+            }
           }
         }
       }
       else {
         // Assume the content is javascript if there's no URL
         spec.contentType = "text/javascript";
       }
     }