Bug 892100 - Script actor's source loading error reporting broken; r=past
authorNick Fitzgerald <fitzgen@gmail.com>
Thu, 11 Jul 2013 10:56:23 -0700
changeset 138369 954a86d88d253eb15f3975c9b7de34947ef4e156
parent 138368 817ceeb741b4bb7e156e04d3f3fed02f02ff5106
child 138370 042542ff6ec131f79b8995a87d8fa355917ddfcc
push id30945
push userryanvm@gmail.com
push dateFri, 12 Jul 2013 19:51:45 +0000
treeherdermozilla-inbound@35fca0404633 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs892100
milestone25.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 892100 - Script actor's source loading error reporting broken; r=past
toolkit/devtools/server/actors/script.js
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -2844,26 +2844,26 @@ function fetch(aURL, aOptions={ loadFrom
 
   switch (scheme) {
     case "file":
     case "chrome":
     case "resource":
       try {
         NetUtil.asyncFetch(url, function onFetch(aStream, aStatus) {
           if (!Components.isSuccessCode(aStatus)) {
-            deferred.reject("Request failed: " + url);
+            deferred.reject(new Error("Request failed: " + url));
             return;
           }
 
           let source = NetUtil.readInputStreamToString(aStream, aStream.available());
           deferred.resolve(source);
           aStream.close();
         });
       } catch (ex) {
-        deferred.reject("Request failed: " + url);
+        deferred.reject(new Error("Request failed: " + url));
       }
       break;
 
     default:
       let channel;
       try {
         channel = Services.io.newChannel(url, null, null);
       } catch (e if e.name == "NS_ERROR_UNKNOWN_PROTOCOL") {
@@ -2871,25 +2871,25 @@ function fetch(aURL, aOptions={ loadFrom
         // newChannel won't be able to handle it.
         url = "file:///" + url;
         channel = Services.io.newChannel(url, null, null);
       }
       let chunks = [];
       let streamListener = {
         onStartRequest: function(aRequest, aContext, aStatusCode) {
           if (!Components.isSuccessCode(aStatusCode)) {
-            deferred.reject("Request failed: " + url);
+            deferred.reject(new Error("Request failed: " + url));
           }
         },
         onDataAvailable: function(aRequest, aContext, aStream, aOffset, aCount) {
           chunks.push(NetUtil.readInputStreamToString(aStream, aCount));
         },
         onStopRequest: function(aRequest, aContext, aStatusCode) {
           if (!Components.isSuccessCode(aStatusCode)) {
-            deferred.reject("Request failed: " + url);
+            deferred.reject(new Error("Request failed: " + url));
             return;
           }
 
           charset = channel.contentCharset;
           deferred.resolve(chunks.join(""));
         }
       };
 
@@ -2929,12 +2929,13 @@ function convertToUnicode(aString, aChar
  * Report the given error in the error console and to stdout.
  *
  * @param Error aError
  *        The error object you wish to report.
  * @param String aPrefix
  *        An optional prefix for the reported error message.
  */
 function reportError(aError, aPrefix="") {
+  dbg_assert(aError instanceof Error, "Must pass Error objects to reportError");
   let msg = aPrefix + aError.message + ":\n" + aError.stack;
   Cu.reportError(msg);
   dumpn(msg);
 }