handle null contentType

fix for https://issues.apache.org/jira/browse/CB-175
        error when XHR contentType is null

Also some drive-by fixes for contentLength
diff --git a/weinre.web/modules/weinre/target/NetworkRequest.coffee b/weinre.web/modules/weinre/target/NetworkRequest.coffee
index 076fa5d..92ddee6 100644
--- a/weinre.web/modules/weinre/target/NetworkRequest.coffee
+++ b/weinre.web/modules/weinre/target/NetworkRequest.coffee
@@ -120,15 +120,15 @@
 
 #-------------------------------------------------------------------------------
 getResponse = (xhr) ->
-    contentType = xhr.getResponseHeader("Content-Type")
+    contentType = xhr.getResponseHeader("Content-Type") 
+    contentType ||= 'application/octet-stream'
 
     [contentType, encoding] = splitContentType(contentType)
 
     headers = getHeaders(xhr)
 
-    return {
-        mimeType: contentType
-        expectedContentLength: contentType
+    result = 
+        mimeType:              contentType
         textEncodingName:      encoding
         httpStatusCode:        xhr.status
         httpStatusText:        xhr.statusText
@@ -136,7 +136,12 @@
         connectionReused:      false
         connectionID:          0
         wasCached:             false
-    }
+    
+    contentLength = xhr.getResponseHeader("Content-Length")
+    contentLength = parseInt(contentLength)
+    result.expectedContentLength = contentLength if !isNaN(contentLength)
+
+    return result
 
 #-------------------------------------------------------------------------------
 getHeaders = (xhr) ->
diff --git a/weinre.web/modules/weinre/target/Timeline.coffee b/weinre.web/modules/weinre/target/Timeline.coffee
index a66dfed..fdf93d5 100644
--- a/weinre.web/modules/weinre/target/Timeline.coffee
+++ b/weinre.web/modules/weinre/target/Timeline.coffee
@@ -154,6 +154,9 @@
         record.startTime = Date.now()
         record.category  = name: "loading"
 
+        contentLength = xhr.getResponseHeader("Content-Length")
+        contentLength = parseInt(contentLength)
+
         if xhr.readyState == XMLHttpRequest.OPENED
             record.type = TimelineRecordType.ResourceSendRequest
             record.data =
@@ -167,8 +170,10 @@
                 identifier:            id
                 statusCode:            xhr.status
                 mimeType:              xhr.getResponseHeader("Content-Type")
-                expectedContentLength: xhr.getResponseHeader("Content-Length")
                 url:                   url
+
+            record.data.expectedContentLength = contentLength if !isNaN(contentLength)
+
         else
             return