You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Suraj Pindoria (JIRA)" <ji...@apache.org> on 2017/12/12 00:39:00 UTC

[jira] [Commented] (CB-13650) Javascript functions with default parameters cause app to be inoperable

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

Suraj Pindoria commented on CB-13650:
-------------------------------------

At first glance, I don't think this is an issue with Cordova but instead an issue with iOS. Most likely the older version of iOS does not support default parameters as it was introduced in the newer spec for Javascript. 

> Javascript functions with default parameters cause app to be inoperable
> -----------------------------------------------------------------------
>
>                 Key: CB-13650
>                 URL: https://issues.apache.org/jira/browse/CB-13650
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-ios
>    Affects Versions: cordova@7.1.0
>         Environment: Xcode 
> 9.2
> cordova --version
> 7.1.0
> Installed platforms:
>   ios 4.5.1
> iOS
> 9.3.5  (which is latest version available for iPod Touch)
>            Reporter: Ralph Gossa
>            Assignee: Suraj Pindoria
>
> Having Javascript functions with default parameters cause app to be inoperable on certain iOS platforms
> How to re-create the issue:
> cordova create test
> cd test
> cordova platform add ios
> Open the generated test.xcodeproj with Xcode
>  
> Add a javascript function with a default parameter to index.js, example:
> /* default parameter causes app to be inoperable on iPod touch running iOS 9.3*/
> function foo (a, b = 1) {
> 	b = 1;
> 	return b;
> }
> App with default parameters runs find in emulator and on iPhones running current iOS.
> However app does not initialize properly on iPod Touch running iOS 9.3.  It was working okay until I upgraded XCode and cordova.  The function does not even need to be called for the app to become inoperable.
> If the default parameter is removed from the Javascript function, the app runs fine.
> XCode output with Javascript function containing default parameter
> -----begin------
> 2017-12-08 10:29:41.783 paramtest[1125:133765] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/1C726E4F-A05A-418A-A37F-1877E71B1E60/Library/Cookies/Cookies.binarycookies
> 2017-12-08 10:29:41.962 paramtest[1125:133765] Apache Cordova native platform version 4.5.3 is starting.
> 2017-12-08 10:29:41.964 paramtest[1125:133765] Multi-tasking -> Device: YES, App: YES
> 2017-12-08 10:29:41.993 paramtest[1125:133765] 
> Started backup to iCloud! Please be careful.
> Your application might be rejected by Apple if you store too much data.
> For more information please read "iOS Data Storage Guidelines" at:
> https://developer.apple.com/icloud/documentation/data-storage/
> To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file
> 2017-12-08 10:29:42.132 paramtest[1125:133765] Using UIWebView
> 2017-12-08 10:29:42.145 paramtest[1125:133765] [CDVTimer][console] 0.753999ms
> 2017-12-08 10:29:42.148 paramtest[1125:133765] [CDVTimer][handleopenurl] 0.678003ms
> 2017-12-08 10:29:42.158 paramtest[1125:133765] [CDVTimer][intentandnavigationfilter] 9.851992ms
> 2017-12-08 10:29:42.159 paramtest[1125:133765] [CDVTimer][gesturehandler] 0.428021ms
> 2017-12-08 10:29:42.159 paramtest[1125:133765] [CDVTimer][TotalPluginStartup] 15.917003ms
> 2017-12-08 10:29:42.799 paramtest[1125:133765] Resetting plugins due to page load.
> 2017-12-08 10:29:43.167 paramtest[1125:133765] Finished load of: file:///var/containers/Bundle/Application/81B5D70F-0B1F-455E-AB84-FA6BE125EEC2/paramtest.app/www/index.html
> ------end----



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org