cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject spec commit: Detect Blob create failure in supporting platforms.
Date Wed, 13 Feb 2013 18:51:11 GMT
Updated Branches:
  refs/heads/master 3e3d0752a -> 5457654bd


Detect Blob create failure in supporting platforms.

Thanks jamesjong for reporting!


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/5457654b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/5457654b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/5457654b

Branch: refs/heads/master
Commit: 5457654bd8eae50d0a851c75ed6619342a4b9867
Parents: 3e3d075
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Wed Feb 13 13:48:59 2013 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Wed Feb 13 13:48:59 2013 -0500

----------------------------------------------------------------------
 autotest/tests/file.tests.js |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/5457654b/autotest/tests/file.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/file.tests.js b/autotest/tests/file.tests.js
index ebf7de8..8055f44 100644
--- a/autotest/tests/file.tests.js
+++ b/autotest/tests/file.tests.js
@@ -3006,6 +3006,10 @@ describe('File API', function() {
             waitsFor(function() { return verifier.wasCalled; }, "verifier never called",
Tests.TEST_TIMEOUT);
         });
         it("should be able to read native blob objects", function() {
+            // Skip test if blobs are not supported (e.g.: Android 2.3).
+            if (typeof Blob == 'undefined') {
+                return;
+            }
             var contents = 'asdf';
             var uint8Array = new Uint8Array(contents.length);
             for (var i = 0; i < contents.length; ++i) {
@@ -3019,13 +3023,15 @@ describe('File API', function() {
                 builder.append(contents);
                 blob = builder.getBlob("text/plain");
             } else {
-                // iOS 6 does not support Views here.
                 try {
+                    // iOS 6 does not support Views, so pass in the buffer.
                     blob = new Blob([uint8Array.buffer, contents]);
                 } catch (e) {
-                    // Skip the test if we can't create a blob.
-                    // This happens on Android <= 2.3 and iOS <= 5.
-                    return;
+                    // Skip the test if we can't create a blob (e.g.: iOS 5).
+                    if (e instanceof TypeError) {
+                        return;
+                    }
+                    throw e;
                 }
             }
             var verifier = jasmine.createSpy().andCallFake(function(evt) {


Mime
View raw message