cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grzegorz Nowak (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-3219) Blob object discrepancies between platforms
Date Wed, 24 Apr 2013 06:41:15 GMT

    [ https://issues.apache.org/jira/browse/CB-3219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13640163#comment-13640163
] 

Grzegorz Nowak commented on CB-3219:
------------------------------------

Thanks Andrew.

Not that I need it tbh. Actually t'was used to differentiate between cordova/browser context
in one of my procedures, and resulted in a strange exception in Objective-C code I couldn't
debug on iOS. Until I realized that this check doesn't yield the same results for all platforms
of course.
I indeed thought this is a problem on WebKit, not in codova itself, but maybe it's worth to
unify this on cordova level anyway ? Possibly by creating a dummy Blob object. My personal
feeling (and how I try to approach the subject by myself) is that ideally I'd avoid coding
to specific devices' features, and be sure that cordova augments them so that there are no
such differences. Especially that the same Blob logic that worked in browser, failed spectacularly
on iOS.

{code:title=Bar.javascript|borderStyle=solid}

  var blob = null;
  /* 
  *  The offending check to see in which context we are currently. 
  *  Currently I'm using different logic, but reverting to show where I did face the problem.
  *  data -> String or Int8Array, depending on context
  */
  if(Facade.isBlobSupported()) { // the same logic as in issue's description
    blob = new Blob([data]);  // this is where an exception is raised on iOS, and not in chrome
  } else {
    // we fall here for android, but should do the same for iOS
 }
{code} 


What you think ?


                
> Blob object discrepancies between platforms
> -------------------------------------------
>
>                 Key: CB-3219
>                 URL: https://issues.apache.org/jira/browse/CB-3219
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, iOS
>    Affects Versions: 2.6.0
>         Environment: iOS device: iPhone 3gs, os: 6.1
> Android device version: N7102, os: 4.1.1
> Using default project created via "cordova create && cordova platform(s) add"
commands.
>            Reporter: Grzegorz Nowak
>            Assignee: Andrew Grieve
>            Priority: Minor
>
> h4. how to reproduce
> When checking for Blob object support with the code (slightly modified boilerplate code,
from boilerplate project):
> {code:title=Bar.javascript|borderStyle=solid}
> var app = {
>     initialize: function() {
>         this.bind();
>     },
>     bind: function() {
>         document.addEventListener('deviceready', this.deviceready, false);
>     },
>     deviceready: function() {
>         // note that this is an event handler so the scope is that of the event
>         // so we need to call app.report(), and not this.report()
>         app.report();
>     },
>     report: function() {
>         alert(this.isBlobSupported());
>     },
>     isBlobSupported:function() {
>         try {
>             return !!new Blob();
>         } catch (e) {
>             return false;
>         }
>     }
> };
> {code} 
> h4. result 
> I get different results for iOS (true) and Android (false).
> h4. expected result
> code should return the same value for every device supported.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message