cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmue...@apache.org
Subject weinre commit: [CB-1666] wrapper XHR response access in try/catch
Date Fri, 19 Oct 2012 12:30:41 GMT
Updated Branches:
  refs/heads/master 4d3b995fd -> 441566b4c


[CB-1666] wrapper XHR response access in try/catch

see: https://issues.apache.org/jira/browse/CB-1666


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/commit/441566b4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/tree/441566b4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/diff/441566b4

Branch: refs/heads/master
Commit: 441566b4cbbcfd6c886aea3f62883a3ca449dbd0
Parents: 4d3b995
Author: Patrick Mueller <pmuellr@apache.org>
Authored: Fri Oct 19 08:28:45 2012 -0400
Committer: Patrick Mueller <pmuellr@apache.org>
Committed: Fri Oct 19 08:28:45 2012 -0400

----------------------------------------------------------------------
 weinre.doc/ChangeLog.body.html                     |    1 +
 .../modules/weinre/target/NetworkRequest.coffee    |   24 ++++++++++-----
 2 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/441566b4/weinre.doc/ChangeLog.body.html
----------------------------------------------------------------------
diff --git a/weinre.doc/ChangeLog.body.html b/weinre.doc/ChangeLog.body.html
index 1d2e0ad..f1bd9b9 100644
--- a/weinre.doc/ChangeLog.body.html
+++ b/weinre.doc/ChangeLog.body.html
@@ -47,6 +47,7 @@
 <li><a href="https://issues.apache.org/jira/browse/CB-540">CB-540</a> 
- ability to easily navigate to particular place in DOM via bookmarks/jump to selector
 <li><a href="https://issues.apache.org/jira/browse/CB-873">CB-873</a> 
- setTimeout() and setInterval() usage with string arguments is busted
 <li><a href="https://issues.apache.org/jira/browse/CB-984">CB-984</a> 
- cannot install weinre with Node 0.8.0
+<li><a href="https://issues.apache.org/jira/browse/CB-1666">CB-1666</a>
- "INVALID_STATE_ERR: DOM Exception 11" with chbrody/Cordova-SQLitePlugin
 </ul>
 
 <!-- ======================================================================= -->

http://git-wip-us.apache.org/repos/asf/incubator-cordova-weinre/blob/441566b4/weinre.web/modules/weinre/target/NetworkRequest.coffee
----------------------------------------------------------------------
diff --git a/weinre.web/modules/weinre/target/NetworkRequest.coffee b/weinre.web/modules/weinre/target/NetworkRequest.coffee
index 92ddee6..8a33ad5 100644
--- a/weinre.web/modules/weinre/target/NetworkRequest.coffee
+++ b/weinre.web/modules/weinre/target/NetworkRequest.coffee
@@ -57,7 +57,12 @@ module.exports = class NetworkRequest
 
     #---------------------------------------------------------------------------
     handleDone: ->
-        sourceString = @xhr.responseText
+        sourceString = ""
+        try
+            sourceString = @xhr.responseText
+        catch e
+            # leave sourceString as ""
+
         Weinre.wi.NetworkNotify.setInitialContent(@id, sourceString, "XHR")
 
         time       = Date.now() / 1000.0
@@ -120,14 +125,14 @@ getRequest = (url, method, xhr, data) ->
 
 #-------------------------------------------------------------------------------
 getResponse = (xhr) ->
-    contentType = xhr.getResponseHeader("Content-Type") 
+    contentType = xhr.getResponseHeader("Content-Type")
     contentType ||= 'application/octet-stream'
 
     [contentType, encoding] = splitContentType(contentType)
 
     headers = getHeaders(xhr)
 
-    result = 
+    result =
         mimeType:              contentType
         textEncodingName:      encoding
         httpStatusCode:        xhr.status
@@ -136,7 +141,7 @@ getResponse = (xhr) ->
         connectionReused:      false
         connectionID:          0
         wasCached:             false
-    
+
     contentLength = xhr.getResponseHeader("Content-Length")
     contentLength = parseInt(contentLength)
     result.expectedContentLength = contentLength if !isNaN(contentLength)
@@ -186,8 +191,11 @@ getXhrEventHandler = (xhr) ->
         nr = xhr.__weinreNetworkRequest__
         return unless nr
 
-        switch xhr.readyState
-            when 2 then nr.handleHeadersReceived()
-            when 3 then nr.handleLoading()
-            when 4 then nr.handleDone()
+        try
+            switch xhr.readyState
+                when 2 then nr.handleHeadersReceived()
+                when 3 then nr.handleLoading()
+                when 4 then nr.handleDone()
+        catch e
+            # do nothing
 


Mime
View raw message