Bug 965362 - Do not assume that all of the contents of the HTTP channel will be available by the time we decide to read it synchronously in devtools tests. r=robcee, a=test-only
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 27 Mar 2014 11:20:16 -0400
changeset 183605 0e38a95ffbfeedfb54c3e666bbf417ffb0c188f8
parent 183604 13e065bdc8215376433a51e15eb3c0723c420331
child 183606 73f34f8b0b3aedd9e3fd59d2b18ab7a776ebc8ce
push id3419
push userryanvm@gmail.com
push dateWed, 02 Apr 2014 16:42:40 +0000
treeherdermozilla-beta@37ab641216bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobcee, test-only
bugs965362
milestone29.0
Bug 965362 - Do not assume that all of the contents of the HTTP channel will be available by the time we decide to read it synchronously in devtools tests. r=robcee, a=test-only
browser/devtools/sourceeditor/test/head.js
browser/devtools/styleeditor/test/browser_styleeditor_filesave.js
browser/devtools/styleeditor/test/browser_styleeditor_sourcemap_watching.js
--- a/browser/devtools/sourceeditor/test/head.js
+++ b/browser/devtools/sourceeditor/test/head.js
@@ -64,14 +64,17 @@ function limit(source, [line, ch]) {
 function read(url) {
   let scriptableStream = Cc["@mozilla.org/scriptableinputstream;1"]
     .getService(Ci.nsIScriptableInputStream);
 
   let channel = Services.io.newChannel(url, null, null);
   let input = channel.open();
   scriptableStream.init(input);
 
-  let data = scriptableStream.read(input.available());
+  let data = "";
+  while (input.available()) {
+    data = data.concat(scriptableStream.read(input.available()));
+  }
   scriptableStream.close();
   input.close();
 
   return data;
 }
--- a/browser/devtools/styleeditor/test/browser_styleeditor_filesave.js
+++ b/browser/devtools/styleeditor/test/browser_styleeditor_filesave.js
@@ -69,17 +69,20 @@ function read(aSrcChromeURL)
 {
   let scriptableStream = Cc["@mozilla.org/scriptableinputstream;1"]
     .getService(Ci.nsIScriptableInputStream);
 
   let channel = Services.io.newChannel(aSrcChromeURL, null, null);
   let input = channel.open();
   scriptableStream.init(input);
 
-  let data = scriptableStream.read(input.available());
+  let data = "";
+  while (input.available()) {
+    data = data.concat(scriptableStream.read(input.available()));
+  }
   scriptableStream.close();
   input.close();
 
   return data;
 }
 
 function write(aData, aFile, aCallback)
 {
--- a/browser/devtools/styleeditor/test/browser_styleeditor_sourcemap_watching.js
+++ b/browser/devtools/styleeditor/test/browser_styleeditor_sourcemap_watching.js
@@ -146,17 +146,20 @@ function read(aSrcChromeURL)
 {
   let scriptableStream = Cc["@mozilla.org/scriptableinputstream;1"]
     .getService(Ci.nsIScriptableInputStream);
 
   let channel = Services.io.newChannel(aSrcChromeURL, null, null);
   let input = channel.open();
   scriptableStream.init(input);
 
-  let data = scriptableStream.read(input.available());
+  let data = "";
+  while (input.available()) {
+    data = data.concat(scriptableStream.read(input.available()));
+  }
   scriptableStream.close();
   input.close();
 
   return data;
 }
 
 function write(aData, aFile)
 {