@sumsub/cordova-idensic-mobile-sdk-plugin 1.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (843) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/README.md +8 -0
  3. package/demo/Gemfile +4 -0
  4. package/demo/Gemfile.lock +262 -0
  5. package/demo/README.md +61 -0
  6. package/demo/config.xml +46 -0
  7. package/demo/fastlane/Appfile +8 -0
  8. package/demo/fastlane/Fastfile +142 -0
  9. package/demo/fastlane/README.md +34 -0
  10. package/demo/fastlane/helpers +109 -0
  11. package/demo/hooks/README.md +23 -0
  12. package/demo/package-lock.json +3624 -0
  13. package/demo/package.json +57 -0
  14. package/demo/platforms/android/CordovaLib/AndroidManifest.xml +22 -0
  15. package/demo/platforms/android/CordovaLib/build.gradle +148 -0
  16. package/demo/platforms/android/CordovaLib/cordova.gradle +205 -0
  17. package/demo/platforms/android/CordovaLib/project.properties +11 -0
  18. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/AuthenticationToken.java +69 -0
  19. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/BuildHelper.java +70 -0
  20. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CallbackContext.java +142 -0
  21. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CallbackMap.java +65 -0
  22. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/Config.java +71 -0
  23. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/ConfigXmlParser.java +145 -0
  24. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaActivity.java +521 -0
  25. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaArgs.java +113 -0
  26. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaBridge.java +187 -0
  27. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java +105 -0
  28. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaDialogsHelper.java +152 -0
  29. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaHttpAuthHandler.java +51 -0
  30. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterface.java +97 -0
  31. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaInterfaceImpl.java +249 -0
  32. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaPlugin.java +422 -0
  33. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaPreferences.java +101 -0
  34. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaResourceApi.java +472 -0
  35. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebView.java +142 -0
  36. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewEngine.java +85 -0
  37. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CordovaWebViewImpl.java +617 -0
  38. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/CoreAndroid.java +407 -0
  39. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/ExposedJsApi.java +31 -0
  40. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/ICordovaClientCertRequest.java +66 -0
  41. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/ICordovaCookieManager.java +33 -0
  42. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/ICordovaHttpAuthHandler.java +38 -0
  43. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/LOG.java +244 -0
  44. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/NativeToJsMessageQueue.java +542 -0
  45. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/PermissionHelper.java +87 -0
  46. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/PluginEntry.java +70 -0
  47. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/PluginManager.java +526 -0
  48. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/PluginResult.java +198 -0
  49. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/ResumeCallback.java +76 -0
  50. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/Whitelist.java +170 -0
  51. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemCookieManager.java +74 -0
  52. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemExposedJsApi.java +53 -0
  53. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebChromeClient.java +301 -0
  54. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebView.java +88 -0
  55. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebViewClient.java +370 -0
  56. package/demo/platforms/android/CordovaLib/src/org/apache/cordova/engine/SystemWebViewEngine.java +319 -0
  57. package/demo/platforms/android/android.json +440 -0
  58. package/demo/platforms/android/app/build.gradle +363 -0
  59. package/demo/platforms/android/app/libs/barcodescanner-release-2.1.5.aar +0 -0
  60. package/demo/platforms/android/app/src/main/AndroidManifest.xml +23 -0
  61. package/demo/platforms/android/app/src/main/java/com/applurk/nativetimer/Consumer.java +22 -0
  62. package/demo/platforms/android/app/src/main/java/com/applurk/nativetimer/NativeTimerAdapter.java +27 -0
  63. package/demo/platforms/android/app/src/main/java/com/applurk/nativetimer/NativeTimerAdapterImpl.java +123 -0
  64. package/demo/platforms/android/app/src/main/java/com/applurk/nativetimer/NativeTimerPlugin.java +163 -0
  65. package/demo/platforms/android/app/src/main/java/com/phonegap/plugins/barcodescanner/BarcodeScanner.java +328 -0
  66. package/demo/platforms/android/app/src/main/java/com/silkimen/cordovahttp/CordovaClientAuth.java +113 -0
  67. package/demo/platforms/android/app/src/main/java/com/silkimen/cordovahttp/CordovaHttpBase.java +225 -0
  68. package/demo/platforms/android/app/src/main/java/com/silkimen/cordovahttp/CordovaHttpDownload.java +41 -0
  69. package/demo/platforms/android/app/src/main/java/com/silkimen/cordovahttp/CordovaHttpOperation.java +24 -0
  70. package/demo/platforms/android/app/src/main/java/com/silkimen/cordovahttp/CordovaHttpPlugin.java +240 -0
  71. package/demo/platforms/android/app/src/main/java/com/silkimen/cordovahttp/CordovaHttpResponse.java +100 -0
  72. package/demo/platforms/android/app/src/main/java/com/silkimen/cordovahttp/CordovaHttpUpload.java +91 -0
  73. package/demo/platforms/android/app/src/main/java/com/silkimen/cordovahttp/CordovaObservableCallbackContext.java +58 -0
  74. package/demo/platforms/android/app/src/main/java/com/silkimen/cordovahttp/CordovaServerTrust.java +124 -0
  75. package/demo/platforms/android/app/src/main/java/com/silkimen/http/HttpBodyDecoder.java +55 -0
  76. package/demo/platforms/android/app/src/main/java/com/silkimen/http/HttpRequest.java +3095 -0
  77. package/demo/platforms/android/app/src/main/java/com/silkimen/http/JsonUtils.java +58 -0
  78. package/demo/platforms/android/app/src/main/java/com/silkimen/http/KeyChainKeyManager.java +57 -0
  79. package/demo/platforms/android/app/src/main/java/com/silkimen/http/TLSConfiguration.java +63 -0
  80. package/demo/platforms/android/app/src/main/java/com/silkimen/http/TLSSocketFactory.java +63 -0
  81. package/demo/platforms/android/app/src/main/java/com/sumsub/SumSubCordova/MainActivity.java +41 -0
  82. package/demo/platforms/android/app/src/main/java/main/java/com/sumsub/msdk/plugins/cordova/SNSMobileSdkCordovaPlugin.java +339 -0
  83. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/AssetFilesystem.java +294 -0
  84. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/ContentFilesystem.java +223 -0
  85. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/DirectoryManager.java +134 -0
  86. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/EncodingException.java +29 -0
  87. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/FileExistsException.java +29 -0
  88. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/FileUtils.java +1225 -0
  89. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/Filesystem.java +331 -0
  90. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/InvalidModificationException.java +30 -0
  91. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/LocalFilesystem.java +513 -0
  92. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/LocalFilesystemURL.java +64 -0
  93. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/NoModificationAllowedException.java +29 -0
  94. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/PendingRequests.java +94 -0
  95. package/demo/platforms/android/app/src/main/java/org/apache/cordova/file/TypeMismatchException.java +30 -0
  96. package/demo/platforms/android/app/src/main/java/org/apache/cordova/whitelist/WhitelistPlugin.java +161 -0
  97. package/demo/platforms/android/app/src/main/res/drawable-land-hdpi/screen.png +0 -0
  98. package/demo/platforms/android/app/src/main/res/drawable-land-ldpi/screen.png +0 -0
  99. package/demo/platforms/android/app/src/main/res/drawable-land-mdpi/screen.png +0 -0
  100. package/demo/platforms/android/app/src/main/res/drawable-land-xhdpi/screen.png +0 -0
  101. package/demo/platforms/android/app/src/main/res/drawable-land-xxhdpi/screen.png +0 -0
  102. package/demo/platforms/android/app/src/main/res/drawable-land-xxxhdpi/screen.png +0 -0
  103. package/demo/platforms/android/app/src/main/res/drawable-port-hdpi/screen.png +0 -0
  104. package/demo/platforms/android/app/src/main/res/drawable-port-ldpi/screen.png +0 -0
  105. package/demo/platforms/android/app/src/main/res/drawable-port-mdpi/screen.png +0 -0
  106. package/demo/platforms/android/app/src/main/res/drawable-port-xhdpi/screen.png +0 -0
  107. package/demo/platforms/android/app/src/main/res/drawable-port-xxhdpi/screen.png +0 -0
  108. package/demo/platforms/android/app/src/main/res/drawable-port-xxxhdpi/screen.png +0 -0
  109. package/demo/platforms/android/app/src/main/res/mipmap-ldpi/ic_launcher.png +0 -0
  110. package/demo/platforms/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  111. package/demo/platforms/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  112. package/demo/platforms/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  113. package/demo/platforms/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  114. package/demo/platforms/android/app/src/main/res/values/strings.xml +7 -0
  115. package/demo/platforms/android/app/src/main/res/xml/config.xml +44 -0
  116. package/demo/platforms/android/build.gradle +54 -0
  117. package/demo/platforms/android/cordova/Api.js +368 -0
  118. package/demo/platforms/android/cordova/android_sdk_version +27 -0
  119. package/demo/platforms/android/cordova/android_sdk_version.bat +26 -0
  120. package/demo/platforms/android/cordova/build +51 -0
  121. package/demo/platforms/android/cordova/build.bat +26 -0
  122. package/demo/platforms/android/cordova/check_reqs +32 -0
  123. package/demo/platforms/android/cordova/check_reqs.bat +26 -0
  124. package/demo/platforms/android/cordova/clean +51 -0
  125. package/demo/platforms/android/cordova/clean.bat +26 -0
  126. package/demo/platforms/android/cordova/defaults.xml +26 -0
  127. package/demo/platforms/android/cordova/lib/Adb.js +101 -0
  128. package/demo/platforms/android/cordova/lib/AndroidManifest.js +126 -0
  129. package/demo/platforms/android/cordova/lib/AndroidProject.js +202 -0
  130. package/demo/platforms/android/cordova/lib/PackageType.js +25 -0
  131. package/demo/platforms/android/cordova/lib/android_sdk.js +101 -0
  132. package/demo/platforms/android/cordova/lib/build.js +321 -0
  133. package/demo/platforms/android/cordova/lib/builders/ProjectBuilder.js +412 -0
  134. package/demo/platforms/android/cordova/lib/builders/builders.js +34 -0
  135. package/demo/platforms/android/cordova/lib/check_reqs.js +436 -0
  136. package/demo/platforms/android/cordova/lib/config/GradlePropertiesParser.js +114 -0
  137. package/demo/platforms/android/cordova/lib/device.js +111 -0
  138. package/demo/platforms/android/cordova/lib/emulator.js +530 -0
  139. package/demo/platforms/android/cordova/lib/getASPath.bat +3 -0
  140. package/demo/platforms/android/cordova/lib/install-device +42 -0
  141. package/demo/platforms/android/cordova/lib/install-device.bat +26 -0
  142. package/demo/platforms/android/cordova/lib/install-emulator +38 -0
  143. package/demo/platforms/android/cordova/lib/install-emulator.bat +26 -0
  144. package/demo/platforms/android/cordova/lib/list-devices +34 -0
  145. package/demo/platforms/android/cordova/lib/list-devices.bat +26 -0
  146. package/demo/platforms/android/cordova/lib/list-emulator-images +34 -0
  147. package/demo/platforms/android/cordova/lib/list-emulator-images.bat +26 -0
  148. package/demo/platforms/android/cordova/lib/list-started-emulators +34 -0
  149. package/demo/platforms/android/cordova/lib/list-started-emulators.bat +26 -0
  150. package/demo/platforms/android/cordova/lib/log.js +56 -0
  151. package/demo/platforms/android/cordova/lib/plugin-build.gradle +69 -0
  152. package/demo/platforms/android/cordova/lib/pluginHandlers.js +334 -0
  153. package/demo/platforms/android/cordova/lib/prepare.js +702 -0
  154. package/demo/platforms/android/cordova/lib/retry.js +64 -0
  155. package/demo/platforms/android/cordova/lib/run.js +140 -0
  156. package/demo/platforms/android/cordova/lib/start-emulator +38 -0
  157. package/demo/platforms/android/cordova/lib/start-emulator.bat +26 -0
  158. package/demo/platforms/android/cordova/log +36 -0
  159. package/demo/platforms/android/cordova/log.bat +26 -0
  160. package/demo/platforms/android/cordova/loggingHelper.js +18 -0
  161. package/demo/platforms/android/cordova/run +54 -0
  162. package/demo/platforms/android/cordova/run.bat +26 -0
  163. package/demo/platforms/android/cordova/version +29 -0
  164. package/demo/platforms/android/cordova/version.bat +26 -0
  165. package/demo/platforms/android/cordova-idensic-mobile-sdk-plugin/SumSubCordova-build-extras.gradle +20 -0
  166. package/demo/platforms/android/cordova-plugin-enable-multidex/SumSubCordova-build.gradle +9 -0
  167. package/demo/platforms/android/cordova-plugin-qr-barcode-scanner/SumSubCordova-barcodescanner.gradle +17 -0
  168. package/demo/platforms/android/gradle.properties +6 -0
  169. package/demo/platforms/android/platform_www/cordova-js-src/android/nativeapiprovider.js +36 -0
  170. package/demo/platforms/android/platform_www/cordova-js-src/android/promptbasednativeapi.js +35 -0
  171. package/demo/platforms/android/platform_www/cordova-js-src/exec.js +286 -0
  172. package/demo/platforms/android/platform_www/cordova-js-src/platform.js +125 -0
  173. package/demo/platforms/android/platform_www/cordova-js-src/plugin/android/app.js +108 -0
  174. package/demo/platforms/android/platform_www/cordova.js +1935 -0
  175. package/demo/platforms/android/platform_www/cordova_plugins.js +287 -0
  176. package/demo/platforms/android/platform_www/plugins/cordova-idensic-mobile-sdk-plugin/dist/SNSMobileSDK.js +3 -0
  177. package/demo/platforms/android/project.properties +17 -0
  178. package/demo/platforms/android/settings.gradle +4 -0
  179. package/demo/platforms/android/wrapper.gradle +1 -0
  180. package/demo/platforms/ios/CordovaLib/Classes/Private/CDVDebug.h +25 -0
  181. package/demo/platforms/ios/CordovaLib/Classes/Private/CDVJSON_private.h +31 -0
  182. package/demo/platforms/ios/CordovaLib/Classes/Private/CDVJSON_private.m +99 -0
  183. package/demo/platforms/ios/CordovaLib/Classes/Private/CDVPlugin+Private.h +24 -0
  184. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.h +26 -0
  185. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVGestureHandler/CDVGestureHandler.m +70 -0
  186. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVHandleOpenURL/CDVHandleOpenURL.h +27 -0
  187. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVHandleOpenURL/CDVHandleOpenURL.m +86 -0
  188. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.h +40 -0
  189. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.m +150 -0
  190. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVLocalStorage/CDVLocalStorage.h +50 -0
  191. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVLocalStorage/CDVLocalStorage.m +493 -0
  192. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVLogger/CDVLogger.h +26 -0
  193. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVLogger/CDVLogger.m +37 -0
  194. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.h +45 -0
  195. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m +408 -0
  196. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.h +29 -0
  197. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m +206 -0
  198. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.h +33 -0
  199. package/demo/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m +157 -0
  200. package/demo/platforms/ios/CordovaLib/Classes/Public/CDV.h +32 -0
  201. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVAppDelegate.h +28 -0
  202. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVAppDelegate.m +118 -0
  203. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVAvailability.h +115 -0
  204. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVAvailabilityDeprecated.h +26 -0
  205. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVCommandDelegate.h +51 -0
  206. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVCommandDelegateImpl.h +36 -0
  207. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVCommandDelegateImpl.m +186 -0
  208. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVCommandQueue.h +39 -0
  209. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVCommandQueue.m +194 -0
  210. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVConfigParser.h +30 -0
  211. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVConfigParser.m +81 -0
  212. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVInvokedUrlCommand.h +52 -0
  213. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVInvokedUrlCommand.m +116 -0
  214. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVPlugin+Resources.h +39 -0
  215. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVPlugin+Resources.m +38 -0
  216. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVPlugin.h +74 -0
  217. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVPlugin.m +199 -0
  218. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVPluginResult.h +83 -0
  219. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVPluginResult.m +203 -0
  220. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVScreenOrientationDelegate.h +33 -0
  221. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVTimer.h +27 -0
  222. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVTimer.m +123 -0
  223. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.h +27 -0
  224. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVURLProtocol.m +113 -0
  225. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVUserAgentUtil.h +27 -0
  226. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVUserAgentUtil.m +162 -0
  227. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVViewController.h +92 -0
  228. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVViewController.m +810 -0
  229. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVWebViewEngineProtocol.h +42 -0
  230. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVWhitelist.h +34 -0
  231. package/demo/platforms/ios/CordovaLib/Classes/Public/CDVWhitelist.m +285 -0
  232. package/demo/platforms/ios/CordovaLib/Classes/Public/NSDictionary+CordovaPreferences.h +35 -0
  233. package/demo/platforms/ios/CordovaLib/Classes/Public/NSDictionary+CordovaPreferences.m +63 -0
  234. package/demo/platforms/ios/CordovaLib/Classes/Public/NSMutableArray+QueueAdditions.h +29 -0
  235. package/demo/platforms/ios/CordovaLib/Classes/Public/NSMutableArray+QueueAdditions.m +58 -0
  236. package/demo/platforms/ios/CordovaLib/CordovaLib.xcodeproj/project.pbxproj +797 -0
  237. package/demo/platforms/ios/CordovaLib/CordovaLib_Prefix.pch +22 -0
  238. package/demo/platforms/ios/CordovaLib/VERSION +1 -0
  239. package/demo/platforms/ios/CordovaLib/cordova.js +2188 -0
  240. package/demo/platforms/ios/Podfile +9 -0
  241. package/demo/platforms/ios/Podfile.lock +20 -0
  242. package/demo/platforms/ios/SumSubCordova/Bridging-Header.h +28 -0
  243. package/demo/platforms/ios/SumSubCordova/CDVLaunchScreen.storyboard +60 -0
  244. package/demo/platforms/ios/SumSubCordova/Classes/AppDelegate.h +33 -0
  245. package/demo/platforms/ios/SumSubCordova/Classes/AppDelegate.m +39 -0
  246. package/demo/platforms/ios/SumSubCordova/Classes/MainViewController.h +40 -0
  247. package/demo/platforms/ios/SumSubCordova/Classes/MainViewController.m +148 -0
  248. package/demo/platforms/ios/SumSubCordova/Classes/MainViewController.xib +138 -0
  249. package/demo/platforms/ios/SumSubCordova/Entitlements-Debug.plist +24 -0
  250. package/demo/platforms/ios/SumSubCordova/Entitlements-Release.plist +24 -0
  251. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/Contents.json +116 -0
  252. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-1024.png +0 -0
  253. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-20.png +0 -0
  254. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-20@2x.png +0 -0
  255. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-20@3x.png +0 -0
  256. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-29.png +0 -0
  257. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-29@2x.png +0 -0
  258. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-29@3x.png +0 -0
  259. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-40.png +0 -0
  260. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-40@2x.png +0 -0
  261. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-40@3x.png +0 -0
  262. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-60@2x.png +0 -0
  263. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-60@3x.png +0 -0
  264. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-76.png +0 -0
  265. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-76@2x.png +0 -0
  266. package/demo/platforms/ios/SumSubCordova/Images.xcassets/AppIcon.appiconset/cordova_icon-83.5@2x.png +0 -0
  267. package/demo/platforms/ios/SumSubCordova/Images.xcassets/Contents.json +6 -0
  268. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Contents.json +176 -0
  269. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default-2436h.png +0 -0
  270. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default-568h@2x~iphone.png +0 -0
  271. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default-667h.png +0 -0
  272. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default-736h.png +0 -0
  273. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default-Landscape-2436h.png +0 -0
  274. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.png +0 -0
  275. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png +0 -0
  276. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png +0 -0
  277. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png +0 -0
  278. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png +0 -0
  279. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default@2x~iphone.png +0 -0
  280. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchImage.launchimage/Default~iphone.png +0 -0
  281. package/demo/platforms/ios/SumSubCordova/Images.xcassets/LaunchStoryboard.imageset/Contents.json +168 -0
  282. package/demo/platforms/ios/SumSubCordova/Plugins/README +20 -0
  283. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-idensic-mobile-sdk-plugin/SNSMobileSdkCordovaPlugin.h +12 -0
  284. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-idensic-mobile-sdk-plugin/SNSMobileSdkCordovaPlugin.m +263 -0
  285. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFHTTPSessionManager.h +353 -0
  286. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFHTTPSessionManager.m +464 -0
  287. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFNetworkReachabilityManager.h +206 -0
  288. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFNetworkReachabilityManager.m +263 -0
  289. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFNetworking.h +41 -0
  290. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFSecurityPolicy.h +154 -0
  291. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFSecurityPolicy.m +353 -0
  292. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFURLRequestSerialization.h +479 -0
  293. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFURLRequestSerialization.m +1355 -0
  294. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFURLResponseSerialization.h +318 -0
  295. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFURLResponseSerialization.m +806 -0
  296. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFURLSessionManager.h +500 -0
  297. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/AFURLSessionManager.m +1239 -0
  298. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/BinaryRequestSerializer.h +8 -0
  299. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/BinaryRequestSerializer.m +53 -0
  300. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/BinaryResponseSerializer.h +8 -0
  301. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/BinaryResponseSerializer.m +126 -0
  302. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/CordovaHttpPlugin.h +20 -0
  303. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/CordovaHttpPlugin.m +639 -0
  304. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/SDNetworkActivityIndicator.h +18 -0
  305. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/SDNetworkActivityIndicator.m +70 -0
  306. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/TextRequestSerializer.h +8 -0
  307. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/TextRequestSerializer.m +53 -0
  308. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/TextResponseSerializer.h +8 -0
  309. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-advanced-http/TextResponseSerializer.m +145 -0
  310. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-file/CDVAssetLibraryFilesystem.h +30 -0
  311. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-file/CDVAssetLibraryFilesystem.m +253 -0
  312. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-file/CDVFile.h +157 -0
  313. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-file/CDVFile.m +1119 -0
  314. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-file/CDVLocalFilesystem.h +32 -0
  315. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-file/CDVLocalFilesystem.m +750 -0
  316. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-qr-barcode-scanner/CDVBarcodeScanner.mm +1067 -0
  317. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-timer/NativeTimerAdapter.h +35 -0
  318. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-timer/NativeTimerAdapter.m +76 -0
  319. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-timer/NativeTimerPlugin.h +28 -0
  320. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-timer/NativeTimerPlugin.m +158 -0
  321. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-wkwebview-engine/CDVWKProcessPoolFactory.h +27 -0
  322. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-wkwebview-engine/CDVWKProcessPoolFactory.m +49 -0
  323. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-wkwebview-engine/CDVWKWebViewEngine.h +29 -0
  324. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-wkwebview-engine/CDVWKWebViewEngine.m +494 -0
  325. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-wkwebview-engine/CDVWKWebViewUIDelegate.h +28 -0
  326. package/demo/platforms/ios/SumSubCordova/Plugins/cordova-plugin-wkwebview-engine/CDVWKWebViewUIDelegate.m +123 -0
  327. package/demo/platforms/ios/SumSubCordova/Resources/CDVBarcodeScanner.bundle/beep.caf +0 -0
  328. package/demo/platforms/ios/SumSubCordova/Resources/CDVBarcodeScanner.bundle/torch.png +0 -0
  329. package/demo/platforms/ios/SumSubCordova/Resources/CDVBarcodeScanner.bundle/torch@2x.png +0 -0
  330. package/demo/platforms/ios/SumSubCordova/Resources/CDVBarcodeScanner.bundle/torch@3x.png +0 -0
  331. package/demo/platforms/ios/SumSubCordova/Resources/scannerOverlay.xib +185 -0
  332. package/demo/platforms/ios/SumSubCordova/Scripts/copy-www-build-step.sh +63 -0
  333. package/demo/platforms/ios/SumSubCordova/SumSubCordova-Info.plist +60 -0
  334. package/demo/platforms/ios/SumSubCordova/SumSubCordova-Prefix.pch +26 -0
  335. package/demo/platforms/ios/SumSubCordova/config.xml +74 -0
  336. package/demo/platforms/ios/SumSubCordova/main.m +35 -0
  337. package/demo/platforms/ios/SumSubCordova.xcodeproj/project.pbxproj +698 -0
  338. package/demo/platforms/ios/SumSubCordova.xcworkspace/contents.xcworkspacedata +10 -0
  339. package/demo/platforms/ios/SumSubCordova.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  340. package/demo/platforms/ios/SumSubCordova.xcworkspace/xcshareddata/xcschemes/SumSubCordova.xcscheme +91 -0
  341. package/demo/platforms/ios/cordova/Api.js +715 -0
  342. package/demo/platforms/ios/cordova/apple_ios_version +27 -0
  343. package/demo/platforms/ios/cordova/apple_osx_version +27 -0
  344. package/demo/platforms/ios/cordova/apple_xcode_version +29 -0
  345. package/demo/platforms/ios/cordova/build +63 -0
  346. package/demo/platforms/ios/cordova/build-debug.xcconfig +32 -0
  347. package/demo/platforms/ios/cordova/build-extras.xcconfig +0 -0
  348. package/demo/platforms/ios/cordova/build-release.xcconfig +33 -0
  349. package/demo/platforms/ios/cordova/build.bat +19 -0
  350. package/demo/platforms/ios/cordova/build.xcconfig +45 -0
  351. package/demo/platforms/ios/cordova/check_reqs +32 -0
  352. package/demo/platforms/ios/cordova/check_reqs.bat +25 -0
  353. package/demo/platforms/ios/cordova/clean +49 -0
  354. package/demo/platforms/ios/cordova/clean.bat +19 -0
  355. package/demo/platforms/ios/cordova/defaults.xml +59 -0
  356. package/demo/platforms/ios/cordova/lib/BridgingHeader.js +125 -0
  357. package/demo/platforms/ios/cordova/lib/Podfile.js +424 -0
  358. package/demo/platforms/ios/cordova/lib/PodsJson.js +209 -0
  359. package/demo/platforms/ios/cordova/lib/build.js +464 -0
  360. package/demo/platforms/ios/cordova/lib/check_reqs.js +235 -0
  361. package/demo/platforms/ios/cordova/lib/clean.js +42 -0
  362. package/demo/platforms/ios/cordova/lib/list-devices +66 -0
  363. package/demo/platforms/ios/cordova/lib/list-emulator-build-targets +108 -0
  364. package/demo/platforms/ios/cordova/lib/list-emulator-images +43 -0
  365. package/demo/platforms/ios/cordova/lib/list-started-emulators +49 -0
  366. package/demo/platforms/ios/cordova/lib/plugman/pluginHandlers.js +391 -0
  367. package/demo/platforms/ios/cordova/lib/prepare.js +1190 -0
  368. package/demo/platforms/ios/cordova/lib/projectFile.js +134 -0
  369. package/demo/platforms/ios/cordova/lib/run.js +263 -0
  370. package/demo/platforms/ios/cordova/lib/spawn.js +51 -0
  371. package/demo/platforms/ios/cordova/lib/start-emulator +30 -0
  372. package/demo/platforms/ios/cordova/lib/versions.js +179 -0
  373. package/demo/platforms/ios/cordova/log +23 -0
  374. package/demo/platforms/ios/cordova/log.bat +19 -0
  375. package/demo/platforms/ios/cordova/loggingHelper.js +30 -0
  376. package/demo/platforms/ios/cordova/run +63 -0
  377. package/demo/platforms/ios/cordova/run.bat +19 -0
  378. package/demo/platforms/ios/cordova/version +35 -0
  379. package/demo/platforms/ios/cordova/version.bat +26 -0
  380. package/demo/platforms/ios/frameworks.json +7 -0
  381. package/demo/platforms/ios/ios.json +402 -0
  382. package/demo/platforms/ios/platform_www/cordova-js-src/.eslintrc.yml +4 -0
  383. package/demo/platforms/ios/platform_www/cordova-js-src/exec.js +262 -0
  384. package/demo/platforms/ios/platform_www/cordova-js-src/platform.js +31 -0
  385. package/demo/platforms/ios/platform_www/cordova-js-src/plugin/ios/console.js +186 -0
  386. package/demo/platforms/ios/platform_www/cordova-js-src/plugin/ios/logger.js +349 -0
  387. package/demo/platforms/ios/platform_www/cordova.js +2188 -0
  388. package/demo/platforms/ios/platform_www/cordova_plugins.js +302 -0
  389. package/demo/platforms/ios/platform_www/plugins/cordova-idensic-mobile-sdk-plugin/dist/SNSMobileSDK.js +3 -0
  390. package/demo/platforms/ios/pods-debug.xcconfig +2 -0
  391. package/demo/platforms/ios/pods-release.xcconfig +2 -0
  392. package/demo/platforms/ios/pods.json +20 -0
  393. package/demo/plugins/android.json +47 -0
  394. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/dist/SNSMobileSDK.js +1 -0
  395. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/package.json +48 -0
  396. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/plugin.xml +82 -0
  397. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/src/android/build-extras.gradle +20 -0
  398. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/src/android/build.gradle +54 -0
  399. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/src/android/dependencies.gradle +122 -0
  400. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/src/android/gradlew +172 -0
  401. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/src/android/gradlew.bat +84 -0
  402. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/src/android/src/main/java/com/sumsub/msdk/plugins/cordova/SNSMobileSdkCordovaPlugin.java +328 -0
  403. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/src/ios/SNSMobileSdkCordovaPlugin.h +12 -0
  404. package/demo/plugins/cordova-idensic-mobile-sdk-plugin/src/ios/SNSMobileSdkCordovaPlugin.m +263 -0
  405. package/demo/plugins/cordova-plugin-advanced-http/.editorconfig +19 -0
  406. package/demo/plugins/cordova-plugin-advanced-http/.github/ISSUE_TEMPLATE/--bug-report.md +33 -0
  407. package/demo/plugins/cordova-plugin-advanced-http/.github/ISSUE_TEMPLATE/--feature-request.md +21 -0
  408. package/demo/plugins/cordova-plugin-advanced-http/.github/ISSUE_TEMPLATE/--support-question.md +18 -0
  409. package/demo/plugins/cordova-plugin-advanced-http/.github/workflows/ci.yml +65 -0
  410. package/demo/plugins/cordova-plugin-advanced-http/.travis.yml +61 -0
  411. package/demo/plugins/cordova-plugin-advanced-http/.vscode/settings.json +3 -0
  412. package/demo/plugins/cordova-plugin-advanced-http/CHANGELOG.md +347 -0
  413. package/demo/plugins/cordova-plugin-advanced-http/CONTRIBUTING.md +82 -0
  414. package/demo/plugins/cordova-plugin-advanced-http/LICENSE +23 -0
  415. package/demo/plugins/cordova-plugin-advanced-http/README.md +483 -0
  416. package/demo/plugins/cordova-plugin-advanced-http/package.json +114 -0
  417. package/demo/plugins/cordova-plugin-advanced-http/plugin.xml +96 -0
  418. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/cordovahttp/CordovaClientAuth.java +113 -0
  419. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/cordovahttp/CordovaHttpBase.java +225 -0
  420. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/cordovahttp/CordovaHttpDownload.java +41 -0
  421. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/cordovahttp/CordovaHttpOperation.java +24 -0
  422. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/cordovahttp/CordovaHttpPlugin.java +240 -0
  423. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/cordovahttp/CordovaHttpResponse.java +100 -0
  424. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/cordovahttp/CordovaHttpUpload.java +91 -0
  425. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/cordovahttp/CordovaObservableCallbackContext.java +58 -0
  426. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/cordovahttp/CordovaServerTrust.java +124 -0
  427. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/http/HttpBodyDecoder.java +55 -0
  428. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/http/HttpRequest.java +3095 -0
  429. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/http/JsonUtils.java +58 -0
  430. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/http/KeyChainKeyManager.java +57 -0
  431. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/http/TLSConfiguration.java +63 -0
  432. package/demo/plugins/cordova-plugin-advanced-http/src/android/com/silkimen/http/TLSSocketFactory.java +63 -0
  433. package/demo/plugins/cordova-plugin-advanced-http/src/browser/cordova-http-plugin.js +323 -0
  434. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFHTTPSessionManager.h +353 -0
  435. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFHTTPSessionManager.m +464 -0
  436. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFNetworkReachabilityManager.h +206 -0
  437. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFNetworkReachabilityManager.m +263 -0
  438. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFNetworking.h +41 -0
  439. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFSecurityPolicy.h +154 -0
  440. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFSecurityPolicy.m +353 -0
  441. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFURLRequestSerialization.h +479 -0
  442. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFURLRequestSerialization.m +1355 -0
  443. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFURLResponseSerialization.h +318 -0
  444. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFURLResponseSerialization.m +806 -0
  445. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFURLSessionManager.h +500 -0
  446. package/demo/plugins/cordova-plugin-advanced-http/src/ios/AFNetworking/AFURLSessionManager.m +1239 -0
  447. package/demo/plugins/cordova-plugin-advanced-http/src/ios/BinaryRequestSerializer.h +8 -0
  448. package/demo/plugins/cordova-plugin-advanced-http/src/ios/BinaryRequestSerializer.m +53 -0
  449. package/demo/plugins/cordova-plugin-advanced-http/src/ios/BinaryResponseSerializer.h +8 -0
  450. package/demo/plugins/cordova-plugin-advanced-http/src/ios/BinaryResponseSerializer.m +126 -0
  451. package/demo/plugins/cordova-plugin-advanced-http/src/ios/CordovaHttpPlugin.h +20 -0
  452. package/demo/plugins/cordova-plugin-advanced-http/src/ios/CordovaHttpPlugin.m +639 -0
  453. package/demo/plugins/cordova-plugin-advanced-http/src/ios/SDNetworkActivityIndicator/LICENSE +20 -0
  454. package/demo/plugins/cordova-plugin-advanced-http/src/ios/SDNetworkActivityIndicator/README.md +52 -0
  455. package/demo/plugins/cordova-plugin-advanced-http/src/ios/SDNetworkActivityIndicator/SDNetworkActivityIndicator.h +18 -0
  456. package/demo/plugins/cordova-plugin-advanced-http/src/ios/SDNetworkActivityIndicator/SDNetworkActivityIndicator.m +70 -0
  457. package/demo/plugins/cordova-plugin-advanced-http/src/ios/TextRequestSerializer.h +8 -0
  458. package/demo/plugins/cordova-plugin-advanced-http/src/ios/TextRequestSerializer.m +53 -0
  459. package/demo/plugins/cordova-plugin-advanced-http/src/ios/TextResponseSerializer.h +8 -0
  460. package/demo/plugins/cordova-plugin-advanced-http/src/ios/TextResponseSerializer.m +145 -0
  461. package/demo/plugins/cordova-plugin-androidx/README.md +55 -0
  462. package/demo/plugins/cordova-plugin-androidx/package.json +47 -0
  463. package/demo/plugins/cordova-plugin-androidx/plugin.xml +20 -0
  464. package/demo/plugins/cordova-plugin-androidx/scripts/apply-to-gradle.properties.js +49 -0
  465. package/demo/plugins/cordova-plugin-androidx-adapter/README.md +67 -0
  466. package/demo/plugins/cordova-plugin-androidx-adapter/apply.js +101 -0
  467. package/demo/plugins/cordova-plugin-androidx-adapter/artifact-mappings.json +105 -0
  468. package/demo/plugins/cordova-plugin-androidx-adapter/class-mappings.json +1938 -0
  469. package/demo/plugins/cordova-plugin-androidx-adapter/package.json +43 -0
  470. package/demo/plugins/cordova-plugin-androidx-adapter/plugin.xml +20 -0
  471. package/demo/plugins/cordova-plugin-console/.appveyor.yml +29 -0
  472. package/demo/plugins/cordova-plugin-console/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  473. package/demo/plugins/cordova-plugin-console/.jshintrc +17 -0
  474. package/demo/plugins/cordova-plugin-console/.travis.yml +82 -0
  475. package/demo/plugins/cordova-plugin-console/CONTRIBUTING.md +37 -0
  476. package/demo/plugins/cordova-plugin-console/LICENSE +202 -0
  477. package/demo/plugins/cordova-plugin-console/NOTICE +5 -0
  478. package/demo/plugins/cordova-plugin-console/README.md +116 -0
  479. package/demo/plugins/cordova-plugin-console/RELEASENOTES.md +126 -0
  480. package/demo/plugins/cordova-plugin-console/doc/de/README.md +43 -0
  481. package/demo/plugins/cordova-plugin-console/doc/de/index.md +41 -0
  482. package/demo/plugins/cordova-plugin-console/doc/es/README.md +41 -0
  483. package/demo/plugins/cordova-plugin-console/doc/es/index.md +39 -0
  484. package/demo/plugins/cordova-plugin-console/doc/fr/README.md +41 -0
  485. package/demo/plugins/cordova-plugin-console/doc/fr/index.md +39 -0
  486. package/demo/plugins/cordova-plugin-console/doc/it/README.md +43 -0
  487. package/demo/plugins/cordova-plugin-console/doc/it/index.md +41 -0
  488. package/demo/plugins/cordova-plugin-console/doc/ja/README.md +43 -0
  489. package/demo/plugins/cordova-plugin-console/doc/ja/index.md +41 -0
  490. package/demo/plugins/cordova-plugin-console/doc/ko/README.md +43 -0
  491. package/demo/plugins/cordova-plugin-console/doc/ko/index.md +41 -0
  492. package/demo/plugins/cordova-plugin-console/doc/pl/README.md +43 -0
  493. package/demo/plugins/cordova-plugin-console/doc/pl/index.md +41 -0
  494. package/demo/plugins/cordova-plugin-console/doc/ru/index.md +31 -0
  495. package/demo/plugins/cordova-plugin-console/doc/zh/README.md +43 -0
  496. package/demo/plugins/cordova-plugin-console/doc/zh/index.md +41 -0
  497. package/demo/plugins/cordova-plugin-console/package.json +82 -0
  498. package/demo/plugins/cordova-plugin-console/plugin.xml +132 -0
  499. package/demo/plugins/cordova-plugin-console/src/ios/CDVLogger.h +26 -0
  500. package/demo/plugins/cordova-plugin-console/src/ios/CDVLogger.m +38 -0
  501. package/demo/plugins/cordova-plugin-console/src/ubuntu/console.cpp +29 -0
  502. package/demo/plugins/cordova-plugin-console/src/ubuntu/console.h +43 -0
  503. package/demo/plugins/cordova-plugin-console/src/wp/DebugConsole.cs +47 -0
  504. package/demo/plugins/cordova-plugin-console/tests/package.json +14 -0
  505. package/demo/plugins/cordova-plugin-console/tests/plugin.xml +31 -0
  506. package/demo/plugins/cordova-plugin-console/tests/tests.js +43 -0
  507. package/demo/plugins/cordova-plugin-enable-multidex/.editorconfig +20 -0
  508. package/demo/plugins/cordova-plugin-enable-multidex/.eslintrc.json +11 -0
  509. package/demo/plugins/cordova-plugin-enable-multidex/.prettierrc.json +10 -0
  510. package/demo/plugins/cordova-plugin-enable-multidex/.travis.yml +52 -0
  511. package/demo/plugins/cordova-plugin-enable-multidex/LICENSE +21 -0
  512. package/demo/plugins/cordova-plugin-enable-multidex/README.md +25 -0
  513. package/demo/plugins/cordova-plugin-enable-multidex/package.json +79 -0
  514. package/demo/plugins/cordova-plugin-enable-multidex/plugin.xml +18 -0
  515. package/demo/plugins/cordova-plugin-enable-multidex/scripts/android/editManifest.js +38 -0
  516. package/demo/plugins/cordova-plugin-enable-multidex/src/android/build.gradle +9 -0
  517. package/demo/plugins/cordova-plugin-file/.jshintrc +30 -0
  518. package/demo/plugins/cordova-plugin-file/.ratignore +1 -0
  519. package/demo/plugins/cordova-plugin-file/CONTRIBUTING.md +37 -0
  520. package/demo/plugins/cordova-plugin-file/LICENSE +202 -0
  521. package/demo/plugins/cordova-plugin-file/NOTICE +5 -0
  522. package/demo/plugins/cordova-plugin-file/README.md +833 -0
  523. package/demo/plugins/cordova-plugin-file/RELEASENOTES.md +496 -0
  524. package/demo/plugins/cordova-plugin-file/doc/plugins.md +120 -0
  525. package/demo/plugins/cordova-plugin-file/package.json +86 -0
  526. package/demo/plugins/cordova-plugin-file/plugin.xml +260 -0
  527. package/demo/plugins/cordova-plugin-file/src/android/AssetFilesystem.java +294 -0
  528. package/demo/plugins/cordova-plugin-file/src/android/ContentFilesystem.java +223 -0
  529. package/demo/plugins/cordova-plugin-file/src/android/DirectoryManager.java +134 -0
  530. package/demo/plugins/cordova-plugin-file/src/android/EncodingException.java +29 -0
  531. package/demo/plugins/cordova-plugin-file/src/android/FileExistsException.java +29 -0
  532. package/demo/plugins/cordova-plugin-file/src/android/FileUtils.java +1225 -0
  533. package/demo/plugins/cordova-plugin-file/src/android/Filesystem.java +331 -0
  534. package/demo/plugins/cordova-plugin-file/src/android/InvalidModificationException.java +30 -0
  535. package/demo/plugins/cordova-plugin-file/src/android/LocalFilesystem.java +513 -0
  536. package/demo/plugins/cordova-plugin-file/src/android/LocalFilesystemURL.java +64 -0
  537. package/demo/plugins/cordova-plugin-file/src/android/NoModificationAllowedException.java +29 -0
  538. package/demo/plugins/cordova-plugin-file/src/android/PendingRequests.java +94 -0
  539. package/demo/plugins/cordova-plugin-file/src/android/TypeMismatchException.java +30 -0
  540. package/demo/plugins/cordova-plugin-file/src/android/build-extras.gradle +47 -0
  541. package/demo/plugins/cordova-plugin-file/src/browser/FileProxy.js +1059 -0
  542. package/demo/plugins/cordova-plugin-file/src/ios/CDVAssetLibraryFilesystem.h +30 -0
  543. package/demo/plugins/cordova-plugin-file/src/ios/CDVAssetLibraryFilesystem.m +253 -0
  544. package/demo/plugins/cordova-plugin-file/src/ios/CDVFile.h +157 -0
  545. package/demo/plugins/cordova-plugin-file/src/ios/CDVFile.m +1119 -0
  546. package/demo/plugins/cordova-plugin-file/src/ios/CDVLocalFilesystem.h +32 -0
  547. package/demo/plugins/cordova-plugin-file/src/ios/CDVLocalFilesystem.m +750 -0
  548. package/demo/plugins/cordova-plugin-file/src/osx/CDVFile.h +189 -0
  549. package/demo/plugins/cordova-plugin-file/src/osx/CDVFile.m +1056 -0
  550. package/demo/plugins/cordova-plugin-file/src/osx/CDVLocalFilesystem.h +32 -0
  551. package/demo/plugins/cordova-plugin-file/src/osx/CDVLocalFilesystem.m +733 -0
  552. package/demo/plugins/cordova-plugin-file/src/windows/FileProxy.js +1190 -0
  553. package/demo/plugins/cordova-plugin-file/tests/package.json +17 -0
  554. package/demo/plugins/cordova-plugin-file/tests/plugin.xml +43 -0
  555. package/demo/plugins/cordova-plugin-file/tests/src/android/TestContentProvider.java +93 -0
  556. package/demo/plugins/cordova-plugin-file/tests/tests.js +4163 -0
  557. package/demo/plugins/cordova-plugin-file/types/index.d.ts +378 -0
  558. package/demo/plugins/cordova-plugin-qr-barcode-scanner/.editorconfig +16 -0
  559. package/demo/plugins/cordova-plugin-qr-barcode-scanner/.github/CONTRIBUTING.md +72 -0
  560. package/demo/plugins/cordova-plugin-qr-barcode-scanner/.github/ISSUE_TEMPLATE.md +24 -0
  561. package/demo/plugins/cordova-plugin-qr-barcode-scanner/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  562. package/demo/plugins/cordova-plugin-qr-barcode-scanner/.github/lock.yml +25 -0
  563. package/demo/plugins/cordova-plugin-qr-barcode-scanner/.github/stale.yml +20 -0
  564. package/demo/plugins/cordova-plugin-qr-barcode-scanner/.travis.yml +11 -0
  565. package/demo/plugins/cordova-plugin-qr-barcode-scanner/CHANGELOG.md +448 -0
  566. package/demo/plugins/cordova-plugin-qr-barcode-scanner/LICENSE.txt +22 -0
  567. package/demo/plugins/cordova-plugin-qr-barcode-scanner/README.md +197 -0
  568. package/demo/plugins/cordova-plugin-qr-barcode-scanner/buttons.psd +0 -0
  569. package/demo/plugins/cordova-plugin-qr-barcode-scanner/hooks/windows/check-arch.js +52 -0
  570. package/demo/plugins/cordova-plugin-qr-barcode-scanner/package.json +89 -0
  571. package/demo/plugins/cordova-plugin-qr-barcode-scanner/plugin.xml +74 -0
  572. package/demo/plugins/cordova-plugin-qr-barcode-scanner/spec/helper/cordova.js +83 -0
  573. package/demo/plugins/cordova-plugin-qr-barcode-scanner/spec/index.spec.js +78 -0
  574. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/README.md +1 -0
  575. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/AndroidManifest.xml +14 -0
  576. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/R.txt +1398 -0
  577. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/aapt/AndroidManifest.xml +14 -0
  578. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html/apache-license.txt +201 -0
  579. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-de/about1d.html +15 -0
  580. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-de/about2d.html +28 -0
  581. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-de/index.html +23 -0
  582. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-de/license.html +30 -0
  583. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-de/scanning.html +19 -0
  584. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-de/sharing.html +14 -0
  585. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-de/whatsnew.html +14 -0
  586. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-en/about1d.html +15 -0
  587. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-en/about2d.html +28 -0
  588. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-en/index.html +23 -0
  589. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-en/license.html +42 -0
  590. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-en/scanning.html +19 -0
  591. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-en/sharing.html +14 -0
  592. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-en/whatsnew.html +14 -0
  593. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-es/about1d.html +18 -0
  594. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-es/about2d.html +30 -0
  595. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-es/index.html +24 -0
  596. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-es/license.html +39 -0
  597. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-es/scanning.html +18 -0
  598. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-es/sharing.html +13 -0
  599. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-es/whatsnew.html +14 -0
  600. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-fr/about1d.html +15 -0
  601. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-fr/about2d.html +26 -0
  602. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-fr/index.html +23 -0
  603. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-fr/license.html +30 -0
  604. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-fr/scanning.html +19 -0
  605. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-fr/sharing.html +14 -0
  606. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-fr/whatsnew.html +14 -0
  607. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-it/about1d.html +15 -0
  608. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-it/about2d.html +28 -0
  609. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-it/index.html +23 -0
  610. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-it/license.html +30 -0
  611. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-it/scanning.html +19 -0
  612. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-it/sharing.html +14 -0
  613. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-it/whatsnew.html +14 -0
  614. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ja/about1d.html +15 -0
  615. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ja/about2d.html +28 -0
  616. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ja/index.html +22 -0
  617. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ja/license.html +29 -0
  618. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ja/scanning.html +19 -0
  619. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ja/sharing.html +14 -0
  620. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ja/whatsnew.html +14 -0
  621. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ko/about1d.html +15 -0
  622. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ko/about2d.html +28 -0
  623. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ko/index.html +23 -0
  624. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ko/license.html +30 -0
  625. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ko/scanning.html +19 -0
  626. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ko/sharing.html +14 -0
  627. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ko/whatsnew.html +14 -0
  628. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-nl/about1d.html +15 -0
  629. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-nl/about2d.html +28 -0
  630. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-nl/index.html +23 -0
  631. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-nl/license.html +30 -0
  632. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-nl/scanning.html +19 -0
  633. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-nl/sharing.html +14 -0
  634. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-nl/whatsnew.html +14 -0
  635. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-pt/about1d.html +15 -0
  636. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-pt/about2d.html +28 -0
  637. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-pt/index.html +23 -0
  638. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-pt/license.html +30 -0
  639. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-pt/scanning.html +19 -0
  640. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-pt/sharing.html +14 -0
  641. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-pt/whatsnew.html +14 -0
  642. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ru/about1d.html +15 -0
  643. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ru/about2d.html +28 -0
  644. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ru/index.html +23 -0
  645. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ru/license.html +30 -0
  646. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ru/scanning.html +19 -0
  647. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ru/sharing.html +14 -0
  648. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-ru/whatsnew.html +14 -0
  649. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-uk/about1d.html +15 -0
  650. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-uk/about2d.html +28 -0
  651. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-uk/index.html +23 -0
  652. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-uk/license.html +29 -0
  653. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-uk/scanning.html +19 -0
  654. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-uk/sharing.html +14 -0
  655. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-uk/whatsnew.html +14 -0
  656. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rCN/about1d.html +15 -0
  657. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rCN/about2d.html +29 -0
  658. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rCN/index.html +23 -0
  659. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rCN/license.html +30 -0
  660. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rCN/scanning.html +19 -0
  661. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rCN/sharing.html +13 -0
  662. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rCN/whatsnew.html +14 -0
  663. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rHK/about1d.html +15 -0
  664. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rHK/about2d.html +28 -0
  665. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rHK/index.html +23 -0
  666. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rHK/license.html +31 -0
  667. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rHK/scanning.html +21 -0
  668. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rHK/sharing.html +14 -0
  669. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rHK/whatsnew.html +14 -0
  670. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rTW/about1d.html +15 -0
  671. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rTW/about2d.html +28 -0
  672. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rTW/index.html +23 -0
  673. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rTW/license.html +31 -0
  674. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rTW/scanning.html +21 -0
  675. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rTW/sharing.html +14 -0
  676. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/html-zh-rTW/whatsnew.html +14 -0
  677. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/big-1d.png +0 -0
  678. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/big-aztec.png +0 -0
  679. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/big-datamatrix.png +0 -0
  680. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/big-pdf417.png +0 -0
  681. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/big-qr.png +0 -0
  682. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/contact-results-screen.jpg +0 -0
  683. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/demo-no.png +0 -0
  684. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/demo-yes.png +0 -0
  685. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/scan-example.png +0 -0
  686. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/scan-from-phone.png +0 -0
  687. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/images/search-book-contents.jpg +0 -0
  688. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/assets/style.css +28 -0
  689. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/classes.jar +0 -0
  690. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/drawable/flip_camera.png +0 -0
  691. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/drawable/launcher_icon.png +0 -0
  692. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/drawable/share_via_barcode.png +0 -0
  693. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/drawable/toggle_torch.png +0 -0
  694. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/drawable-hdpi/launcher_icon.png +0 -0
  695. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/drawable-xhdpi/launcher_icon.png +0 -0
  696. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/drawable-xxhdpi/launcher_icon.png +0 -0
  697. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout/app_picker_list_item.xml +39 -0
  698. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout/bookmark_picker_list_item.xml +39 -0
  699. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout/capture.xml +229 -0
  700. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout/encode.xml +54 -0
  701. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout/help.xml +21 -0
  702. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout/history_list_item.xml +38 -0
  703. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout/search_book_contents.xml +55 -0
  704. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout/search_book_contents_header.xml +25 -0
  705. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout/search_book_contents_list_item.xml +41 -0
  706. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout/share.xml +95 -0
  707. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout-land/encode.xml +53 -0
  708. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout-land/share.xml +91 -0
  709. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/layout-ldpi/capture.xml +219 -0
  710. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/menu/capture.xml +38 -0
  711. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/menu/encode.xml +28 -0
  712. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/menu/history.xml +28 -0
  713. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/raw/beep.ogg +0 -0
  714. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values/values.xml +221 -0
  715. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-ar/values-ar.xml +129 -0
  716. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-bg/values-bg.xml +129 -0
  717. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-ca/values-ca.xml +129 -0
  718. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-cs/values-cs.xml +129 -0
  719. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-da/values-da.xml +129 -0
  720. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-de/values-de.xml +129 -0
  721. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-el/values-el.xml +129 -0
  722. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-es/values-es.xml +129 -0
  723. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-eu/values-eu.xml +129 -0
  724. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-fi/values-fi.xml +129 -0
  725. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-fr/values-fr.xml +129 -0
  726. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-he/values-he.xml +129 -0
  727. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-hi/values-hi.xml +129 -0
  728. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-hu/values-hu.xml +129 -0
  729. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-id/values-id.xml +129 -0
  730. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-it/values-it.xml +129 -0
  731. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-iw/values-iw.xml +129 -0
  732. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-ja/values-ja.xml +129 -0
  733. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-ko/values-ko.xml +129 -0
  734. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-nl/values-nl.xml +129 -0
  735. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-pl/values-pl.xml +129 -0
  736. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-pt/values-pt.xml +129 -0
  737. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-ro/values-ro.xml +129 -0
  738. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-ru/values-ru.xml +129 -0
  739. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-sk/values-sk.xml +129 -0
  740. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-sl/values-sl.xml +129 -0
  741. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-sv/values-sv.xml +129 -0
  742. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-th/values-th.xml +129 -0
  743. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-tr/values-tr.xml +129 -0
  744. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-uk/values-uk.xml +129 -0
  745. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-zh-rCN/values-zh-rCN.xml +129 -0
  746. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-zh-rHK/values-zh-rHK.xml +129 -0
  747. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/values-zh-rTW/values-zh-rTW.xml +129 -0
  748. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5/res/xml/preferences.xml +136 -0
  749. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner-release-2.1.5.aar +0 -0
  750. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/barcodescanner.gradle +17 -0
  751. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/android/com/phonegap/plugins/barcodescanner/BarcodeScanner.java +328 -0
  752. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/browser/BarcodeScannerProxy.js +24 -0
  753. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/ios/CDVBarcodeScanner.bundle/beep.caf +0 -0
  754. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/ios/CDVBarcodeScanner.bundle/torch.png +0 -0
  755. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/ios/CDVBarcodeScanner.bundle/torch@2x.png +0 -0
  756. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/ios/CDVBarcodeScanner.bundle/torch@3x.png +0 -0
  757. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/ios/CDVBarcodeScanner.mm +1067 -0
  758. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/ios/scannerOverlay.xib +185 -0
  759. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/windows/BarcodeScannerProxy.js +738 -0
  760. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/windows/assets/plugin-barcodeScanner.css +89 -0
  761. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/windows/lib/Properties/AssemblyInfo.cs +39 -0
  762. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/windows/lib/Reader.cs +173 -0
  763. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/windows/lib/WinRTBarcodeReader.csproj +137 -0
  764. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/windows/lib/ZXing.winmd +0 -0
  765. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/windows/lib.UW/ANY/ZXing.winmd +0 -0
  766. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/windows/lib.UW/ARM/ZXing.winmd +0 -0
  767. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/windows/lib.UW/x64/ZXing.winmd +0 -0
  768. package/demo/plugins/cordova-plugin-qr-barcode-scanner/src/windows/lib.UW/x86/ZXing.winmd +0 -0
  769. package/demo/plugins/cordova-plugin-timer/.appveyor.yml +28 -0
  770. package/demo/plugins/cordova-plugin-timer/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  771. package/demo/plugins/cordova-plugin-timer/.jshintignore +1 -0
  772. package/demo/plugins/cordova-plugin-timer/.jshintrc +16 -0
  773. package/demo/plugins/cordova-plugin-timer/.travis.yml +98 -0
  774. package/demo/plugins/cordova-plugin-timer/LICENSE +204 -0
  775. package/demo/plugins/cordova-plugin-timer/README.md +88 -0
  776. package/demo/plugins/cordova-plugin-timer/RELEASENOTES.md +0 -0
  777. package/demo/plugins/cordova-plugin-timer/package.json +87 -0
  778. package/demo/plugins/cordova-plugin-timer/plugin.xml +68 -0
  779. package/demo/plugins/cordova-plugin-timer/src/android/Consumer.java +22 -0
  780. package/demo/plugins/cordova-plugin-timer/src/android/NativeTimerAdapter.java +27 -0
  781. package/demo/plugins/cordova-plugin-timer/src/android/NativeTimerAdapterImpl.java +123 -0
  782. package/demo/plugins/cordova-plugin-timer/src/android/NativeTimerPlugin.java +163 -0
  783. package/demo/plugins/cordova-plugin-timer/src/ios/NativeTimerAdapter.h +35 -0
  784. package/demo/plugins/cordova-plugin-timer/src/ios/NativeTimerAdapter.m +76 -0
  785. package/demo/plugins/cordova-plugin-timer/src/ios/NativeTimerPlugin.h +28 -0
  786. package/demo/plugins/cordova-plugin-timer/src/ios/NativeTimerPlugin.m +158 -0
  787. package/demo/plugins/cordova-plugin-timer/types/index.d.ts +21 -0
  788. package/demo/plugins/cordova-plugin-whitelist/CONTRIBUTING.md +37 -0
  789. package/demo/plugins/cordova-plugin-whitelist/LICENSE +202 -0
  790. package/demo/plugins/cordova-plugin-whitelist/NOTICE +5 -0
  791. package/demo/plugins/cordova-plugin-whitelist/README.md +167 -0
  792. package/demo/plugins/cordova-plugin-whitelist/RELEASENOTES.md +87 -0
  793. package/demo/plugins/cordova-plugin-whitelist/package.json +70 -0
  794. package/demo/plugins/cordova-plugin-whitelist/plugin.xml +44 -0
  795. package/demo/plugins/cordova-plugin-whitelist/src/android/WhitelistPlugin.java +161 -0
  796. package/demo/plugins/cordova-plugin-whitelist/tests/README.md +53 -0
  797. package/demo/plugins/cordova-plugin-whitelist/tests/package.json +15 -0
  798. package/demo/plugins/cordova-plugin-whitelist/tests/plugin.xml +56 -0
  799. package/demo/plugins/cordova-plugin-whitelist/tests/scripts/remove-access.js +19 -0
  800. package/demo/plugins/cordova-plugin-whitelist/tests/src/android/WhitelistAPI.java +90 -0
  801. package/demo/plugins/cordova-plugin-whitelist/tests/tests.js +214 -0
  802. package/demo/plugins/cordova-plugin-wkwebview-engine/CONTRIBUTING.md +32 -0
  803. package/demo/plugins/cordova-plugin-wkwebview-engine/LICENSE +202 -0
  804. package/demo/plugins/cordova-plugin-wkwebview-engine/NOTICE +5 -0
  805. package/demo/plugins/cordova-plugin-wkwebview-engine/README.md +123 -0
  806. package/demo/plugins/cordova-plugin-wkwebview-engine/RELEASENOTES.md +121 -0
  807. package/demo/plugins/cordova-plugin-wkwebview-engine/package.json +72 -0
  808. package/demo/plugins/cordova-plugin-wkwebview-engine/plugin.xml +63 -0
  809. package/demo/plugins/cordova-plugin-wkwebview-engine/src/ios/CDVWKProcessPoolFactory.h +27 -0
  810. package/demo/plugins/cordova-plugin-wkwebview-engine/src/ios/CDVWKProcessPoolFactory.m +49 -0
  811. package/demo/plugins/cordova-plugin-wkwebview-engine/src/ios/CDVWKWebViewEngine.h +29 -0
  812. package/demo/plugins/cordova-plugin-wkwebview-engine/src/ios/CDVWKWebViewEngine.m +494 -0
  813. package/demo/plugins/cordova-plugin-wkwebview-engine/src/ios/CDVWKWebViewUIDelegate.h +28 -0
  814. package/demo/plugins/cordova-plugin-wkwebview-engine/src/ios/CDVWKWebViewUIDelegate.m +123 -0
  815. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/CDVWKWebViewEngineTest/CDVWKWebViewEngineLibTests/CDVWKWebViewEngineTest.m +240 -0
  816. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/CDVWKWebViewEngineTest/CDVWKWebViewEngineLibTests/Info.plist +24 -0
  817. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/CDVWKWebViewEngineTest/CDVWKWebViewEngineTest.xcodeproj/project.pbxproj +559 -0
  818. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/CDVWKWebViewEngineTest/CDVWKWebViewEngineTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  819. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/CDVWKWebViewEngineTest/CDVWKWebViewEngineTest.xcodeproj/project.xcworkspace/xcshareddata/CDVWKWebViewEngineTest.xccheckout +41 -0
  820. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/CDVWKWebViewEngineTest/CDVWKWebViewEngineTest.xcodeproj/xcshareddata/xcschemes/CDVWKWebViewEngineLib.xcscheme +80 -0
  821. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/CDVWKWebViewEngineTest/CDVWKWebViewEngineTest.xcodeproj/xcshareddata/xcschemes/CDVWKWebViewEngineLibTests.xcscheme +104 -0
  822. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/CDVWKWebViewEngineTest.xcworkspace/contents.xcworkspacedata +7 -0
  823. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/CDVWKWebViewEngineTest.xcworkspace/xcshareddata/CDVWKWebViewEngineTest.xccheckout +41 -0
  824. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/CDVWKWebViewEngineTest.xcworkspace/xcshareddata/xcschemes/CordovaLib.xcscheme +80 -0
  825. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/README.md +40 -0
  826. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/package.json +13 -0
  827. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/ios/test.xcconfig +20 -0
  828. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/package.json +14 -0
  829. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/plugin.xml +29 -0
  830. package/demo/plugins/cordova-plugin-wkwebview-engine/tests/tests.js +44 -0
  831. package/demo/plugins/ios.json +46 -0
  832. package/dist/SNSMobileSDK.js +1 -0
  833. package/package.json +48 -0
  834. package/plugin.xml +82 -0
  835. package/src/android/build-extras.gradle +22 -0
  836. package/src/android/build.gradle +54 -0
  837. package/src/android/dependencies.gradle +122 -0
  838. package/src/android/gradlew +172 -0
  839. package/src/android/gradlew.bat +84 -0
  840. package/src/android/src/main/java/com/sumsub/msdk/plugins/cordova/SNSMobileSdkCordovaPlugin.java +339 -0
  841. package/src/ios/SNSMobileSdkCordovaPlugin.h +12 -0
  842. package/src/ios/SNSMobileSdkCordovaPlugin.m +263 -0
  843. package/webpack.config.js +42 -0
@@ -0,0 +1,4163 @@
1
+ /*
2
+ *
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ *
19
+ */
20
+
21
+ /* eslint-env jasmine */
22
+ /* global WebKitBlobBuilder */
23
+
24
+ exports.defineAutoTests = function () {
25
+ /* eslint-disable no-undef */
26
+ var isBrowser = (cordova.platformId === 'browser');
27
+ // Use feature detection to determine current browser instead of checking user-agent
28
+ var isChrome = isBrowser && window.webkitRequestFileSystem && window.webkitResolveLocalFileSystemURL;
29
+ var isIE = isBrowser && (window.msIndexedDB);
30
+ var isIndexedDBShim = isBrowser && !isChrome; // Firefox and IE for example
31
+
32
+ var isWindows = (cordova.platformId === 'windows' || cordova.platformId === 'windows8');
33
+ /* eslint-enable no-undef */
34
+ var MEDIUM_TIMEOUT = 15000;
35
+
36
+ describe('File API', function () {
37
+ // Adding a Jasmine helper matcher, to report errors when comparing to FileError better.
38
+ var fileErrorMap = {
39
+ 1: 'NOT_FOUND_ERR',
40
+ 2: 'SECURITY_ERR',
41
+ 3: 'ABORT_ERR',
42
+ 4: 'NOT_READABLE_ERR',
43
+ 5: 'ENCODING_ERR',
44
+ 6: 'NO_MODIFICATION_ALLOWED_ERR',
45
+ 7: 'INVALID_STATE_ERR',
46
+ 8: 'SYNTAX_ERR',
47
+ 9: 'INVALID_MODIFICATION_ERR',
48
+ 10: 'QUOTA_EXCEEDED_ERR',
49
+ 11: 'TYPE_MISMATCH_ERR',
50
+ 12: 'PATH_EXISTS_ERR'
51
+ };
52
+ var root;
53
+ var temp_root;
54
+ var persistent_root;
55
+ beforeEach(function (done) {
56
+ // Custom Matchers
57
+ jasmine.Expectation.addMatchers({
58
+ toBeFileError: function () {
59
+ return {
60
+ compare: function (error, code) {
61
+ var pass = error.code === code;
62
+ return {
63
+ pass: pass,
64
+ message: 'Expected FileError with code ' + fileErrorMap[error.code] + ' (' + error.code + ') to be ' + fileErrorMap[code] + '(' + code + ')'
65
+ };
66
+ }
67
+ };
68
+ },
69
+ toCanonicallyMatch: function () {
70
+ return {
71
+ compare: function (currentPath, path) {
72
+ var a = path.split('/').join('').split('\\').join('');
73
+ var b = currentPath.split('/').join('').split('\\').join('');
74
+ var pass = a === b;
75
+ return {
76
+ pass: pass,
77
+ message: 'Expected paths to match : ' + path + ' should be ' + currentPath
78
+ };
79
+ }
80
+ };
81
+ },
82
+ toFailWithMessage: function () {
83
+ return {
84
+ compare: function (error, message) { // eslint-disable-line handle-callback-err
85
+ var pass = false;
86
+ return {
87
+ pass: pass,
88
+ message: message
89
+ };
90
+ }
91
+ };
92
+ },
93
+ toBeDataUrl: function () {
94
+ return {
95
+ compare: function (url) {
96
+ var pass = false;
97
+ // "data:application/octet-stream;base64,"
98
+ var header = url.substr(0, url.indexOf(','));
99
+ var headerParts = header.split(/[:;]/);
100
+ if (headerParts.length === 3 &&
101
+ headerParts[0] === 'data' &&
102
+ headerParts[2] === 'base64') {
103
+ pass = true;
104
+ }
105
+ var message = 'Expected ' + url + ' to be a valid data url. ' + header + ' is not valid header for data uris';
106
+ return {
107
+ pass: pass,
108
+ message: message
109
+ };
110
+ }
111
+ };
112
+ }
113
+ });
114
+ // Define global variables
115
+ var onError = function (e) {
116
+ console.log('[ERROR] Problem setting up root filesystem for test running! Error to follow.');
117
+ console.log(JSON.stringify(e));
118
+ };
119
+ window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) { // eslint-disable-line no-undef
120
+ root = fileSystem.root;
121
+ // set in file.tests.js
122
+ persistent_root = root;
123
+ window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, function (fileSystem) { // eslint-disable-line no-undef
124
+ temp_root = fileSystem.root;
125
+ // set in file.tests.js
126
+ done();
127
+ }, onError);
128
+ }, onError);
129
+ });
130
+ // HELPER FUNCTIONS
131
+ // deletes specified file or directory
132
+ var deleteEntry = function (name, success, error) {
133
+ // deletes entry, if it exists
134
+ // entry.remove success callback is required: http://www.w3.org/TR/2011/WD-file-system-api-20110419/#the-entry-interface
135
+ success = success || function () {};
136
+ error = error || failed.bind(null, success, 'deleteEntry failed.');
137
+
138
+ window.resolveLocalFileSystemURL(root.toURL() + '/' + name, function (entry) {
139
+ if (entry.isDirectory === true) {
140
+ entry.removeRecursively(success, error);
141
+ } else {
142
+ entry.remove(success, error);
143
+ }
144
+ }, success);
145
+ };
146
+ // deletes file, if it exists, then invokes callback
147
+ var deleteFile = function (fileName, callback) {
148
+ // entry.remove success callback is required: http://www.w3.org/TR/2011/WD-file-system-api-20110419/#the-entry-interface
149
+ callback = callback || function () {};
150
+
151
+ root.getFile(fileName, null, // remove file system entry
152
+ function (entry) {
153
+ entry.remove(callback, function () {
154
+ console.log('[ERROR] deleteFile cleanup method invoked fail callback.');
155
+ });
156
+ }, // doesn't exist
157
+ callback);
158
+ };
159
+ // deletes and re-creates the specified file
160
+ var createFile = function (fileName, success, error) {
161
+ deleteEntry(fileName, function () {
162
+ root.getFile(fileName, {
163
+ create: true
164
+ }, success, error);
165
+ }, error);
166
+ };
167
+ // deletes and re-creates the specified directory
168
+ var createDirectory = function (dirName, success, error) {
169
+ deleteEntry(dirName, function () {
170
+ root.getDirectory(dirName, {
171
+ create: true
172
+ }, success, error);
173
+ }, error);
174
+ };
175
+ function failed (done, msg, error) {
176
+ var info = typeof msg === 'undefined' ? 'Unexpected error callback' : msg;
177
+ var codeMsg = (error && error.code) ? (': ' + fileErrorMap[error.code]) : '';
178
+ expect(true).toFailWithMessage(info + '\n' + JSON.stringify(error) + codeMsg);
179
+ done();
180
+ }
181
+ var succeed = function (done, msg) {
182
+ var info = typeof msg === 'undefined' ? 'Unexpected success callback' : msg;
183
+ expect(true).toFailWithMessage(info);
184
+ done();
185
+ };
186
+ var joinURL = function (base, extension) {
187
+ if (base.charAt(base.length - 1) !== '/' && extension.charAt(0) !== '/') {
188
+ return base + '/' + extension;
189
+ }
190
+ if (base.charAt(base.length - 1) === '/' && extension.charAt(0) === '/') {
191
+ return base + extension.substring(1);
192
+ }
193
+ return base + extension;
194
+ };
195
+ describe('FileError object', function () {
196
+ /* eslint-disable no-undef */
197
+ it('file.spec.1 should define FileError constants', function () {
198
+ expect(FileError.NOT_FOUND_ERR).toBe(1);
199
+ expect(FileError.SECURITY_ERR).toBe(2);
200
+ expect(FileError.ABORT_ERR).toBe(3);
201
+ expect(FileError.NOT_READABLE_ERR).toBe(4);
202
+ expect(FileError.ENCODING_ERR).toBe(5);
203
+ expect(FileError.NO_MODIFICATION_ALLOWED_ERR).toBe(6);
204
+ expect(FileError.INVALID_STATE_ERR).toBe(7);
205
+ expect(FileError.SYNTAX_ERR).toBe(8);
206
+ expect(FileError.INVALID_MODIFICATION_ERR).toBe(9);
207
+ expect(FileError.QUOTA_EXCEEDED_ERR).toBe(10);
208
+ expect(FileError.TYPE_MISMATCH_ERR).toBe(11);
209
+ expect(FileError.PATH_EXISTS_ERR).toBe(12);
210
+ });
211
+ });
212
+ describe('LocalFileSystem', function () {
213
+ it('file.spec.2 should define LocalFileSystem constants', function () {
214
+ expect(LocalFileSystem.TEMPORARY).toBe(0);
215
+ expect(LocalFileSystem.PERSISTENT).toBe(1);
216
+ /* eslint-enable no-undef */
217
+ });
218
+ describe('window.requestFileSystem', function () {
219
+ it('file.spec.3 should be defined', function () {
220
+ expect(window.requestFileSystem).toBeDefined();
221
+ });
222
+ it('file.spec.4 should be able to retrieve a PERSISTENT file system', function (done) {
223
+ var win = function (fileSystem) {
224
+ expect(fileSystem).toBeDefined();
225
+ expect(fileSystem.name).toBeDefined();
226
+ if (isChrome) {
227
+ expect(fileSystem.name).toContain('Persistent');
228
+ } else {
229
+ expect(fileSystem.name).toBe('persistent');
230
+ }
231
+ expect(fileSystem.root).toBeDefined();
232
+ expect(fileSystem.root.filesystem).toBeDefined();
233
+ // Shouldn't use cdvfile by default.
234
+ expect(fileSystem.root.toURL()).not.toMatch(/^cdvfile:/);
235
+ // All DirectoryEntry URLs should always have a trailing slash.
236
+ expect(fileSystem.root.toURL()).toMatch(/\/$/);
237
+ done();
238
+ };
239
+
240
+ // Request a little bit of space on the filesystem, unless we're running in a browser where that could cause a prompt.
241
+ var spaceRequired = isBrowser ? 0 : 1024;
242
+
243
+ // retrieve PERSISTENT file system
244
+ window.requestFileSystem(LocalFileSystem.PERSISTENT, spaceRequired, win, failed.bind(null, done, 'window.requestFileSystem - Error retrieving PERSISTENT file system')); // eslint-disable-line no-undef
245
+ });
246
+ it('file.spec.5 should be able to retrieve a TEMPORARY file system', function (done) {
247
+ var win = function (fileSystem) {
248
+ expect(fileSystem).toBeDefined();
249
+ if (isChrome) {
250
+ expect(fileSystem.name).toContain('Temporary');
251
+ } else {
252
+ expect(fileSystem.name).toBe('temporary');
253
+ }
254
+ expect(fileSystem.root).toBeDefined();
255
+ expect(fileSystem.root.filesystem).toBeDefined();
256
+ expect(fileSystem.root.filesystem).toBe(fileSystem);
257
+ done();
258
+ };
259
+ // retrieve TEMPORARY file system
260
+ window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, win, failed.bind(null, done, 'window.requestFileSystem - Error retrieving TEMPORARY file system')); // eslint-disable-line no-undef
261
+ });
262
+ it('file.spec.6 should error if you request a file system that is too large', function (done) {
263
+ if (isBrowser) {
264
+ /* window.requestFileSystem TEMPORARY and PERSISTENT filesystem quota is not limited in Chrome.
265
+ Firefox filesystem size is not limited but every 50MB request user permission.
266
+ IE10 allows up to 10mb of combined AppCache and IndexedDB used in implementation
267
+ of filesystem without prompting, once you hit that level you will be asked if you
268
+ want to allow it to be increased up to a max of 250mb per site.
269
+ So `size` parameter for `requestFileSystem` function does not affect on filesystem in Firefox and IE. */
270
+ pending();
271
+ }
272
+
273
+ var fail = function (error) {
274
+ expect(error).toBeDefined();
275
+ expect(error).toBeFileError(FileError.QUOTA_EXCEEDED_ERR); // eslint-disable-line no-undef
276
+ done();
277
+ };
278
+ // win = createWin('window.requestFileSystem');
279
+ // Request the file system
280
+ window.requestFileSystem(LocalFileSystem.TEMPORARY, 1000000000000000, failed.bind(null, done, 'window.requestFileSystem - Error retrieving TEMPORARY file system'), fail); // eslint-disable-line no-undef
281
+ });
282
+ it('file.spec.7 should error out if you request a file system that does not exist', function (done) {
283
+
284
+ var fail = function (error) {
285
+ expect(error).toBeDefined();
286
+ if (isChrome) {
287
+ /* INVALID_MODIFICATION_ERR (code: 9) or ??? (code: 13) is thrown instead of SYNTAX_ERR(code: 8)
288
+ on requesting of a non-existant filesystem. */
289
+ // expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR);
290
+ } else {
291
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
292
+ }
293
+ done();
294
+ };
295
+ // Request the file system
296
+ window.requestFileSystem(-1, 0, succeed.bind(null, done, 'window.requestFileSystem'), fail);
297
+ });
298
+ });
299
+ describe('window.resolveLocalFileSystemURL', function () {
300
+ it('file.spec.8 should be defined', function () {
301
+ expect(window.resolveLocalFileSystemURL).toBeDefined();
302
+ });
303
+ it('file.spec.9 should resolve a valid file name', function (done) {
304
+ var fileName = 'file.spec.9';
305
+ var win = function (fileEntry) {
306
+ expect(fileEntry).toBeDefined();
307
+ expect(fileEntry.isFile).toBe(true);
308
+ expect(fileEntry.isDirectory).toBe(false);
309
+ expect(fileEntry.name).toCanonicallyMatch(fileName);
310
+ expect(fileEntry.toURL()).not.toMatch(/^cdvfile:/, 'should not use cdvfile URL');
311
+ expect(fileEntry.toURL()).not.toMatch(/\/$/, 'URL should not end with a slash');
312
+ // Clean-up
313
+ deleteEntry(fileName, done);
314
+ };
315
+ createFile(fileName, function (entry) {
316
+ window.resolveLocalFileSystemURL(entry.toURL(), win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - Error resolving file URL: ' + entry.toURL()));
317
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName), failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
318
+ });
319
+ it('file.spec.9.1 should resolve a file even with a terminating slash', function (done) {
320
+ var fileName = 'file.spec.9.1';
321
+ var win = function (fileEntry) {
322
+ expect(fileEntry).toBeDefined();
323
+ expect(fileEntry.isFile).toBe(true);
324
+ expect(fileEntry.isDirectory).toBe(false);
325
+ expect(fileEntry.name).toCanonicallyMatch(fileName);
326
+ expect(fileEntry.toURL()).not.toMatch(/^cdvfile:/, 'should not use cdvfile URL');
327
+ expect(fileEntry.toURL()).not.toMatch(/\/$/, 'URL should not end with a slash');
328
+ // Clean-up
329
+ deleteEntry(fileName, done);
330
+ };
331
+ createFile(fileName, function (entry) {
332
+ var entryURL = entry.toURL() + '/';
333
+ window.resolveLocalFileSystemURL(entryURL, win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - Error resolving file URL: ' + entryURL));
334
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName), failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
335
+ });
336
+ it('file.spec.9.5 should resolve a directory', function (done) {
337
+ var fileName = 'file.spec.9.5';
338
+ var win = function (fileEntry) {
339
+ expect(fileEntry).toBeDefined();
340
+ expect(fileEntry.isFile).toBe(false);
341
+ expect(fileEntry.isDirectory).toBe(true);
342
+ expect(fileEntry.name).toCanonicallyMatch(fileName);
343
+ expect(fileEntry.toURL()).not.toMatch(/^cdvfile:/, 'should not use cdvfile URL');
344
+ expect(fileEntry.toURL()).toMatch(/\/$/, 'URL end with a slash');
345
+ // cleanup
346
+ deleteEntry(fileName, done);
347
+ };
348
+ function gotDirectory (entry) {
349
+ // lookup file system entry
350
+ window.resolveLocalFileSystemURL(entry.toURL(), win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - Error resolving directory URL: ' + entry.toURL()));
351
+ }
352
+ createDirectory(fileName, gotDirectory, failed.bind(null, done, 'createDirectory - Error creating directory: ' + fileName), failed.bind(null, done, 'createDirectory - Error creating directory: ' + fileName));
353
+ });
354
+ it('file.spec.9.6 should resolve a directory even without a terminating slash', function (done) {
355
+ var fileName = 'file.spec.9.6';
356
+ var win = function (fileEntry) {
357
+ expect(fileEntry).toBeDefined();
358
+ expect(fileEntry.isFile).toBe(false);
359
+ expect(fileEntry.isDirectory).toBe(true);
360
+ expect(fileEntry.name).toCanonicallyMatch(fileName);
361
+ expect(fileEntry.toURL()).not.toMatch(/^cdvfile:/, 'should not use cdvfile URL');
362
+ expect(fileEntry.toURL()).toMatch(/\/$/, 'URL end with a slash');
363
+ // cleanup
364
+ deleteEntry(fileName, done);
365
+ };
366
+ function gotDirectory (entry) {
367
+ // lookup file system entry
368
+ var entryURL = entry.toURL();
369
+ entryURL = entryURL.substring(0, entryURL.length - 1);
370
+ window.resolveLocalFileSystemURL(entryURL, win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - Error resolving directory URL: ' + entryURL));
371
+ }
372
+ createDirectory(fileName, gotDirectory, failed.bind(null, done, 'createDirectory - Error creating directory: ' + fileName), failed.bind(null, done, 'createDirectory - Error creating directory: ' + fileName));
373
+ });
374
+
375
+ it('file.spec.9.7 should resolve a file with valid nativeURL', function (done) {
376
+ if (isBrowser) {
377
+ pending('browsers doesn\'t return nativeURL');
378
+ }
379
+ var fileName = 'de.create.file';
380
+ var win = function (entry) {
381
+ var path = entry.nativeURL.split('///')[1];
382
+ expect(/\/{2,}/.test(path)).toBeFalsy();
383
+ // cleanup
384
+ deleteEntry(entry.name, done);
385
+ };
386
+ root.getFile(fileName, {
387
+ create: true
388
+ }, win, succeed.bind(null, done, 'root.getFile - Error unexpected callback, file should not exists: ' + fileName));
389
+ });
390
+
391
+ it('file.spec.10 resolve valid file name with parameters', function (done) {
392
+ var fileName = 'resolve.file.uri.params';
393
+ var win = function (fileEntry) {
394
+ expect(fileEntry).toBeDefined();
395
+ if (fileEntry.toURL().toLowerCase().substring(0, 10) === 'cdvfile://') {
396
+ expect(fileEntry.fullPath).toBe('/' + fileName + '?1234567890');
397
+ }
398
+ expect(fileEntry.name).toBe(fileName);
399
+ // cleanup
400
+ deleteEntry(fileName, done);
401
+ };
402
+ // create a new file entry
403
+ createFile(fileName, function (entry) {
404
+ window.resolveLocalFileSystemURL(entry.toURL() + '?1234567890', win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - Error resolving file URI: ' + entry.toURL()));
405
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
406
+ });
407
+ it('file.spec.11 should error (NOT_FOUND_ERR) when resolving (non-existent) invalid file name', function (done) {
408
+ var fileName = cordova.platformId === 'windowsphone' ? root.toURL() + '/' + 'this.is.not.a.valid.file.txt' : joinURL(root.toURL(), 'this.is.not.a.valid.file.txt'); // eslint-disable-line no-undef
409
+ var fail = function (error) {
410
+ expect(error).toBeDefined();
411
+ if (isChrome) {
412
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
413
+ } else {
414
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
415
+ }
416
+ done();
417
+ };
418
+ // lookup file system entry
419
+ window.resolveLocalFileSystemURL(fileName, succeed.bind(null, done, 'window.resolveLocalFileSystemURL - Error unexpected callback resolving file URI: ' + fileName), fail);
420
+ });
421
+ it('file.spec.12 should error (ENCODING_ERR) when resolving invalid URI with leading /', function (done) {
422
+ var fileName = '/this.is.not.a.valid.url';
423
+ var fail = function (error) {
424
+ expect(error).toBeDefined();
425
+ if (isChrome) {
426
+ // O.o chrome returns error code 0
427
+ } else {
428
+ expect(error).toBeFileError(FileError.ENCODING_ERR); // eslint-disable-line no-undef
429
+ }
430
+ done();
431
+ };
432
+ // lookup file system entry
433
+ window.resolveLocalFileSystemURL(fileName, succeed.bind(null, done, 'window.resolveLocalFileSystemURL - Error unexpected callback resolving file URI: ' + fileName), fail);
434
+ });
435
+ });
436
+ });
437
+ // LocalFileSystem
438
+ describe('Metadata interface', function () {
439
+ it('file.spec.13 should exist and have the right properties', function () {
440
+ var metadata = new Metadata(); // eslint-disable-line no-undef
441
+ expect(metadata).toBeDefined();
442
+ expect(metadata.modificationTime).toBeDefined();
443
+ });
444
+ });
445
+ describe('Flags interface', function () {
446
+ it('file.spec.14 should exist and have the right properties', function () {
447
+ var flags = new Flags(false, true); // eslint-disable-line no-undef
448
+ expect(flags).toBeDefined();
449
+ expect(flags.create).toBeDefined();
450
+ expect(flags.create).toBe(false);
451
+ expect(flags.exclusive).toBeDefined();
452
+ expect(flags.exclusive).toBe(true);
453
+ });
454
+ });
455
+ describe('FileSystem interface', function () {
456
+ it('file.spec.15 should have a root that is a DirectoryEntry', function (done) {
457
+ var win = function (entry) {
458
+ expect(entry).toBeDefined();
459
+ expect(entry.isFile).toBe(false);
460
+ expect(entry.isDirectory).toBe(true);
461
+ expect(entry.name).toBeDefined();
462
+ expect(entry.fullPath).toBeDefined();
463
+ expect(entry.getMetadata).toBeDefined();
464
+ expect(entry.moveTo).toBeDefined();
465
+ expect(entry.copyTo).toBeDefined();
466
+ expect(entry.toURL).toBeDefined();
467
+ expect(entry.remove).toBeDefined();
468
+ expect(entry.getParent).toBeDefined();
469
+ expect(entry.createReader).toBeDefined();
470
+ expect(entry.getFile).toBeDefined();
471
+ expect(entry.getDirectory).toBeDefined();
472
+ expect(entry.removeRecursively).toBeDefined();
473
+ done();
474
+ };
475
+ window.resolveLocalFileSystemURL(root.toURL(), win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - Error resolving file URI: ' + root.toURL()));
476
+ });
477
+ });
478
+ describe('DirectoryEntry', function () {
479
+ it('file.spec.16 getFile: get Entry for file that does not exist', function (done) {
480
+ var fileName = 'de.no.file';
481
+ var fail = function (error) {
482
+ expect(error).toBeDefined();
483
+ if (isChrome) {
484
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
485
+ } else {
486
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
487
+ }
488
+ done();
489
+ };
490
+ // create:false, exclusive:false, file does not exist
491
+ root.getFile(fileName, {
492
+ create: false
493
+ }, succeed.bind(null, done, 'root.getFile - Error unexpected callback, file should not exists: ' + fileName), fail);
494
+ });
495
+ it('file.spec.17 getFile: create new file', function (done) {
496
+ var fileName = 'de.create.file';
497
+ var filePath = joinURL(root.fullPath, fileName);
498
+ var win = function (entry) {
499
+ expect(entry).toBeDefined();
500
+ expect(entry.isFile).toBe(true);
501
+ expect(entry.isDirectory).toBe(false);
502
+ expect(entry.name).toCanonicallyMatch(fileName);
503
+ expect(entry.fullPath).toCanonicallyMatch(filePath);
504
+ // cleanup
505
+ deleteEntry(entry.name, done);
506
+ };
507
+ // create:true, exclusive:false, file does not exist
508
+ root.getFile(fileName, {
509
+ create: true
510
+ }, win, succeed.bind(null, done, 'root.getFile - Error unexpected callback, file should not exists: ' + fileName));
511
+ });
512
+ it('file.spec.18 getFile: create new file (exclusive)', function (done) {
513
+ var fileName = 'de.create.exclusive.file';
514
+ var filePath = joinURL(root.fullPath, fileName);
515
+ var win = function (entry) {
516
+ expect(entry).toBeDefined();
517
+ expect(entry.isFile).toBe(true);
518
+ expect(entry.isDirectory).toBe(false);
519
+ expect(entry.name).toBe(fileName);
520
+ expect(entry.fullPath).toCanonicallyMatch(filePath);
521
+ // cleanup
522
+ deleteEntry(entry.name, done);
523
+ };
524
+ // create:true, exclusive:true, file does not exist
525
+ root.getFile(fileName, {
526
+ create: true,
527
+ exclusive: true
528
+ }, win, failed.bind(null, done, 'root.getFile - Error creating file: ' + fileName));
529
+ });
530
+ it('file.spec.19 getFile: create file that already exists', function (done) {
531
+ var fileName = 'de.create.existing.file';
532
+ var filePath = joinURL(root.fullPath, fileName);
533
+
534
+ function win (entry) {
535
+ expect(entry).toBeDefined();
536
+ expect(entry.isFile).toBe(true);
537
+ expect(entry.isDirectory).toBe(false);
538
+ expect(entry.name).toCanonicallyMatch(fileName);
539
+ expect(entry.fullPath).toCanonicallyMatch(filePath);
540
+ // cleanup
541
+ deleteEntry(entry.name, done);
542
+ }
543
+
544
+ function getFile (file) {
545
+ // create:true, exclusive:false, file exists
546
+ root.getFile(fileName, {
547
+ create: true
548
+ }, win, failed.bind(null, done, 'root.getFile - Error creating file: ' + fileName));
549
+ }
550
+
551
+ // create file to kick off it
552
+ root.getFile(fileName, {
553
+ create: true
554
+ }, getFile, failed.bind(null, done, 'root.getFile - Error on initial creating file: ' + fileName));
555
+ });
556
+ it('file.spec.20 getFile: create file that already exists (exclusive)', function (done) {
557
+ var fileName = 'de.create.exclusive.existing.file';
558
+ var existingFile;
559
+
560
+ function fail (error) {
561
+ expect(error).toBeDefined();
562
+ if (isChrome) {
563
+ /* INVALID_MODIFICATION_ERR (code: 9) or ??? (code: 13) is thrown instead of PATH_EXISTS_ERR(code: 12)
564
+ on trying to exclusively create a file, which already exists in Chrome. */
565
+ // expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR);
566
+ } else {
567
+ expect(error).toBeFileError(FileError.PATH_EXISTS_ERR); // eslint-disable-line no-undef
568
+ }
569
+ // cleanup
570
+ deleteEntry(existingFile.name, done);
571
+ }
572
+
573
+ function getFile (file) {
574
+ existingFile = file;
575
+ // create:true, exclusive:true, file exists
576
+ root.getFile(fileName, {
577
+ create: true,
578
+ exclusive: true
579
+ }, succeed.bind(null, done, 'root.getFile - getFile function - Error unexpected callback, file should exists: ' + fileName), fail);
580
+ }
581
+
582
+ // create file to kick off it
583
+ root.getFile(fileName, {
584
+ create: true
585
+ }, getFile, failed.bind(null, done, 'root.getFile - Error creating file: ' + fileName));
586
+ });
587
+ it('file.spec.21 DirectoryEntry.getFile: get Entry for existing file', function (done) {
588
+ var fileName = 'de.get.file';
589
+ var filePath = joinURL(root.fullPath, fileName);
590
+ var win = function (entry) {
591
+ expect(entry).toBeDefined();
592
+ expect(entry.isFile).toBe(true);
593
+ expect(entry.isDirectory).toBe(false);
594
+ expect(entry.name).toCanonicallyMatch(fileName);
595
+ expect(entry.fullPath).toCanonicallyMatch(filePath);
596
+ expect(entry.filesystem).toBeDefined();
597
+ expect(entry.filesystem).toBe(root.filesystem);
598
+ // clean up
599
+ deleteEntry(entry.name, done);
600
+ };
601
+ var getFile = function (file) {
602
+ // create:false, exclusive:false, file exists
603
+ root.getFile(fileName, {
604
+ create: false
605
+ }, win, failed.bind(null, done, 'root.getFile - Error getting file entry: ' + fileName));
606
+ };
607
+ // create file to kick off it
608
+ root.getFile(fileName, {
609
+ create: true
610
+ }, getFile, failed.bind(null, done, 'root.getFile - Error creating file: ' + fileName));
611
+ });
612
+ it('file.spec.22 DirectoryEntry.getFile: get FileEntry for invalid path', function (done) {
613
+ if (isBrowser) {
614
+ /* The plugin does not follow to ["8.3 Naming restrictions"]
615
+ (http://www.w3.org/TR/2011/WD-file-system-api-20110419/#naming-restrictions). */
616
+ pending();
617
+ }
618
+
619
+ var fileName = 'de:invalid:path';
620
+ var fail = function (error) {
621
+ expect(error).toBeDefined();
622
+ expect(error).toBeFileError(FileError.ENCODING_ERR); // eslint-disable-line no-undef
623
+ done();
624
+ };
625
+ // create:false, exclusive:false, invalid path
626
+ root.getFile(fileName, {
627
+ create: false
628
+ }, succeed.bind(null, done, 'root.getFile - Error unexpected callback, file should not exists: ' + fileName), fail);
629
+ });
630
+ it('file.spec.23 DirectoryEntry.getDirectory: get Entry for directory that does not exist', function (done) {
631
+ var dirName = 'de.no.dir';
632
+ var fail = function (error) {
633
+ expect(error).toBeDefined();
634
+ if (isChrome) {
635
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
636
+ } else {
637
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
638
+ }
639
+ done();
640
+ };
641
+ // create:false, exclusive:false, directory does not exist
642
+ root.getDirectory(dirName, {
643
+ create: false
644
+ }, succeed.bind(null, done, 'root.getDirectory - Error unexpected callback, directory should not exists: ' + dirName), fail);
645
+ });
646
+ it('file.spec.24 DirectoryEntry.getDirectory: create new dir with space then resolveLocalFileSystemURL', function (done) {
647
+ var dirName = 'de create dir';
648
+
649
+ function win (directory) {
650
+ expect(directory).toBeDefined();
651
+ expect(directory.isFile).toBe(false);
652
+ expect(directory.isDirectory).toBe(true);
653
+ expect(directory.name).toCanonicallyMatch(dirName);
654
+ expect(directory.fullPath).toCanonicallyMatch(joinURL(root.fullPath, dirName));
655
+ // cleanup
656
+ deleteEntry(directory.name, done);
657
+ }
658
+
659
+ function getDir (dirEntry) {
660
+ expect(dirEntry.filesystem).toBeDefined();
661
+ expect(dirEntry.filesystem).toBe(root.filesystem);
662
+ var dirURI = dirEntry.toURL();
663
+ // now encode URI and try to resolve
664
+ window.resolveLocalFileSystemURL(dirURI, win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - getDir function - Error resolving directory: ' + dirURI));
665
+ }
666
+
667
+ // create:true, exclusive:false, directory does not exist
668
+ root.getDirectory(dirName, {
669
+ create: true
670
+ }, getDir, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
671
+ });
672
+ // This test is excluded, and should probably be removed. Filesystem
673
+ // should always be properly encoded URLs, and *not* raw paths, and it
674
+ // doesn't make sense to double-encode the URLs and expect that to be
675
+ // handled by the implementation.
676
+ // If a particular platform uses paths internally rather than URLs, // then that platform should careful to pass them correctly to its
677
+ // backend.
678
+ xit('file.spec.25 DirectoryEntry.getDirectory: create new dir with space resolveLocalFileSystemURL with encoded URI', function (done) {
679
+ var dirName = 'de create dir2';
680
+ var dirPath = joinURL(root.fullPath, dirName);
681
+
682
+ function win (directory) {
683
+ expect(directory).toBeDefined();
684
+ expect(directory.isFile).toBe(false);
685
+ expect(directory.isDirectory).toBe(true);
686
+ expect(directory.name).toCanonicallyMatch(dirName);
687
+ expect(directory.fullPath).toCanonicallyMatch(dirPath);
688
+ // cleanup
689
+ deleteEntry(directory.name, done);
690
+ }
691
+
692
+ function getDir (dirEntry) {
693
+ var dirURI = dirEntry.toURL();
694
+ // now encode URI and try to resolve
695
+ window.resolveLocalFileSystemURL(encodeURI(dirURI), win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - getDir function - Error resolving directory: ' + dirURI));
696
+ }
697
+
698
+ // create:true, exclusive:false, directory does not exist
699
+ root.getDirectory(dirName, {
700
+ create: true
701
+ }, getDir, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
702
+ });
703
+ it('file.spec.26 DirectoryEntry.getDirectory: create new directory', function (done) {
704
+ var dirName = 'de.create.dir';
705
+ var dirPath = joinURL(root.fullPath, dirName);
706
+ var win = function (directory) {
707
+ expect(directory).toBeDefined();
708
+ expect(directory.isFile).toBe(false);
709
+ expect(directory.isDirectory).toBe(true);
710
+ expect(directory.name).toCanonicallyMatch(dirName);
711
+ expect(directory.fullPath).toCanonicallyMatch(dirPath);
712
+ expect(directory.filesystem).toBeDefined();
713
+ expect(directory.filesystem).toBe(root.filesystem);
714
+ // cleanup
715
+ deleteEntry(directory.name, done);
716
+ };
717
+ // create:true, exclusive:false, directory does not exist
718
+ root.getDirectory(dirName, {
719
+ create: true
720
+ }, win, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
721
+ });
722
+ it('file.spec.27 DirectoryEntry.getDirectory: create new directory (exclusive)', function (done) {
723
+ var dirName = 'de.create.exclusive.dir';
724
+ var dirPath = joinURL(root.fullPath, dirName);
725
+ var win = function (directory) {
726
+ expect(directory).toBeDefined();
727
+ expect(directory.isFile).toBe(false);
728
+ expect(directory.isDirectory).toBe(true);
729
+ expect(directory.name).toCanonicallyMatch(dirName);
730
+ expect(directory.fullPath).toCanonicallyMatch(dirPath);
731
+ expect(directory.filesystem).toBeDefined();
732
+ expect(directory.filesystem).toBe(root.filesystem);
733
+ // cleanup
734
+ deleteEntry(directory.name, done);
735
+ };
736
+ // create:true, exclusive:true, directory does not exist
737
+ root.getDirectory(dirName, {
738
+ create: true,
739
+ exclusive: true
740
+ }, win, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
741
+ });
742
+ it('file.spec.28 DirectoryEntry.getDirectory: create directory that already exists', function (done) {
743
+ var dirName = 'de.create.existing.dir';
744
+ var dirPath = joinURL(root.fullPath, dirName);
745
+ var win = function (directory) {
746
+ expect(directory).toBeDefined();
747
+ expect(directory.isFile).toBe(false);
748
+ expect(directory.isDirectory).toBe(true);
749
+ expect(directory.name).toCanonicallyMatch(dirName);
750
+ expect(directory.fullPath).toCanonicallyMatch(dirPath);
751
+ // cleanup
752
+ deleteEntry(directory.name, done);
753
+ };
754
+ // create directory to kick off it
755
+ root.getDirectory(dirName, {
756
+ create: true
757
+ }, function () {
758
+ root.getDirectory(dirName, {
759
+ create: true
760
+ }, win, failed.bind(null, done, 'root.getDirectory - Error creating existent second directory : ' + dirName));
761
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
762
+ });
763
+ it('file.spec.29 DirectoryEntry.getDirectory: create directory that already exists (exclusive)', function (done) {
764
+
765
+ var dirName = 'de.create.exclusive.existing.dir';
766
+ var existingDir;
767
+ var fail = function (error) {
768
+ expect(error).toBeDefined();
769
+ if (isChrome) {
770
+ /* INVALID_MODIFICATION_ERR (code: 9) or ??? (code: 13) is thrown instead of PATH_EXISTS_ERR(code: 12)
771
+ on trying to exclusively create a file or directory, which already exists (Chrome). */
772
+ // expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR);
773
+ } else {
774
+ expect(error).toBeFileError(FileError.PATH_EXISTS_ERR); // eslint-disable-line no-undef
775
+ }
776
+ // cleanup
777
+ deleteEntry(existingDir.name, done);
778
+ };
779
+ // create directory to kick off it
780
+ root.getDirectory(dirName, {
781
+ create: true
782
+ }, function (directory) {
783
+ existingDir = directory;
784
+ // create:true, exclusive:true, directory exists
785
+ root.getDirectory(dirName, {
786
+ create: true,
787
+ exclusive: true
788
+ }, failed.bind(null, done, 'root.getDirectory - Unexpected success callback, second directory should not be created : ' + dirName), fail);
789
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
790
+ });
791
+ it('file.spec.30 DirectoryEntry.getDirectory: get Entry for existing directory', function (done) {
792
+ var dirName = 'de.get.dir';
793
+ var dirPath = joinURL(root.fullPath, dirName);
794
+ var win = function (directory) {
795
+ expect(directory).toBeDefined();
796
+ expect(directory.isFile).toBe(false);
797
+ expect(directory.isDirectory).toBe(true);
798
+ expect(directory.name).toCanonicallyMatch(dirName);
799
+ expect(directory.fullPath).toCanonicallyMatch(dirPath);
800
+ // cleanup
801
+ deleteEntry(directory.name, done);
802
+ };
803
+ // create directory to kick it off
804
+ root.getDirectory(dirName, {
805
+ create: true
806
+ }, function () {
807
+ root.getDirectory(dirName, {
808
+ create: false
809
+ }, win, failed.bind(null, done, 'root.getDirectory - Error getting directory entry : ' + dirName));
810
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
811
+ });
812
+ it('file.spec.31 DirectoryEntry.getDirectory: get DirectoryEntry for invalid path', function (done) {
813
+ if (isBrowser) {
814
+ /* The plugin does not follow to ["8.3 Naming restrictions"]
815
+ (http://www.w3.org/TR/2011/WD-file-system-api-20110419/#naming-restrictions). */
816
+ pending();
817
+ }
818
+
819
+ var dirName = 'de:invalid:path';
820
+ var fail = function (error) {
821
+ expect(error).toBeDefined();
822
+ expect(error).toBeFileError(FileError.ENCODING_ERR); // eslint-disable-line no-undef
823
+ done();
824
+ };
825
+ // create:false, exclusive:false, invalid path
826
+ root.getDirectory(dirName, {
827
+ create: false
828
+ }, succeed.bind(null, done, 'root.getDirectory - Unexpected success callback, directory should not exists: ' + dirName), fail);
829
+ });
830
+ it('file.spec.32 DirectoryEntry.getDirectory: get DirectoryEntry for existing file', function (done) {
831
+ var fileName = 'de.existing.file';
832
+ var existingFile;
833
+ var fail = function (error) {
834
+ expect(error).toBeDefined();
835
+ if (isChrome) {
836
+ // chrome returns an unknown error with code 17
837
+ } else {
838
+ expect(error).toBeFileError(FileError.TYPE_MISMATCH_ERR); // eslint-disable-line no-undef
839
+ }
840
+ // cleanup
841
+ deleteEntry(existingFile.name, done);
842
+ };
843
+ // create file to kick off it
844
+ root.getFile(fileName, {
845
+ create: true
846
+ }, function (file) {
847
+ existingFile = file;
848
+ root.getDirectory(fileName, {
849
+ create: false
850
+ }, succeed.bind(null, done, 'root.getDirectory - Unexpected success callback, directory should not exists: ' + fileName), fail);
851
+ }, failed.bind(null, done, 'root.getFile - Error creating file : ' + fileName));
852
+ });
853
+ it('file.spec.33 DirectoryEntry.getFile: get FileEntry for existing directory', function (done) {
854
+ var dirName = 'de.existing.dir';
855
+ var existingDir;
856
+ var fail = function (error) {
857
+ expect(error).toBeDefined();
858
+ if (isChrome) {
859
+ // chrome returns an unknown error with code 17
860
+ } else {
861
+ expect(error).toBeFileError(FileError.TYPE_MISMATCH_ERR); // eslint-disable-line no-undef
862
+ }
863
+ // cleanup
864
+ deleteEntry(existingDir.name, done);
865
+ };
866
+ // create directory to kick off it
867
+ root.getDirectory(dirName, {
868
+ create: true
869
+ }, function (directory) {
870
+ existingDir = directory;
871
+ root.getFile(dirName, {
872
+ create: false
873
+ }, succeed.bind(null, done, 'root.getFile - Unexpected success callback, file should not exists: ' + dirName), fail);
874
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
875
+ });
876
+ it('file.spec.34 DirectoryEntry.removeRecursively on directory', function (done) {
877
+ var dirName = 'de.removeRecursively';
878
+ var subDirName = 'dir';
879
+ var dirExists = function (error) {
880
+ expect(error).toBeDefined();
881
+ if (isChrome) {
882
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
883
+ } else {
884
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
885
+ }
886
+ done();
887
+ };
888
+ // create a new directory entry to kick off it
889
+ root.getDirectory(dirName, {
890
+ create: true
891
+ }, function (entry) {
892
+ entry.getDirectory(subDirName, {
893
+ create: true
894
+ }, function (dir) {
895
+ entry.removeRecursively(function () {
896
+ root.getDirectory(dirName, {
897
+ create: false
898
+ }, succeed.bind(null, done, 'root.getDirectory - Unexpected success callback, directory should not exists: ' + dirName), dirExists);
899
+ }, failed.bind(null, done, 'entry.removeRecursively - Error removing directory recursively : ' + dirName));
900
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + subDirName));
901
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
902
+ });
903
+ it('file.spec.35 createReader: create reader on existing directory', function () {
904
+ // create reader for root directory
905
+ var reader = root.createReader();
906
+ expect(reader).toBeDefined();
907
+ expect(typeof reader.readEntries).toBe('function');
908
+ });
909
+ it('file.spec.36 removeRecursively on root file system', function (done) {
910
+
911
+ var remove = function (error) {
912
+ expect(error).toBeDefined();
913
+ if (isChrome) {
914
+ /* INVALID_MODIFICATION_ERR (code: 9) or ??? (code: 13) is thrown instead of
915
+ NO_MODIFICATION_ALLOWED_ERR(code: 6) on trying to call removeRecursively
916
+ on the root file system (Chrome). */
917
+ // expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR);
918
+ } else {
919
+ expect(error).toBeFileError(FileError.NO_MODIFICATION_ALLOWED_ERR); // eslint-disable-line no-undef
920
+ }
921
+ done();
922
+ };
923
+ // remove root file system
924
+ root.removeRecursively(succeed.bind(null, done, 'root.removeRecursively - Unexpected success callback, root cannot be removed'), remove);
925
+ });
926
+ });
927
+ describe('DirectoryReader interface', function () {
928
+ describe('readEntries', function () {
929
+ it('file.spec.37 should read contents of existing directory', function (done) {
930
+ var reader;
931
+ var win = function (entries) {
932
+ expect(entries).toBeDefined();
933
+ expect(entries instanceof Array).toBe(true);
934
+ done();
935
+ };
936
+ // create reader for root directory
937
+ reader = root.createReader();
938
+ // read entries
939
+ reader.readEntries(win, failed.bind(null, done, 'reader.readEntries - Error reading entries'));
940
+ });
941
+ it('file.spec.37.1 should read contents of existing directory', function (done) {
942
+ var dirName = 'readEntries.dir';
943
+ var fileName = 'readeEntries.file';
944
+ root.getDirectory(dirName, {
945
+ create: true
946
+ }, function (directory) {
947
+ directory.getFile(fileName, {
948
+ create: true
949
+ }, function (fileEntry) {
950
+ var reader = directory.createReader();
951
+ reader.readEntries(function (entries) {
952
+ expect(entries).toBeDefined();
953
+ expect(entries instanceof Array).toBe(true);
954
+ expect(entries.length).toBe(1);
955
+ expect(entries[0].fullPath).toCanonicallyMatch(fileEntry.fullPath);
956
+ expect(entries[0].filesystem).not.toBe(null);
957
+ if (isChrome) {
958
+ // Slicing '[object {type}]' -> '{type}'
959
+ expect(entries[0].filesystem.toString().slice(8, -1)).toEqual('DOMFileSystem');
960
+ } else {
961
+ expect(entries[0].filesystem instanceof FileSystem).toBe(true); // eslint-disable-line no-undef
962
+ }
963
+
964
+ // cleanup
965
+ deleteEntry(directory.name, done);
966
+ }, failed.bind(null, done, 'reader.readEntries - Error reading entries from directory: ' + dirName));
967
+ }, failed.bind(null, done, 'directory.getFile - Error creating file : ' + fileName));
968
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
969
+ });
970
+ it('file.spec.109 should return an empty entry list on the second call', function (done) {
971
+ var reader;
972
+ var fileName = 'test109.txt';
973
+ // Add a file to ensure the root directory is non-empty and then read the contents of the directory.
974
+ root.getFile(fileName, {
975
+ create: true
976
+ }, function (entry) {
977
+ reader = root.createReader();
978
+ // First read
979
+ reader.readEntries(function (entries) {
980
+ expect(entries).toBeDefined();
981
+ expect(entries instanceof Array).toBe(true);
982
+ expect(entries.length).not.toBe(0);
983
+ // Second read
984
+ reader.readEntries(function (entries_) {
985
+ expect(entries_).toBeDefined();
986
+ expect(entries_ instanceof Array).toBe(true);
987
+ expect(entries_.length).toBe(0);
988
+ // Clean up
989
+ deleteEntry(entry.name, done);
990
+ }, failed.bind(null, done, 'reader.readEntries - Error during SECOND reading of entries from [root] directory'));
991
+ }, failed.bind(null, done, 'reader.readEntries - Error during FIRST reading of entries from [root] directory'));
992
+ }, failed.bind(null, done, 'root.getFile - Error creating file : ' + fileName));
993
+ });
994
+ });
995
+ it('file.spec.38 should read contents of directory that has been removed', function (done) {
996
+ var dirName = 'de.createReader.notfound';
997
+ // create a new directory entry to kick off it
998
+ root.getDirectory(dirName, {
999
+ create: true
1000
+ }, function (directory) {
1001
+ directory.removeRecursively(function () {
1002
+ var reader = directory.createReader();
1003
+ reader.readEntries(succeed.bind(null, done, 'reader.readEntries - Unexpected success callback, it should not read entries from deleted dir: ' + dirName), function (error) {
1004
+ expect(error).toBeDefined();
1005
+ if (isChrome) {
1006
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1007
+ } else {
1008
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1009
+ }
1010
+ root.getDirectory(dirName, {
1011
+ create: false
1012
+ }, succeed.bind(null, done, 'root.getDirectory - Unexpected success callback, it should not get deleted directory: ' + dirName), function (err) {
1013
+ expect(err).toBeDefined();
1014
+ if (isChrome) {
1015
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1016
+ } else {
1017
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1018
+ }
1019
+ done();
1020
+ });
1021
+ });
1022
+ }, failed.bind(null, done, 'directory.removeRecursively - Error removing directory recursively : ' + dirName));
1023
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dirName));
1024
+ });
1025
+ });
1026
+ // DirectoryReader interface
1027
+ describe('File', function () {
1028
+ it('file.spec.39 constructor should be defined', function () {
1029
+ expect(File).toBeDefined(); // eslint-disable-line no-undef
1030
+ expect(typeof File).toBe('function');
1031
+ });
1032
+ it('file.spec.40 should be define File attributes', function () {
1033
+ var file = new File(); // eslint-disable-line no-undef
1034
+ expect(file.name).toBeDefined();
1035
+ expect(file.type).toBeDefined();
1036
+ expect(file.lastModifiedDate).toBeDefined();
1037
+ expect(file.size).toBeDefined();
1038
+ });
1039
+ });
1040
+ // File
1041
+ describe('FileEntry', function () {
1042
+
1043
+ it('file.spec.41 should be define FileEntry methods', function (done) {
1044
+ var fileName = 'fe.methods';
1045
+ var testFileEntry = function (fileEntry) {
1046
+ expect(fileEntry).toBeDefined();
1047
+ expect(typeof fileEntry.createWriter).toBe('function');
1048
+ expect(typeof fileEntry.file).toBe('function');
1049
+ // cleanup
1050
+ deleteEntry(fileEntry.name, done);
1051
+ };
1052
+ // create a new file entry to kick off it
1053
+ root.getFile(fileName, {
1054
+ create: true
1055
+ }, testFileEntry, failed.bind(null, done, 'root.getFile - Error creating file : ' + fileName));
1056
+ });
1057
+ it('file.spec.42 createWriter should return a FileWriter object', function (done) {
1058
+ var fileName = 'fe.createWriter';
1059
+ var testFile;
1060
+ var testWriter = function (writer) {
1061
+ expect(writer).toBeDefined();
1062
+ if (isChrome) {
1063
+ // Slicing '[object {type}]' -> '{type}'
1064
+ expect(writer.toString().slice(8, -1)).toEqual('FileWriter');
1065
+ } else {
1066
+ expect(writer instanceof FileWriter).toBe(true); // eslint-disable-line no-undef
1067
+ }
1068
+
1069
+ // cleanup
1070
+ deleteEntry(testFile.name, done);
1071
+ };
1072
+ // create a new file entry to kick off it
1073
+ root.getFile(fileName, {
1074
+ create: true
1075
+ }, function (fileEntry) {
1076
+ testFile = fileEntry;
1077
+ fileEntry.createWriter(testWriter, failed.bind(null, done, 'fileEntry.createWriter - Error creating Writer from entry'));
1078
+ }, failed.bind(null, done, 'root.getFile - Error creating file : ' + fileName));
1079
+ });
1080
+ it('file.spec.43 file should return a File object', function (done) {
1081
+ var fileName = 'fe.file';
1082
+ var newFile;
1083
+ var testFile = function (file) {
1084
+ expect(file).toBeDefined();
1085
+ if (isChrome) {
1086
+ // Slicing '[object {type}]' -> '{type}'
1087
+ expect(file.toString().slice(8, -1)).toEqual('File');
1088
+ } else {
1089
+ expect(file instanceof File).toBe(true); // eslint-disable-line no-undef
1090
+ }
1091
+
1092
+ // cleanup
1093
+ deleteEntry(newFile.name, done);
1094
+ };
1095
+ // create a new file entry to kick off it
1096
+ root.getFile(fileName, {
1097
+ create: true
1098
+ }, function (fileEntry) {
1099
+ newFile = fileEntry;
1100
+ fileEntry.file(testFile, failed.bind(null, done, 'fileEntry.file - Error reading file using fileEntry: ' + fileEntry.name));
1101
+ }, failed.bind(null, done, 'root.getFile - Error creating file : ' + fileName));
1102
+ });
1103
+ it('file.spec.44 file: on File that has been removed', function (done) {
1104
+ var fileName = 'fe.no.file';
1105
+ // create a new file entry to kick off it
1106
+ root.getFile(fileName, {
1107
+ create: true
1108
+ }, function (fileEntry) {
1109
+ fileEntry.remove(function () {
1110
+ fileEntry.file(succeed.bind(null, done, 'fileEntry.file - Unexpected success callback, file it should not be created from removed entry'), function (error) {
1111
+ expect(error).toBeDefined();
1112
+ if (isChrome) {
1113
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1114
+ } else {
1115
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1116
+ }
1117
+ done();
1118
+ });
1119
+ }, failed.bind(null, done, 'fileEntry.remove - Error removing entry : ' + fileName));
1120
+ }, failed.bind(null, done, 'root.getFile - Error creating file : ' + fileName));
1121
+ });
1122
+ });
1123
+ // FileEntry
1124
+ describe('Entry', function () {
1125
+ it('file.spec.45 Entry object', function (done) {
1126
+ var fileName = 'entry';
1127
+ var fullPath = joinURL(root.fullPath, fileName);
1128
+ var winEntry = function (entry) {
1129
+ expect(entry).toBeDefined();
1130
+ expect(entry.isFile).toBe(true);
1131
+ expect(entry.isDirectory).toBe(false);
1132
+ expect(entry.name).toCanonicallyMatch(fileName);
1133
+ expect(entry.fullPath).toCanonicallyMatch(fullPath);
1134
+ expect(typeof entry.getMetadata).toBe('function');
1135
+ expect(typeof entry.setMetadata).toBe('function');
1136
+ expect(typeof entry.moveTo).toBe('function');
1137
+ expect(typeof entry.copyTo).toBe('function');
1138
+ expect(typeof entry.toURL).toBe('function');
1139
+ expect(typeof entry.remove).toBe('function');
1140
+ expect(typeof entry.getParent).toBe('function');
1141
+ expect(typeof entry.createWriter).toBe('function');
1142
+ expect(typeof entry.file).toBe('function');
1143
+ // Clean up
1144
+ deleteEntry(fileName, done);
1145
+ };
1146
+ // create a new file entry
1147
+ createFile(fileName, winEntry, failed.bind(null, done, 'createFile - Error creating file : ' + fileName));
1148
+ });
1149
+ it('file.spec.46 Entry.getMetadata on file', function (done) {
1150
+ var fileName = 'entry.metadata.file';
1151
+ // create a new file entry
1152
+ createFile(fileName, function (entry) {
1153
+ entry.getMetadata(function (metadata) {
1154
+ expect(metadata).toBeDefined();
1155
+ expect(metadata.modificationTime instanceof Date).toBe(true);
1156
+ expect(typeof metadata.size).toBe('number');
1157
+ // cleanup
1158
+ deleteEntry(fileName, done);
1159
+ }, failed.bind(null, done, 'entry.getMetadata - Error getting metadata from entry : ' + fileName));
1160
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + fileName));
1161
+ });
1162
+ it('file.spec.47 Entry.getMetadata on directory', function (done) {
1163
+ if (isIndexedDBShim) {
1164
+ /* Does not support metadata for directories (Firefox, IE) */
1165
+ pending();
1166
+ }
1167
+
1168
+ var dirName = 'entry.metadata.dir';
1169
+ // create a new directory entry
1170
+ createDirectory(dirName, function (entry) {
1171
+ entry.getMetadata(function (metadata) {
1172
+ expect(metadata).toBeDefined();
1173
+ expect(metadata.modificationTime instanceof Date).toBe(true);
1174
+ expect(typeof metadata.size).toBe('number');
1175
+ expect(metadata.size).toBe(0);
1176
+ // cleanup
1177
+ deleteEntry(dirName, done);
1178
+ }, failed.bind(null, done, 'entry.getMetadata - Error getting metadata from entry : ' + dirName));
1179
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + dirName));
1180
+ });
1181
+ it('file.spec.48 Entry.getParent on file in root file system', function (done) {
1182
+ var fileName = 'entry.parent.file';
1183
+ var rootPath = root.fullPath;
1184
+ // create a new file entry
1185
+ createFile(fileName, function (entry) {
1186
+ entry.getParent(function (parent) {
1187
+ expect(parent).toBeDefined();
1188
+ expect(parent.fullPath).toCanonicallyMatch(rootPath);
1189
+ // cleanup
1190
+ deleteEntry(fileName, done);
1191
+ }, failed.bind(null, done, 'entry.getParent - Error getting parent directory of file : ' + fileName));
1192
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + fileName));
1193
+ });
1194
+ it('file.spec.49 Entry.getParent on directory in root file system', function (done) {
1195
+ var dirName = 'entry.parent.dir';
1196
+ var rootPath = root.fullPath;
1197
+ // create a new directory entry
1198
+ createDirectory(dirName, function (entry) {
1199
+ entry.getParent(function (parent) {
1200
+ expect(parent).toBeDefined();
1201
+ expect(parent.fullPath).toCanonicallyMatch(rootPath);
1202
+ // cleanup
1203
+ deleteEntry(dirName, done);
1204
+ }, failed.bind(null, done, 'entry.getParent - Error getting parent directory of directory : ' + dirName));
1205
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + dirName));
1206
+ });
1207
+ it('file.spec.50 Entry.getParent on root file system', function (done) {
1208
+ var rootPath = root.fullPath;
1209
+ var winParent = function (parent) {
1210
+ expect(parent).toBeDefined();
1211
+ expect(parent.fullPath).toCanonicallyMatch(rootPath);
1212
+ done();
1213
+ };
1214
+ // create a new directory entry
1215
+ root.getParent(winParent, failed.bind(null, done, 'root.getParent - Error getting parent directory of root'));
1216
+ });
1217
+ it('file.spec.51 Entry.toURL on file', function (done) {
1218
+ var fileName = 'entry.uri.file';
1219
+ var rootPath = root.fullPath;
1220
+ var winURI = function (entry) {
1221
+ var uri = entry.toURL();
1222
+ expect(uri).toBeDefined();
1223
+ expect(uri.indexOf(rootPath)).not.toBe(-1);
1224
+ // cleanup
1225
+ deleteEntry(fileName, done);
1226
+ };
1227
+ // create a new file entry
1228
+ createFile(fileName, winURI, failed.bind(null, done, 'createFile - Error creating file : ' + fileName));
1229
+ });
1230
+ it('file.spec.52 Entry.toURL on directory', function (done) {
1231
+ var dirName_1 = 'num 1';
1232
+ var dirName_2 = 'num 2';
1233
+ var rootPath = root.fullPath;
1234
+ createDirectory(dirName_1, function (entry) {
1235
+ entry.getDirectory(dirName_2, {
1236
+ create: true
1237
+ }, function (entryFile) {
1238
+ var uri = entryFile.toURL();
1239
+ expect(uri).toBeDefined();
1240
+ expect(uri).toContain('/num%201/num%202/');
1241
+ expect(uri.indexOf(rootPath)).not.toBe(-1);
1242
+ // cleanup
1243
+ deleteEntry(dirName_1, done);
1244
+ }, failed.bind(null, done, 'entry.getDirectory - Error creating directory : ' + dirName_2));
1245
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + dirName_1));
1246
+ });
1247
+ it('file.spec.53 Entry.remove on file', function (done) {
1248
+ var fileName = 'entr .rm.file';
1249
+ // create a new file entry
1250
+ createFile(fileName, function (entry) {
1251
+ expect(entry).toBeDefined();
1252
+ entry.remove(function () {
1253
+ root.getFile(fileName, null, succeed.bind(null, done, 'root.getFile - Unexpected success callback, it should not get deleted file : ' + fileName), function (error) {
1254
+ expect(error).toBeDefined();
1255
+ if (isChrome) {
1256
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1257
+ } else {
1258
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1259
+ }
1260
+ // cleanup
1261
+ deleteEntry(fileName, done);
1262
+ });
1263
+ }, failed.bind(null, done, 'entry.remove - Error removing entry : ' + fileName));
1264
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + fileName));
1265
+ });
1266
+ it('file.spec.53.1 Entry.remove on filename with #s', function (done) {
1267
+ if (isBrowser) {
1268
+ pending('Browsers can\'t do that');
1269
+ }
1270
+ var fileName = 'entry.#rm#.file';
1271
+ // create a new file entry
1272
+ createFile(fileName, function (entry) {
1273
+ expect(entry).toBeDefined();
1274
+ entry.remove(function () {
1275
+ root.getFile(fileName, null, succeed.bind(null, done, 'root.getFile - Unexpected success callback, it should not get deleted file : ' + fileName), function (error) {
1276
+ expect(error).toBeDefined();
1277
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1278
+ // cleanup
1279
+ deleteEntry(fileName, done);
1280
+ });
1281
+ }, failed.bind(null, done, 'entry.remove - Error removing entry : ' + fileName));
1282
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + fileName));
1283
+ });
1284
+ it('file.spec.54 remove on empty directory', function (done) {
1285
+ var dirName = 'entry.rm.dir';
1286
+ // create a new directory entry
1287
+ createDirectory(dirName, function (entry) {
1288
+ expect(entry).toBeDefined();
1289
+ entry.remove(function () {
1290
+ root.getDirectory(dirName, null, succeed.bind(null, done, 'root.getDirectory - Unexpected success callback, it should not get deleted directory : ' + dirName), function (error) {
1291
+ expect(error).toBeDefined();
1292
+ if (isChrome) {
1293
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1294
+ } else {
1295
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1296
+ }
1297
+ // cleanup
1298
+ deleteEntry(dirName, done);
1299
+ });
1300
+ }, failed.bind(null, done, 'entry.remove - Error removing entry : ' + dirName));
1301
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + dirName));
1302
+ });
1303
+ it('file.spec.55 remove on non-empty directory', function (done) {
1304
+ if (isIndexedDBShim) {
1305
+ /* Both Entry.remove and directoryEntry.removeRecursively don't fail when removing
1306
+ non-empty directories - directories being removed are cleaned
1307
+ along with contents instead (Firefox, IE) */
1308
+ pending();
1309
+ }
1310
+
1311
+ var dirName = 'ent y.rm.dir.not.empty';
1312
+ var fileName = 're ove.txt';
1313
+ var fullPath = joinURL(root.fullPath, dirName);
1314
+ // create a new directory entry
1315
+ createDirectory(dirName, function (entry) {
1316
+ entry.getFile(fileName, {
1317
+ create: true
1318
+ }, function (fileEntry) {
1319
+ entry.remove(succeed.bind(null, done, 'entry.remove - Unexpected success callback, it should not remove a directory that contains files : ' + dirName), function (error) {
1320
+ expect(error).toBeDefined();
1321
+ if (isChrome) {
1322
+ // chrome is returning unknown error with code 13
1323
+ } else {
1324
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
1325
+ }
1326
+ root.getDirectory(dirName, null, function (entry) {
1327
+ expect(entry).toBeDefined();
1328
+ expect(entry.fullPath).toCanonicallyMatch(fullPath);
1329
+ // cleanup
1330
+ deleteEntry(dirName, done);
1331
+ }, failed.bind(null, done, 'root.getDirectory - Error getting directory : ' + dirName));
1332
+ });
1333
+ }, failed.bind(null, done, 'entry.getFile - Error creating file : ' + fileName + ' inside of ' + dirName));
1334
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + dirName));
1335
+ });
1336
+ it('file.spec.56 remove on root file system', function (done) {
1337
+
1338
+ // remove entry that doesn't exist
1339
+ root.remove(succeed.bind(null, done, 'entry.remove - Unexpected success callback, it should not remove entry that it does not exists'), function (error) {
1340
+ expect(error).toBeDefined();
1341
+ if (isChrome) {
1342
+ /* INVALID_MODIFICATION_ERR (code: 9) or ??? (code: 13) is thrown instead of
1343
+ NO_MODIFICATION_ALLOWED_ERR(code: 6) on trying to call removeRecursively
1344
+ on the root file system. */
1345
+ // expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR);
1346
+ } else {
1347
+ expect(error).toBeFileError(FileError.NO_MODIFICATION_ALLOWED_ERR); // eslint-disable-line no-undef
1348
+ }
1349
+ done();
1350
+ });
1351
+ });
1352
+ it('file.spec.57 copyTo: file', function (done) {
1353
+ var file1 = 'entry copy.file1';
1354
+ var file2 = 'entry copy.file2';
1355
+ var fullPath = joinURL(root.fullPath, file2);
1356
+ // create a new file entry to kick off it
1357
+ deleteEntry(file2, function () {
1358
+ createFile(file1, function (fileEntry) {
1359
+ // copy file1 to file2
1360
+ fileEntry.copyTo(root, file2, function (entry) {
1361
+ expect(entry).toBeDefined();
1362
+ expect(entry.isFile).toBe(true);
1363
+ expect(entry.isDirectory).toBe(false);
1364
+ expect(entry.fullPath).toCanonicallyMatch(fullPath);
1365
+ expect(entry.name).toCanonicallyMatch(file2);
1366
+ root.getFile(file2, {
1367
+ create: false
1368
+ }, function (entry2) {
1369
+ expect(entry2).toBeDefined();
1370
+ expect(entry2.isFile).toBe(true);
1371
+ expect(entry2.isDirectory).toBe(false);
1372
+ expect(entry2.fullPath).toCanonicallyMatch(fullPath);
1373
+ expect(entry2.name).toCanonicallyMatch(file2);
1374
+ // cleanup
1375
+ deleteEntry(file1, function () {
1376
+ deleteEntry(file2, done);
1377
+ });
1378
+ }, failed.bind(null, done, 'root.getFile - Error getting copied file : ' + file2));
1379
+ }, failed.bind(null, done, 'fileEntry.copyTo - Error copying file : ' + file2));
1380
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + file1));
1381
+ }, failed.bind(null, done, 'deleteEntry - Error removing file : ' + file2));
1382
+ });
1383
+ it('file.spec.58 copyTo: file onto itself', function (done) {
1384
+ var file1 = 'entry.copy.fos.file1';
1385
+ // create a new file entry to kick off it
1386
+ createFile(file1, function (entry) {
1387
+ // copy file1 onto itself
1388
+ entry.copyTo(root, null, succeed.bind(null, done, 'entry.copyTo - Unexpected success callback, it should not copy a null file'), function (error) {
1389
+ expect(error).toBeDefined();
1390
+ if (isChrome) {
1391
+ // chrome returns unknown error with code 13
1392
+ } else {
1393
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
1394
+ }
1395
+ // cleanup
1396
+ deleteEntry(file1, done);
1397
+ });
1398
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + file1));
1399
+ });
1400
+ it('file.spec.59 copyTo: directory', function (done) {
1401
+ if (isIndexedDBShim) {
1402
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1403
+ pending();
1404
+ }
1405
+
1406
+ var file1 = 'file1';
1407
+ var srcDir = 'entry.copy.srcDir';
1408
+ var dstDir = 'entry.copy.dstDir';
1409
+ var dstPath = joinURL(root.fullPath, dstDir);
1410
+ var filePath = joinURL(dstPath, file1);
1411
+ // create a new directory entry to kick off it
1412
+ deleteEntry(dstDir, function () {
1413
+ createDirectory(srcDir, function (directory) {
1414
+ // create a file within new directory
1415
+ directory.getFile(file1, {
1416
+ create: true
1417
+ }, function () {
1418
+ directory.copyTo(root, dstDir, function (directory) {
1419
+ expect(directory).toBeDefined();
1420
+ expect(directory.isFile).toBe(false);
1421
+ expect(directory.isDirectory).toBe(true);
1422
+ expect(directory.fullPath).toCanonicallyMatch(dstPath);
1423
+ expect(directory.name).toCanonicallyMatch(dstDir);
1424
+ root.getDirectory(dstDir, {
1425
+ create: false
1426
+ }, function (dirEntry) {
1427
+ expect(dirEntry).toBeDefined();
1428
+ expect(dirEntry.isFile).toBe(false);
1429
+ expect(dirEntry.isDirectory).toBe(true);
1430
+ expect(dirEntry.fullPath).toCanonicallyMatch(dstPath);
1431
+ expect(dirEntry.name).toCanonicallyMatch(dstDir);
1432
+ dirEntry.getFile(file1, {
1433
+ create: false
1434
+ }, function (fileEntry) {
1435
+ expect(fileEntry).toBeDefined();
1436
+ expect(fileEntry.isFile).toBe(true);
1437
+ expect(fileEntry.isDirectory).toBe(false);
1438
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
1439
+ expect(fileEntry.name).toCanonicallyMatch(file1);
1440
+ // cleanup
1441
+ deleteEntry(srcDir, function () {
1442
+ deleteEntry(dstDir, done);
1443
+ });
1444
+ }, failed.bind(null, done, 'dirEntry.getFile - Error getting file : ' + file1));
1445
+ }, failed.bind(null, done, 'root.getDirectory - Error getting copied directory : ' + dstDir));
1446
+ }, failed.bind(null, done, 'directory.copyTo - Error copying directory : ' + srcDir + ' to :' + dstDir));
1447
+ }, failed.bind(null, done, 'directory.getFile - Error creating file : ' + file1));
1448
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
1449
+ }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' + dstDir));
1450
+ });
1451
+ it('file.spec.60 copyTo: directory to backup at same root directory', function (done) {
1452
+ if (isIndexedDBShim) {
1453
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1454
+ pending();
1455
+ }
1456
+
1457
+ var file1 = 'file1';
1458
+ var srcDir = 'entry.copy srcDirSame';
1459
+ var dstDir = 'entry.copy srcDirSame-backup';
1460
+ var dstPath = joinURL(root.fullPath, dstDir);
1461
+ var filePath = joinURL(dstPath, file1);
1462
+ // create a new directory entry to kick off it
1463
+ deleteEntry(dstDir, function () {
1464
+ createDirectory(srcDir, function (directory) {
1465
+ directory.getFile(file1, {
1466
+ create: true
1467
+ }, function () {
1468
+ directory.copyTo(root, dstDir, function (directory) {
1469
+ expect(directory).toBeDefined();
1470
+ expect(directory.isFile).toBe(false);
1471
+ expect(directory.isDirectory).toBe(true);
1472
+ expect(directory.fullPath).toCanonicallyMatch(dstPath);
1473
+ expect(directory.name).toCanonicallyMatch(dstDir);
1474
+ root.getDirectory(dstDir, {
1475
+ create: false
1476
+ }, function (dirEntry) {
1477
+ expect(dirEntry).toBeDefined();
1478
+ expect(dirEntry.isFile).toBe(false);
1479
+ expect(dirEntry.isDirectory).toBe(true);
1480
+ expect(dirEntry.fullPath).toCanonicallyMatch(dstPath);
1481
+ expect(dirEntry.name).toCanonicallyMatch(dstDir);
1482
+ dirEntry.getFile(file1, {
1483
+ create: false
1484
+ }, function (fileEntry) {
1485
+ expect(fileEntry).toBeDefined();
1486
+ expect(fileEntry.isFile).toBe(true);
1487
+ expect(fileEntry.isDirectory).toBe(false);
1488
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
1489
+ expect(fileEntry.name).toCanonicallyMatch(file1);
1490
+ // cleanup
1491
+ deleteEntry(srcDir, function () {
1492
+ deleteEntry(dstDir, done);
1493
+ });
1494
+ }, failed.bind(null, done, 'dirEntry.getFile - Error getting file : ' + file1));
1495
+ }, failed.bind(null, done, 'root.getDirectory - Error getting copied directory : ' + dstDir));
1496
+ }, failed.bind(null, done, 'directory.copyTo - Error copying directory : ' + srcDir + ' to :' + dstDir));
1497
+ }, failed.bind(null, done, 'directory.getFile - Error creating file : ' + file1));
1498
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
1499
+ }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' + dstDir));
1500
+ });
1501
+ it('file.spec.61 copyTo: directory onto itself', function (done) {
1502
+ if (isIndexedDBShim) {
1503
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1504
+ pending();
1505
+ }
1506
+
1507
+ var file1 = 'file1';
1508
+ var srcDir = 'entry.copy.dos.srcDir';
1509
+ var srcPath = joinURL(root.fullPath, srcDir);
1510
+ var filePath = joinURL(srcPath, file1);
1511
+ // create a new directory entry to kick off it
1512
+ createDirectory(srcDir, function (directory) {
1513
+ // create a file within new directory
1514
+ directory.getFile(file1, {
1515
+ create: true
1516
+ }, function (fileEntry) {
1517
+ // copy srcDir onto itself
1518
+ directory.copyTo(root, null, succeed.bind(null, done, 'directory.copyTo - Unexpected success callback, it should not copy file: ' + srcDir + ' to a null destination'), function (error) {
1519
+ expect(error).toBeDefined();
1520
+ if (isChrome) {
1521
+ // chrome returns unknown error with code 13
1522
+ } else {
1523
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
1524
+ }
1525
+ root.getDirectory(srcDir, {
1526
+ create: false
1527
+ }, function (dirEntry) {
1528
+ expect(dirEntry).toBeDefined();
1529
+ expect(dirEntry.fullPath).toCanonicallyMatch(srcPath);
1530
+ dirEntry.getFile(file1, {
1531
+ create: false
1532
+ }, function (fileEntry) {
1533
+ expect(fileEntry).toBeDefined();
1534
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
1535
+ // cleanup
1536
+ deleteEntry(srcDir, done);
1537
+ }, failed.bind(null, done, 'dirEntry.getFile - Error getting file : ' + file1));
1538
+ }, failed.bind(null, done, 'root.getDirectory - Error getting directory : ' + srcDir));
1539
+ });
1540
+ }, failed.bind(null, done, 'directory.getFile - Error creating file : ' + file1));
1541
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
1542
+ });
1543
+ it('file.spec.62 copyTo: directory into itself', function (done) {
1544
+ if (isIndexedDBShim) {
1545
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1546
+ pending();
1547
+ }
1548
+
1549
+ var srcDir = 'entry.copy.dis.srcDir';
1550
+ var dstDir = 'entry.copy.dis.dstDir';
1551
+ var srcPath = joinURL(root.fullPath, srcDir);
1552
+ // create a new directory entry to kick off it
1553
+ createDirectory(srcDir, function (directory) {
1554
+ // copy source directory into itself
1555
+ directory.copyTo(directory, dstDir, succeed.bind(null, done, 'directory.copyTo - Unexpected success callback, it should not copy a directory ' + srcDir + ' into itself'), function (error) {
1556
+ expect(error).toBeDefined();
1557
+ if (isChrome) {
1558
+ // chrome returns unknown error with code 13
1559
+ } else {
1560
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
1561
+ }
1562
+ root.getDirectory(srcDir, {
1563
+ create: false
1564
+ }, function (dirEntry) {
1565
+ // returning confirms existence so just check fullPath entry
1566
+ expect(dirEntry).toBeDefined();
1567
+ expect(dirEntry.fullPath).toCanonicallyMatch(srcPath);
1568
+ // cleanup
1569
+ deleteEntry(srcDir, done);
1570
+ }, failed.bind(null, done, 'root.getDirectory - Error getting directory : ' + srcDir));
1571
+ });
1572
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
1573
+ });
1574
+ it('file.spec.63 copyTo: directory that does not exist', function (done) {
1575
+ var file1 = 'entry.copy.dnf.file1';
1576
+ var dirName = 'dir-foo';
1577
+ createFile(file1, function (fileEntry) {
1578
+ createDirectory(dirName, function (dirEntry) {
1579
+ dirEntry.remove(function () {
1580
+ fileEntry.copyTo(dirEntry, null, succeed.bind(null, done, 'fileEntry.copyTo - Unexpected success callback, it should not copy a file ' + file1 + ' into a removed directory'), function (error) {
1581
+ expect(error).toBeDefined();
1582
+ if (isChrome) {
1583
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1584
+ } else {
1585
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1586
+ }
1587
+ done();
1588
+ });
1589
+ }, failed.bind(null, done, 'dirEntry.remove - Error removing directory : ' + dirName));
1590
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + dirName));
1591
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + file1));
1592
+ });
1593
+ it('file.spec.64 copyTo: invalid target name', function (done) {
1594
+ if (isBrowser) {
1595
+ /* The plugin does not follow ["8.3 Naming restrictions"]
1596
+ (http://www.w3.org/TR/2011/WD-file-system-api-20110419/#naming-restrictions */
1597
+ pending();
1598
+ }
1599
+
1600
+ var file1 = 'entry.copy.itn.file1';
1601
+ var file2 = 'bad:file:name';
1602
+ // create a new file entry
1603
+ createFile(file1, function (entry) {
1604
+ // copy file1 to file2
1605
+ entry.copyTo(root, file2, succeed.bind(null, done, 'entry.copyTo - Unexpected success callback, it should not copy a file ' + file1 + ' to an invalid file name: ' + file2), function (error) {
1606
+ expect(error).toBeDefined();
1607
+ expect(error).toBeFileError(FileError.ENCODING_ERR); // eslint-disable-line no-undef
1608
+ // cleanup
1609
+ deleteEntry(file1, done);
1610
+ });
1611
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + file1));
1612
+ });
1613
+ it('file.spec.65 moveTo: file to same parent', function (done) {
1614
+ var file1 = 'entry.move.fsp.file1';
1615
+ var file2 = 'entry.move.fsp.file2';
1616
+ var dstPath = joinURL(root.fullPath, file2);
1617
+ // create a new file entry to kick off it
1618
+ createFile(file1, function (entry) {
1619
+ // move file1 to file2
1620
+ entry.moveTo(root, file2, function (entry) {
1621
+ expect(entry).toBeDefined();
1622
+ expect(entry.isFile).toBe(true);
1623
+ expect(entry.isDirectory).toBe(false);
1624
+ expect(entry.fullPath).toCanonicallyMatch(dstPath);
1625
+ expect(entry.name).toCanonicallyMatch(file2);
1626
+ root.getFile(file2, {
1627
+ create: false
1628
+ }, function (fileEntry) {
1629
+ expect(fileEntry).toBeDefined();
1630
+ expect(fileEntry.fullPath).toCanonicallyMatch(dstPath);
1631
+ root.getFile(file1, {
1632
+ create: false
1633
+ }, succeed.bind(null, done, 'root.getFile - Unexpected success callback, it should not get invalid or moved file: ' + file1), function (error) {
1634
+ // expect(navigator.fileMgr.testFileExists(srcPath) === false, "original file should not exist.");
1635
+ expect(error).toBeDefined();
1636
+ if (isChrome) {
1637
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1638
+ } else {
1639
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1640
+ }
1641
+ // cleanup
1642
+ deleteEntry(file1, function () {
1643
+ deleteEntry(file2, done);
1644
+ });
1645
+ });
1646
+ }, failed.bind(null, done, 'root.getFile - Error getting file : ' + file2));
1647
+ }, failed.bind(null, done, 'entry.moveTo - Error moving file : ' + file1 + ' to root as: ' + file2));
1648
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + file1));
1649
+ });
1650
+ it('file.spec.66 moveTo: file to new parent', function (done) {
1651
+ var file1 = 'entry.move.fnp.file1';
1652
+ var dir = 'entry.move.fnp.dir';
1653
+ var dstPath = joinURL(joinURL(root.fullPath, dir), file1);
1654
+ // ensure destination directory is cleaned up first
1655
+ deleteEntry(dir, function () {
1656
+ // create a new file entry to kick off it
1657
+ createFile(file1, function (entry) {
1658
+ // create a parent directory to move file to
1659
+ root.getDirectory(dir, {
1660
+ create: true
1661
+ }, function (directory) {
1662
+ // move file1 to new directory
1663
+ // move the file
1664
+ entry.moveTo(directory, null, function (entry) {
1665
+ expect(entry).toBeDefined();
1666
+ expect(entry.isFile).toBe(true);
1667
+ expect(entry.isDirectory).toBe(false);
1668
+ expect(entry.fullPath).toCanonicallyMatch(dstPath);
1669
+ expect(entry.name).toCanonicallyMatch(file1);
1670
+ // test the moved file exists
1671
+ directory.getFile(file1, {
1672
+ create: false
1673
+ }, function (fileEntry) {
1674
+ expect(fileEntry).toBeDefined();
1675
+ expect(fileEntry.fullPath).toCanonicallyMatch(dstPath);
1676
+ root.getFile(file1, {
1677
+ create: false
1678
+ }, succeed.bind(null, done, 'root.getFile - Unexpected success callback, it should not get invalid or moved file: ' + file1), function (error) {
1679
+ expect(error).toBeDefined();
1680
+ if (isChrome) {
1681
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1682
+ } else {
1683
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1684
+ }
1685
+ // cleanup
1686
+ deleteEntry(file1, function () {
1687
+ deleteEntry(dir, done);
1688
+ });
1689
+ });
1690
+ }, failed.bind(null, done, 'directory.getFile - Error getting file : ' + file1 + ' from: ' + dir));
1691
+ }, failed.bind(null, done, 'entry.moveTo - Error moving file : ' + file1 + ' to: ' + dir + ' with the same name'));
1692
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dir));
1693
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + file1));
1694
+ }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' + dir));
1695
+ });
1696
+ it('file.spec.67 moveTo: directory to same parent', function (done) {
1697
+ if (isIndexedDBShim) {
1698
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1699
+ pending();
1700
+ }
1701
+
1702
+ var file1 = 'file1';
1703
+ var srcDir = 'entry.move.dsp.srcDir';
1704
+ var dstDir = 'entry.move.dsp.dstDir';
1705
+ var dstPath = joinURL(root.fullPath, dstDir);
1706
+ var filePath = joinURL(dstPath, file1);
1707
+ // ensure destination directory is cleaned up before it
1708
+ deleteEntry(dstDir, function () {
1709
+ // create a new directory entry to kick off it
1710
+ createDirectory(srcDir, function (directory) {
1711
+ // create a file within directory
1712
+ directory.getFile(file1, {
1713
+ create: true
1714
+ }, function () {
1715
+ // move srcDir to dstDir
1716
+ directory.moveTo(root, dstDir, function (directory) {
1717
+ expect(directory).toBeDefined();
1718
+ expect(directory.isFile).toBe(false);
1719
+ expect(directory.isDirectory).toBe(true);
1720
+ expect(directory.fullPath).toCanonicallyMatch(dstPath);
1721
+ expect(directory.name).toCanonicallyMatch(dstDir);
1722
+ // test that moved file exists in destination dir
1723
+ directory.getFile(file1, {
1724
+ create: false
1725
+ }, function (fileEntry) {
1726
+ expect(fileEntry).toBeDefined();
1727
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
1728
+ // check that the moved file no longer exists in original dir
1729
+ root.getFile(file1, {
1730
+ create: false
1731
+ }, succeed.bind(null, done, 'directory.getFile - Unexpected success callback, it should not get invalid or moved file: ' + file1), function (error) {
1732
+ expect(error).toBeDefined();
1733
+ if (isChrome) {
1734
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1735
+ } else {
1736
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1737
+ }
1738
+ // cleanup
1739
+ deleteEntry(srcDir, function () {
1740
+ deleteEntry(dstDir, done);
1741
+ });
1742
+ });
1743
+ }, failed.bind(null, done, 'directory.getFile - Error getting file : ' + file1 + ' from: ' + srcDir));
1744
+ }, failed.bind(null, done, 'entry.moveTo - Error moving directory : ' + srcDir + ' to root as: ' + dstDir));
1745
+ }, failed.bind(null, done, 'directory.getFile - Error creating file : ' + file1));
1746
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
1747
+ }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' + dstDir));
1748
+ });
1749
+ it('file.spec.68 moveTo: directory to same parent with same name', function (done) {
1750
+ if (isIndexedDBShim) {
1751
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1752
+ pending();
1753
+ }
1754
+
1755
+ var file1 = 'file1';
1756
+ var srcDir = 'entry.move.dsp.srcDir';
1757
+ var dstDir = 'entry.move.dsp.srcDir-backup';
1758
+ var dstPath = joinURL(root.fullPath, dstDir);
1759
+ var filePath = joinURL(dstPath, file1);
1760
+ // ensure destination directory is cleaned up before it
1761
+ deleteEntry(dstDir, function () {
1762
+ // create a new directory entry to kick off it
1763
+ createDirectory(srcDir, function (directory) {
1764
+ // create a file within directory
1765
+ directory.getFile(file1, {
1766
+ create: true
1767
+ }, function () {
1768
+ // move srcDir to dstDir
1769
+ directory.moveTo(root, dstDir, function (directory) {
1770
+ expect(directory).toBeDefined();
1771
+ expect(directory.isFile).toBe(false);
1772
+ expect(directory.isDirectory).toBe(true);
1773
+ expect(directory.fullPath).toCanonicallyMatch(dstPath);
1774
+ expect(directory.name).toCanonicallyMatch(dstDir);
1775
+ // check that moved file exists in destination dir
1776
+ directory.getFile(file1, {
1777
+ create: false
1778
+ }, function (fileEntry) {
1779
+ expect(fileEntry).toBeDefined();
1780
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
1781
+ // check that the moved file no longer exists in original dir
1782
+ root.getFile(file1, {
1783
+ create: false
1784
+ }, succeed.bind(null, done, 'directory.getFile - Unexpected success callback, it should not get invalid or moved file: ' + file1), function (error) {
1785
+ expect(error).toBeDefined();
1786
+ if (isChrome) {
1787
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1788
+ } else {
1789
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1790
+ }
1791
+ // cleanup
1792
+ deleteEntry(srcDir, function () {
1793
+ deleteEntry(dstDir, done);
1794
+ });
1795
+ });
1796
+ }, failed.bind(null, done, 'directory.getFile - Error getting file : ' + file1 + ' from: ' + srcDir));
1797
+ }, failed.bind(null, done, 'entry.moveTo - Error moving directory : ' + srcDir + ' to root as: ' + dstDir));
1798
+ }, failed.bind(null, done, 'directory.getFile - Error creating file : ' + file1));
1799
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
1800
+ }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' + dstDir));
1801
+ });
1802
+ it('file.spec.69 moveTo: directory to new parent', function (done) {
1803
+ if (isIndexedDBShim) {
1804
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1805
+ pending();
1806
+ }
1807
+
1808
+ var file1 = 'file1';
1809
+ var srcDir = 'entry.move.dnp.srcDir';
1810
+ var dstDir = 'entry.move.dnp.dstDir';
1811
+ var dstPath = joinURL(root.fullPath, dstDir);
1812
+ var filePath = joinURL(dstPath, file1);
1813
+ // ensure destination directory is cleaned up before it
1814
+ deleteEntry(dstDir, function () {
1815
+ // create a new directory entry to kick off it
1816
+ createDirectory(srcDir, function (directory) {
1817
+ // create a file within directory
1818
+ directory.getFile(file1, {
1819
+ create: true
1820
+ }, function () {
1821
+ // move srcDir to dstDir
1822
+ directory.moveTo(root, dstDir, function (dirEntry) {
1823
+ expect(dirEntry).toBeDefined();
1824
+ expect(dirEntry.isFile).toBe(false);
1825
+ expect(dirEntry.isDirectory).toBe(true);
1826
+ expect(dirEntry.fullPath).toCanonicallyMatch(dstPath);
1827
+ expect(dirEntry.name).toCanonicallyMatch(dstDir);
1828
+ // test that moved file exists in destination dir
1829
+ dirEntry.getFile(file1, {
1830
+ create: false
1831
+ }, function (fileEntry) {
1832
+ expect(fileEntry).toBeDefined();
1833
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
1834
+ // test that the moved file no longer exists in original dir
1835
+ root.getFile(file1, {
1836
+ create: false
1837
+ }, succeed.bind(null, done, 'root.getFile - Unexpected success callback, it should not get invalid or moved file: ' + file1), function (error) {
1838
+ expect(error).toBeDefined();
1839
+ if (isChrome) {
1840
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
1841
+ } else {
1842
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
1843
+ }
1844
+ // cleanup
1845
+ deleteEntry(srcDir, function () {
1846
+ deleteEntry(dstDir, done);
1847
+ });
1848
+ });
1849
+ }, failed.bind(null, done, 'directory.getFile - Error getting file : ' + file1 + ' from: ' + dstDir));
1850
+ }, failed.bind(null, done, 'directory.moveTo - Error moving directory : ' + srcDir + ' to root as: ' + dstDir));
1851
+ }, failed.bind(null, done, 'directory.getFile - Error creating file : ' + file1));
1852
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
1853
+ }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' + dstDir));
1854
+ });
1855
+
1856
+ it('file.spec.131 moveTo: directories tree to new parent', function (done) {
1857
+ if (isIndexedDBShim) {
1858
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1859
+ pending();
1860
+ }
1861
+
1862
+ var srcDir = 'entry.move.dnp.srcDir';
1863
+ var srcDirNestedFirst = 'entry.move.dnp.srcDir.Nested1';
1864
+ var srcDirNestedSecond = 'entry.move.dnp.srcDir.Nested2';
1865
+ var dstDir = 'entry.move.dnp.dstDir';
1866
+
1867
+ createDirectory(dstDir, function (dstDirectory) {
1868
+ createDirectory(srcDir, function (srcDirectory) {
1869
+ srcDirectory.getDirectory(srcDirNestedFirst, { create: true }, function () {
1870
+ srcDirectory.getDirectory(srcDirNestedSecond, { create: true }, function () {
1871
+ srcDirectory.moveTo(dstDirectory, srcDir, function successMove (transferredDirectory) {
1872
+ var directoryReader = transferredDirectory.createReader();
1873
+ directoryReader.readEntries(function successRead (entries) {
1874
+ expect(entries.length).toBe(2);
1875
+ if (!isChrome) {
1876
+ expect(entries[0].name).toBe(srcDirNestedFirst);
1877
+ expect(entries[1].name).toBe(srcDirNestedSecond);
1878
+ }
1879
+ deleteEntry(dstDir, done);
1880
+ }, failed.bind(null, done, 'Error getting entries from: ' + transferredDirectory));
1881
+ }, failed.bind(null, done, 'directory.moveTo - Error moving directory : ' + srcDir + ' to root as: ' + dstDir));
1882
+ }, failed.bind(null, done, 'directory.getDirectory - Error creating directory : ' + srcDirNestedSecond));
1883
+ }, failed.bind(null, done, 'directory.getDirectory - Error creating directory : ' + srcDirNestedFirst));
1884
+ }, failed.bind(null, done, 'createDirectory - Error creating source directory : ' + srcDir));
1885
+ }, failed.bind(null, done, 'createDirectory - Error creating dest directory : ' + dstDir));
1886
+ });
1887
+
1888
+ it('file.spec.70 moveTo: directory onto itself', function (done) {
1889
+ if (isIndexedDBShim) {
1890
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1891
+ pending();
1892
+ }
1893
+
1894
+ var file1 = 'file1';
1895
+ var srcDir = 'entry.move.dos.srcDir';
1896
+ var srcPath = joinURL(root.fullPath, srcDir);
1897
+ var filePath = joinURL(srcPath, file1);
1898
+ // create a new directory entry to kick off it
1899
+ createDirectory(srcDir, function (directory) {
1900
+ // create a file within new directory
1901
+ directory.getFile(file1, {
1902
+ create: true
1903
+ }, function () {
1904
+ // move srcDir onto itself
1905
+ directory.moveTo(root, null, succeed.bind(null, done, 'directory.moveTo - Unexpected success callback, it should not move directory to invalid path'), function (error) {
1906
+ expect(error).toBeDefined();
1907
+ if (isChrome) {
1908
+ // chrome returns unknown error with code 13
1909
+ } else {
1910
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
1911
+ }
1912
+ // test that original dir still exists
1913
+ root.getDirectory(srcDir, {
1914
+ create: false
1915
+ }, function (dirEntry) {
1916
+ // returning confirms existence so just check fullPath entry
1917
+ expect(dirEntry).toBeDefined();
1918
+ expect(dirEntry.fullPath).toCanonicallyMatch(srcPath);
1919
+ dirEntry.getFile(file1, {
1920
+ create: false
1921
+ }, function (fileEntry) {
1922
+ expect(fileEntry).toBeDefined();
1923
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
1924
+ // cleanup
1925
+ deleteEntry(srcDir, done);
1926
+ }, failed.bind(null, done, 'dirEntry.getFile - Error getting file : ' + file1 + ' from: ' + srcDir));
1927
+ }, failed.bind(null, done, 'root.getDirectory - Error getting directory : ' + srcDir));
1928
+ });
1929
+ }, failed.bind(null, done, 'directory.getFile - Error creating file : ' + file1));
1930
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
1931
+ });
1932
+ it('file.spec.71 moveTo: directory into itself', function (done) {
1933
+ if (isIndexedDBShim) {
1934
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1935
+ pending();
1936
+ }
1937
+
1938
+ var srcDir = 'entry.move.dis.srcDir';
1939
+ var dstDir = 'entry.move.dis.dstDir';
1940
+ var srcPath = joinURL(root.fullPath, srcDir);
1941
+ // create a new directory entry to kick off it
1942
+ createDirectory(srcDir, function (directory) {
1943
+ // move source directory into itself
1944
+ directory.moveTo(directory, dstDir, succeed.bind(null, done, 'directory.moveTo - Unexpected success callback, it should not move a directory into itself: ' + srcDir), function (error) {
1945
+ expect(error).toBeDefined();
1946
+ if (isChrome) {
1947
+ // chrome returns unknown error with code 13
1948
+ } else {
1949
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
1950
+ }
1951
+ // make sure original directory still exists
1952
+ root.getDirectory(srcDir, {
1953
+ create: false
1954
+ }, function (entry) {
1955
+ expect(entry).toBeDefined();
1956
+ expect(entry.fullPath).toCanonicallyMatch(srcPath);
1957
+ // cleanup
1958
+ deleteEntry(srcDir, done);
1959
+ }, failed.bind(null, done, 'root.getDirectory - Error getting directory, making sure that original directory still exists: ' + srcDir));
1960
+ });
1961
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
1962
+ });
1963
+ it('file.spec.130 moveTo: directory into similar directory', function (done) {
1964
+ if (isIndexedDBShim) {
1965
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
1966
+ pending();
1967
+ }
1968
+
1969
+ var srcDir = 'entry.move.dis.srcDir';
1970
+ var dstDir = 'entry.move.dis.srcDir-backup';
1971
+ // create a new directory entry to kick off it
1972
+ createDirectory(srcDir, function (srcDirEntry) {
1973
+ deleteEntry(dstDir, function () {
1974
+ createDirectory(dstDir, function (dstDirEntry) {
1975
+ // move source directory into itself
1976
+ srcDirEntry.moveTo(dstDirEntry, 'file', function (newDirEntry) {
1977
+ expect(newDirEntry).toBeDefined();
1978
+ deleteEntry(dstDir, done);
1979
+ }, failed.bind(null, done, 'directory.moveTo - Error moving a directory into a similarly-named directory: ' + srcDir));
1980
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + dstDir));
1981
+ }, failed.bind(null, done, 'deleteEntry - Error deleting directory : ' + dstDir));
1982
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
1983
+ });
1984
+ it('file.spec.72 moveTo: file onto itself', function (done) {
1985
+ var file1 = 'entry.move.fos.file1';
1986
+ var filePath = joinURL(root.fullPath, file1);
1987
+ // create a new file entry to kick off it
1988
+ createFile(file1, function (entry) {
1989
+ // move file1 onto itself
1990
+ entry.moveTo(root, null, succeed.bind(null, done, 'entry.moveTo - Unexpected success callback, it should not move a file: ' + file1 + ' into the same parent'), function (error) {
1991
+ expect(error).toBeDefined();
1992
+ if (isChrome) {
1993
+ // chrome returns unknown error with code 13
1994
+ } else {
1995
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
1996
+ }
1997
+ // test that original file still exists
1998
+ root.getFile(file1, {
1999
+ create: false
2000
+ }, function (fileEntry) {
2001
+ expect(fileEntry).toBeDefined();
2002
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
2003
+ // cleanup
2004
+ deleteEntry(file1, done);
2005
+ }, failed.bind(null, done, 'root.getFile - Error getting file, making sure that original file still exists: ' + file1));
2006
+ });
2007
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + file1));
2008
+ });
2009
+ it('file.spec.73 moveTo: file onto existing directory', function (done) {
2010
+ var file1 = 'entry.move.fod.file1';
2011
+ var dstDir = 'entry.move.fod.dstDir';
2012
+ var subDir = 'subDir';
2013
+ var dirPath = joinURL(joinURL(root.fullPath, dstDir), subDir);
2014
+ var filePath = joinURL(root.fullPath, file1);
2015
+ // ensure destination directory is cleaned up before it
2016
+ deleteEntry(dstDir, function () {
2017
+ // create a new file entry to kick off it
2018
+ createFile(file1, function (entry) {
2019
+ // create top level directory
2020
+ root.getDirectory(dstDir, {
2021
+ create: true
2022
+ }, function (directory) {
2023
+ // create sub-directory
2024
+ directory.getDirectory(subDir, {
2025
+ create: true
2026
+ }, function (subDirectory) {
2027
+ // move file1 onto sub-directory
2028
+ entry.moveTo(directory, subDir, succeed.bind(null, done, 'entry.moveTo - Unexpected success callback, it should not move a file: ' + file1 + ' into directory: ' + dstDir + '\n' + subDir + ' directory already exists'), function (error) {
2029
+ expect(error).toBeDefined();
2030
+ if (isChrome) {
2031
+ // chrome returns unknown error with code 13
2032
+ } else {
2033
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
2034
+ }
2035
+ // check that original dir still exists
2036
+ directory.getDirectory(subDir, {
2037
+ create: false
2038
+ }, function (dirEntry) {
2039
+ expect(dirEntry).toBeDefined();
2040
+ expect(dirEntry.fullPath).toCanonicallyMatch(dirPath);
2041
+ // check that original file still exists
2042
+ root.getFile(file1, {
2043
+ create: false
2044
+ }, function (fileEntry) {
2045
+ expect(fileEntry).toBeDefined();
2046
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
2047
+ // cleanup
2048
+ deleteEntry(file1, function () {
2049
+ deleteEntry(dstDir, done);
2050
+ });
2051
+ }, failed.bind(null, done, 'root.getFile - Error getting file, making sure that original file still exists: ' + file1));
2052
+ }, failed.bind(null, done, 'directory.getDirectory - Error getting directory, making sure that original directory still exists: ' + subDir));
2053
+ });
2054
+ }, failed.bind(null, done, 'directory.getDirectory - Error creating directory : ' + subDir));
2055
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory : ' + dstDir));
2056
+ }, failed.bind(null, done, 'createFile - Error creating file : ' + file1));
2057
+ }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' + dstDir));
2058
+ });
2059
+ it('file.spec.74 moveTo: directory onto existing file', function (done) {
2060
+ if (isIndexedDBShim) {
2061
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
2062
+ pending();
2063
+ }
2064
+
2065
+ var file1 = 'entry.move.dof.file1';
2066
+ var srcDir = 'entry.move.dof.srcDir';
2067
+ var dirPath = joinURL(root.fullPath, srcDir);
2068
+ var filePath = joinURL(root.fullPath, file1);
2069
+ // create a new directory entry to kick off it
2070
+ createDirectory(srcDir, function (entry) {
2071
+ // create file
2072
+ root.getFile(file1, {
2073
+ create: true
2074
+ }, function (fileEntry) {
2075
+ // move directory onto file
2076
+ entry.moveTo(root, file1, succeed.bind(null, done, 'entry.moveTo - Unexpected success callback, it should not move : \n' + srcDir + ' into root directory renamed as ' + file1 + '\n' + file1 + ' file already exists'), function (error) {
2077
+ expect(error).toBeDefined();
2078
+ if (isChrome) {
2079
+ // chrome returns unknown error with code 13
2080
+ } else {
2081
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
2082
+ }
2083
+ // test that original directory exists
2084
+ root.getDirectory(srcDir, {
2085
+ create: false
2086
+ }, function (dirEntry) {
2087
+ // returning confirms existence so just check fullPath entry
2088
+ expect(dirEntry).toBeDefined();
2089
+ expect(dirEntry.fullPath).toCanonicallyMatch(dirPath);
2090
+ // test that original file exists
2091
+ root.getFile(file1, {
2092
+ create: false
2093
+ }, function (fileEntry) {
2094
+ expect(fileEntry).toBeDefined();
2095
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
2096
+ // cleanup
2097
+ deleteEntry(file1, function () {
2098
+ deleteEntry(srcDir, done);
2099
+ });
2100
+ }, failed.bind(null, done, 'root.getFile - Error getting file, making sure that original file still exists: ' + file1));
2101
+ }, failed.bind(null, done, 'directory.getDirectory - Error getting directory, making sure that original directory still exists: ' + srcDir));
2102
+ });
2103
+ }, failed.bind(null, done, 'root.getFile - Error creating file : ' + file1));
2104
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
2105
+ });
2106
+ it('file.spec.75 copyTo: directory onto existing file', function (done) {
2107
+ if (isIndexedDBShim) {
2108
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
2109
+ pending();
2110
+ }
2111
+
2112
+ var file1 = 'entry.copy.dof.file1';
2113
+ var srcDir = 'entry.copy.dof.srcDir';
2114
+ var dirPath = joinURL(root.fullPath, srcDir);
2115
+ var filePath = joinURL(root.fullPath, file1);
2116
+ // create a new directory entry to kick off it
2117
+ createDirectory(srcDir, function (entry) {
2118
+ // create file
2119
+ root.getFile(file1, {
2120
+ create: true
2121
+ }, function () {
2122
+ // copy directory onto file
2123
+ entry.copyTo(root, file1, succeed.bind(null, done, 'entry.copyTo - Unexpected success callback, it should not copy : \n' + srcDir + ' into root directory renamed as ' + file1 + '\n' + file1 + ' file already exists'), function (error) {
2124
+ expect(error).toBeDefined();
2125
+ if (isChrome) {
2126
+ // chrome returns unknown error with code 13
2127
+ } else {
2128
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
2129
+ }
2130
+ // check that original dir still exists
2131
+ root.getDirectory(srcDir, {
2132
+ create: false
2133
+ }, function (dirEntry) {
2134
+ // returning confirms existence so just check fullPath entry
2135
+ expect(dirEntry).toBeDefined();
2136
+ expect(dirEntry.fullPath).toCanonicallyMatch(dirPath);
2137
+ // test that original file still exists
2138
+ root.getFile(file1, {
2139
+ create: false
2140
+ }, function (fileEntry) {
2141
+ expect(fileEntry).toBeDefined();
2142
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
2143
+ // cleanup
2144
+ deleteEntry(file1, function () {
2145
+ deleteEntry(srcDir, done);
2146
+ });
2147
+ }, failed.bind(null, done, 'root.getFile - Error getting file, making sure that original file still exists: ' + file1));
2148
+ }, failed.bind(null, done, 'root.getDirectory - Error getting directory, making sure that original directory still exists: ' + srcDir));
2149
+ });
2150
+ }, failed.bind(null, done, 'root.getFile - Error creating file : ' + file1));
2151
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
2152
+ });
2153
+ it('file.spec.76 moveTo: directory onto directory that is not empty', function (done) {
2154
+ if (isIndexedDBShim) {
2155
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
2156
+ pending();
2157
+ }
2158
+
2159
+ var srcDir = 'entry.move.dod.srcDir';
2160
+ var dstDir = 'entry.move.dod.dstDir';
2161
+ var subDir = 'subDir';
2162
+ var srcPath = joinURL(root.fullPath, srcDir);
2163
+ var dstPath = joinURL(joinURL(root.fullPath, dstDir), subDir);
2164
+ // ensure destination directory is cleaned up before it
2165
+ deleteEntry(dstDir, function () {
2166
+ // create a new file entry to kick off it
2167
+ createDirectory(srcDir, function (entry) {
2168
+ // create top level directory
2169
+ root.getDirectory(dstDir, {
2170
+ create: true
2171
+ }, function (directory) {
2172
+ // create sub-directory
2173
+ directory.getDirectory(subDir, {
2174
+ create: true
2175
+ }, function () {
2176
+ // move srcDir onto dstDir (not empty)
2177
+ entry.moveTo(root, dstDir, succeed.bind(null, done, 'entry.moveTo - Unexpected success callback, it should not copy : \n' + srcDir + ' into root directory renamed as ' + dstDir + '\n' + dstDir + ' directory already exists'), function (error) {
2178
+ expect(error).toBeDefined();
2179
+ if (isChrome) {
2180
+ // chrome returns unknown error with code 13
2181
+ } else {
2182
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
2183
+ }
2184
+ // making sure destination directory still exists
2185
+ directory.getDirectory(subDir, {
2186
+ create: false
2187
+ }, function (dirEntry) {
2188
+ // returning confirms existence so just check fullPath entry
2189
+ expect(dirEntry).toBeDefined();
2190
+ expect(dirEntry.fullPath).toCanonicallyMatch(dstPath);
2191
+ // making sure source directory exists
2192
+ root.getDirectory(srcDir, {
2193
+ create: false
2194
+ }, function (srcEntry) {
2195
+ expect(srcEntry).toBeDefined();
2196
+ expect(srcEntry.fullPath).toCanonicallyMatch(srcPath);
2197
+ // cleanup
2198
+ deleteEntry(srcDir, function () {
2199
+ deleteEntry(dstDir, done);
2200
+ });
2201
+ }, failed.bind(null, done, 'root.getDirectory - Error getting directory, making sure that original directory still exists: ' + srcDir));
2202
+ }, failed.bind(null, done, 'directory.getDirectory - Error getting directory, making sure that original directory still exists: ' + subDir));
2203
+ });
2204
+ }, failed.bind(null, done, 'directory.getDirectory - Error creating directory : ' + subDir));
2205
+ }, failed.bind(null, done, 'directory.getDirectory - Error creating directory : ' + subDir));
2206
+ }, failed.bind(null, done, 'createDirectory - Error creating directory : ' + srcDir));
2207
+ }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' + dstDir));
2208
+ });
2209
+ it('file.spec.77 moveTo: file replace existing file', function (done) {
2210
+ var file1 = 'entry.move.frf.file1';
2211
+ var file2 = 'entry.move.frf.file2';
2212
+ var file2Path = joinURL(root.fullPath, file2);
2213
+ // create a new directory entry to kick off it
2214
+ createFile(file1, function (entry) {
2215
+ // create file
2216
+ root.getFile(file2, {
2217
+ create: true
2218
+ }, function () {
2219
+ // replace file2 with file1
2220
+ entry.moveTo(root, file2, function (entry2) {
2221
+ expect(entry2).toBeDefined();
2222
+ expect(entry2.isFile).toBe(true);
2223
+ expect(entry2.isDirectory).toBe(false);
2224
+ expect(entry2.fullPath).toCanonicallyMatch(file2Path);
2225
+ expect(entry2.name).toCanonicallyMatch(file2);
2226
+ // old file should not exists
2227
+ root.getFile(file1, {
2228
+ create: false
2229
+ }, succeed.bind(null, done, 'root.getFile - Unexpected success callback, file: ' + file1 + ' should not exists'), function (error) {
2230
+ expect(error).toBeDefined();
2231
+ if (isChrome) {
2232
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
2233
+ } else {
2234
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
2235
+ }
2236
+ // test that new file exists
2237
+ root.getFile(file2, {
2238
+ create: false
2239
+ }, function (fileEntry) {
2240
+ expect(fileEntry).toBeDefined();
2241
+ expect(fileEntry.fullPath).toCanonicallyMatch(file2Path);
2242
+ // cleanup
2243
+ deleteEntry(file1, function () {
2244
+ deleteEntry(file2, done);
2245
+ });
2246
+ }, failed.bind(null, done, 'root.getFile - Error getting moved file: ' + file2));
2247
+ });
2248
+ }, failed.bind(null, done, 'entry.moveTo - Error moving file : ' + file1 + ' to root as: ' + file2));
2249
+ }, failed.bind(null, done, 'root.getFile - Error creating file: ' + file2));
2250
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + file1));
2251
+ });
2252
+ it('file.spec.78 moveTo: directory replace empty directory', function (done) {
2253
+ if (isIndexedDBShim) {
2254
+ /* `copyTo` and `moveTo` functions do not support directories (Firefox, IE) */
2255
+ pending();
2256
+ }
2257
+
2258
+ var file1 = 'file1';
2259
+ var srcDir = 'entry.move.drd.srcDir';
2260
+ var dstDir = 'entry.move.drd.dstDir';
2261
+ var dstPath = joinURL(root.fullPath, dstDir);
2262
+ var filePath = dstPath + '/' + file1;
2263
+ // ensure destination directory is cleaned up before it
2264
+ deleteEntry(dstDir, function () {
2265
+ // create a new directory entry to kick off it
2266
+ createDirectory(srcDir, function (directory) {
2267
+ // create a file within source directory
2268
+ directory.getFile(file1, {
2269
+ create: true
2270
+ }, function () {
2271
+ // create destination directory
2272
+ root.getDirectory(dstDir, {
2273
+ create: true
2274
+ }, function () {
2275
+ // move srcDir to dstDir
2276
+ directory.moveTo(root, dstDir, function (dirEntry) {
2277
+ expect(dirEntry).toBeDefined();
2278
+ expect(dirEntry.isFile).toBe(false);
2279
+ expect(dirEntry.isDirectory).toBe(true);
2280
+ expect(dirEntry.fullPath).toCanonicallyMatch(dstPath);
2281
+ expect(dirEntry.name).toCanonicallyMatch(dstDir);
2282
+ // check that old directory contents have been moved
2283
+ dirEntry.getFile(file1, {
2284
+ create: false
2285
+ }, function (fileEntry) {
2286
+ expect(fileEntry).toBeDefined();
2287
+ expect(fileEntry.fullPath).toCanonicallyMatch(filePath);
2288
+ // check that old directory no longer exists
2289
+ root.getDirectory(srcDir, {
2290
+ create: false
2291
+ }, succeed.bind(null, done, 'root.getDirectory - Unexpected success callback, directory: ' + srcDir + ' should not exists'), function (error) {
2292
+ expect(error).toBeDefined();
2293
+ if (isChrome) {
2294
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
2295
+ } else {
2296
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
2297
+ }
2298
+ // cleanup
2299
+ deleteEntry(srcDir, function () {
2300
+ deleteEntry(dstDir, done);
2301
+ });
2302
+ });
2303
+ }, failed.bind(null, done, 'dirEntry.getFile - Error getting moved file: ' + file1));
2304
+ }, failed.bind(null, done, 'entry.moveTo - Error moving directory : ' + srcDir + ' to root as: ' + dstDir));
2305
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory: ' + dstDir));
2306
+ }, failed.bind(null, done, 'root.getFile - Error creating file: ' + file1));
2307
+ }, failed.bind(null, done, 'createDirectory - Error creating directory: ' + srcDir));
2308
+ }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' + dstDir));
2309
+ });
2310
+ it('file.spec.79 moveTo: directory that does not exist', function (done) {
2311
+ if (isChrome) {
2312
+ pending('chrome freak out about non-existend dir not being a DirectoryEntry');
2313
+ }
2314
+ var file1 = 'entry.move.dnf.file1';
2315
+ var dstDir = 'entry.move.dnf.dstDir';
2316
+ var dstPath = joinURL(root.fullPath, dstDir);
2317
+ // create a new file entry to kick off it
2318
+ createFile(file1, function (entry) {
2319
+ // move file to directory that does not exist
2320
+ var directory = new DirectoryEntry(); // eslint-disable-line no-undef
2321
+ directory.filesystem = root.filesystem;
2322
+ directory.fullPath = dstPath;
2323
+ entry.moveTo(directory, null, succeed.bind(null, done, 'entry.moveTo - Unexpected success callback, parent directory: ' + dstPath + ' should not exists'), function (error) {
2324
+ expect(error).toBeDefined();
2325
+ if (isChrome) {
2326
+ /* INVALID_MODIFICATION_ERR (code: 9) is thrown instead of NOT_FOUND_ERR(code: 1)
2327
+ on trying to moveTo directory that does not exist. */
2328
+ expect(error).toBeFileError(FileError.INVALID_MODIFICATION_ERR); // eslint-disable-line no-undef
2329
+ } else {
2330
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
2331
+ }
2332
+ // cleanup
2333
+ deleteEntry(file1, done);
2334
+ });
2335
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + file1));
2336
+ });
2337
+ it('file.spec.80 moveTo: invalid target name', function (done) {
2338
+ if (isBrowser) {
2339
+ /* The plugin does not follow ["8.3 Naming restrictions"]
2340
+ (http://www.w3.org/TR/2011/WD-file-system-api-20110419/#naming-restrictions */
2341
+ pending();
2342
+ }
2343
+
2344
+ var file1 = 'entry.move.itn.file1';
2345
+ var file2 = 'bad:file:name';
2346
+ // create a new file entry to kick off it
2347
+ createFile(file1, function (entry) {
2348
+ // move file1 to file2
2349
+ entry.moveTo(root, file2, succeed.bind(null, done, 'entry.moveTo - Unexpected success callback, : ' + file1 + ' to root as: ' + file2), function (error) {
2350
+ expect(error).toBeDefined();
2351
+ expect(error).toBeFileError(FileError.ENCODING_ERR); // eslint-disable-line no-undef
2352
+ // cleanup
2353
+ deleteEntry(file1, done);
2354
+ });
2355
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + file1));
2356
+ });
2357
+ });
2358
+ // Entry
2359
+ describe('FileReader', function () {
2360
+ it('file.spec.81 should have correct methods', function () {
2361
+ var reader = new FileReader(); // eslint-disable-line no-undef
2362
+ expect(reader).toBeDefined();
2363
+ expect(typeof reader.readAsBinaryString).toBe('function');
2364
+ expect(typeof reader.readAsDataURL).toBe('function');
2365
+ expect(typeof reader.readAsText).toBe('function');
2366
+ expect(typeof reader.readAsArrayBuffer).toBe('function');
2367
+ expect(typeof reader.abort).toBe('function');
2368
+ expect(reader.result).toBe(null);
2369
+ });
2370
+ });
2371
+ // FileReader
2372
+ describe('Read method', function () {
2373
+ it('file.spec.82 should error out on non-existent file', function (done) {
2374
+ var fileName = cordova.platformId === 'windowsphone' ? root.toURL() + '/' + 'somefile.txt' : 'somefile.txt'; // eslint-disable-line no-undef
2375
+ var verifier = function (evt) {
2376
+ expect(evt).toBeDefined();
2377
+ if (isChrome) {
2378
+ expect(evt.target.error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
2379
+ } else {
2380
+ expect(evt.target.error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
2381
+ }
2382
+ done();
2383
+ };
2384
+ root.getFile(fileName, {
2385
+ create: true
2386
+ }, function (entry) {
2387
+ entry.file(function (file) {
2388
+ deleteEntry(fileName, function () {
2389
+ // Create FileReader
2390
+ var reader = new FileReader(); // eslint-disable-line no-undef
2391
+ reader.onerror = verifier;
2392
+ reader.onload = succeed.bind(null, done, 'reader.onload - Unexpected success callback, file: ' + fileName + ' it should not exists');
2393
+ reader.readAsText(file);
2394
+ }, failed.bind(null, done, 'deleteEntry - Error removing file: ' + fileName));
2395
+ }, failed.bind(null, done, 'entry.file - Error reading file: ' + fileName));
2396
+ }, failed.bind(null, done, 'root.getFile - Error creating file: ' + fileName));
2397
+ });
2398
+ it('file.spec.83 should be able to read native blob objects', function (done) {
2399
+ // Skip test if blobs are not supported (e.g.: Android 2.3).
2400
+ if (typeof window.Blob === 'undefined' || typeof window.Uint8Array === 'undefined') {
2401
+ expect(true).toFailWithMessage('Platform does not supported this feature');
2402
+ done();
2403
+ }
2404
+ var contents = 'asdf';
2405
+ var uint8Array = new Uint8Array(contents.length);
2406
+ for (var i = 0; i < contents.length; ++i) {
2407
+ uint8Array[i] = contents.charCodeAt(i);
2408
+ }
2409
+ var Builder = window.BlobBuilder || window.WebKitBlobBuilder;
2410
+ var blob;
2411
+ if (Builder) {
2412
+ var builder = new Builder();
2413
+ builder.append(uint8Array.buffer);
2414
+ builder.append(contents);
2415
+ blob = builder.getBlob('text/plain');
2416
+ } else {
2417
+ try {
2418
+ // iOS 6 does not support Views, so pass in the buffer.
2419
+ blob = new Blob([uint8Array.buffer, contents]); // eslint-disable-line no-undef
2420
+ } catch (e) {
2421
+ // Skip the test if we can't create a blob (e.g.: iOS 5).
2422
+ if (e instanceof TypeError) {
2423
+ expect(true).toFailWithMessage('Platform does not supported this feature');
2424
+ done();
2425
+ }
2426
+ throw e;
2427
+ }
2428
+ }
2429
+ var verifier = function (evt) {
2430
+ expect(evt).toBeDefined();
2431
+ expect(evt.target.result).toBe('asdfasdf');
2432
+ done();
2433
+ };
2434
+ var reader = new FileReader(); // eslint-disable-line no-undef
2435
+ reader.onloadend = verifier;
2436
+ reader.readAsText(blob);
2437
+ });
2438
+ function writeDummyFile (writeBinary, callback, done, fileContents) {
2439
+ var fileName = 'dummy.txt';
2440
+ var fileEntry = null;
2441
+ // use default string if file data is not provided
2442
+ var fileData = fileContents !== undefined ? fileContents :
2443
+ '\u20AC\xEB - There is an exception to every rule. Except this one.';
2444
+ var fileDataAsBinaryString = fileContents !== undefined ? fileContents :
2445
+ '\xe2\x82\xac\xc3\xab - There is an exception to every rule. Except this one.';
2446
+
2447
+ function createWriter (fe) {
2448
+ fileEntry = fe;
2449
+ fileEntry.createWriter(writeFile, failed.bind(null, done, 'fileEntry.createWriter - Error reading file: ' + fileName));
2450
+ }
2451
+
2452
+ // writes file and reads it back in
2453
+ function writeFile (writer) {
2454
+ writer.onwriteend = function () {
2455
+ fileEntry.file(function (f) {
2456
+ callback(fileEntry, f, fileData, fileDataAsBinaryString);
2457
+ }, failed.bind(null, done, 'writer.onwriteend - Error writing data on file: ' + fileName));
2458
+ };
2459
+ writer.write(fileData);
2460
+ }
2461
+
2462
+ fileData += writeBinary ? 'bin:\x01\x00' : '';
2463
+ fileDataAsBinaryString += writeBinary ? 'bin:\x01\x00' : '';
2464
+ // create a file, write to it, and read it in again
2465
+ createFile(fileName, createWriter, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
2466
+ }
2467
+ function runReaderTest (funcName, writeBinary, done, progressFunc, verifierFunc, sliceStart, sliceEnd, fileContents) {
2468
+ writeDummyFile(writeBinary, function (fileEntry, file, fileData, fileDataAsBinaryString) {
2469
+ var verifier = function (evt) {
2470
+ expect(evt).toBeDefined();
2471
+ verifierFunc(evt, fileData, fileDataAsBinaryString);
2472
+ };
2473
+ var reader = new FileReader(); // eslint-disable-line no-undef
2474
+ reader.onprogress = progressFunc;
2475
+ reader.onload = verifier;
2476
+ reader.onerror = failed.bind(null, done, 'reader.onerror - Error reading file: ' + file + ' using function: ' + funcName);
2477
+ if (sliceEnd !== undefined) {
2478
+ // 'type' is specified so that is will be preserved in the resulting file:
2479
+ // http://www.w3.org/TR/FileAPI/#slice-method-algo -> "6.4.1. The slice method" -> 4. A), 6. c)
2480
+ file = file.slice(sliceStart, sliceEnd, file.type);
2481
+ } else if (sliceStart !== undefined) {
2482
+ file = file.slice(sliceStart, file.size, file.type);
2483
+ }
2484
+ reader[funcName](file);
2485
+ }, done, fileContents);
2486
+ }
2487
+ function arrayBufferEqualsString (ab, str) {
2488
+ var buf = new Uint8Array(ab);
2489
+ var match = buf.length === str.length;
2490
+ for (var i = 0; match && i < buf.length; i++) {
2491
+ match = buf[i] === str.charCodeAt(i);
2492
+ }
2493
+ return match;
2494
+ }
2495
+ it('file.spec.84 should read file properly, readAsText', function (done) {
2496
+ runReaderTest('readAsText', false, done, null, function (evt, fileData, fileDataAsBinaryString) {
2497
+ expect(evt.target.result).toBe(fileData);
2498
+ done();
2499
+ });
2500
+ });
2501
+ it('file.spec.84.1 should read JSON file properly, readAsText', function (done) {
2502
+ var testObject = {key1: 'value1', key2: 2};
2503
+ runReaderTest('readAsText', false, done, null, function (evt, fileData, fileDataAsBinaryString) {
2504
+ expect(evt.target.result).toEqual(JSON.stringify(testObject));
2505
+ done();
2506
+ }, undefined, undefined, JSON.stringify(testObject));
2507
+ });
2508
+ it('file.spec.85 should read file properly, Data URI', function (done) {
2509
+ runReaderTest('readAsDataURL', true, done, null, function (evt, fileData, fileDataAsBinaryString) {
2510
+ /* `readAsDataURL` function is supported, but the mediatype in Chrome depends on entry name extension,
2511
+ mediatype in IE is always empty (which is the same as `text-plain` according the specification),
2512
+ the mediatype in Firefox is always `application/octet-stream`.
2513
+ For example, if the content is `abcdefg` then Firefox returns `data:application/octet-stream;base64,YWJjZGVmZw==`,
2514
+ IE returns `data:;base64,YWJjZGVmZw==`, Chrome returns `data:<mediatype depending on extension of entry name>;base64,YWJjZGVmZw==`. */
2515
+ expect(evt.target.result).toBeDataUrl();
2516
+
2517
+ // The atob function it is completely ignored during mobilespec execution, besides the returned object: evt
2518
+ // it is encoded and the atob function is aimed to decode a string. Even with btoa (encode) the function it gets stucked
2519
+ // because of the Unicode characters that contains the fileData object.
2520
+ // Issue reported at JIRA with all the details: CB-7095
2521
+
2522
+ // expect(evt.target.result.slice(23)).toBe(atob(fileData));
2523
+
2524
+ done();
2525
+ });
2526
+ });
2527
+ it('file.spec.86 should read file properly, readAsBinaryString', function (done) {
2528
+ if (isIE) {
2529
+ /* `readAsBinaryString` function is not supported by IE and has not the stub. */
2530
+ pending();
2531
+ }
2532
+
2533
+ runReaderTest('readAsBinaryString', true, done, null, function (evt, fileData, fileDataAsBinaryString) {
2534
+ expect(evt.target.result).toBe(fileDataAsBinaryString);
2535
+ done();
2536
+ });
2537
+ });
2538
+ it('file.spec.87 should read file properly, readAsArrayBuffer', function (done) {
2539
+ // Skip test if ArrayBuffers are not supported (e.g.: Android 2.3).
2540
+ if (typeof window.ArrayBuffer === 'undefined') {
2541
+ expect(true).toFailWithMessage('Platform does not supported this feature');
2542
+ done();
2543
+ }
2544
+ runReaderTest('readAsArrayBuffer', true, done, null, function (evt, fileData, fileDataAsBinaryString) {
2545
+ expect(arrayBufferEqualsString(evt.target.result, fileDataAsBinaryString)).toBe(true);
2546
+ done();
2547
+ });
2548
+ });
2549
+ it('file.spec.88 should read sliced file: readAsText', function (done) {
2550
+ runReaderTest('readAsText', false, done, null, function (evt, fileData, fileDataAsBinaryString) {
2551
+ expect(evt.target.result).toBe(fileDataAsBinaryString.slice(10, 40));
2552
+ done();
2553
+ }, 10, 40);
2554
+ });
2555
+ it('file.spec.89 should read sliced file: slice past eof', function (done) {
2556
+ runReaderTest('readAsText', false, done, null, function (evt, fileData, fileDataAsBinaryString) {
2557
+ expect(evt.target.result).toBe(fileData.slice(-5, 9999));
2558
+ done();
2559
+ }, -5, 9999);
2560
+ });
2561
+ it('file.spec.90 should read sliced file: slice to eof', function (done) {
2562
+ runReaderTest('readAsText', false, done, null, function (evt, fileData, fileDataAsBinaryString) {
2563
+ expect(evt.target.result).toBe(fileData.slice(-5));
2564
+ done();
2565
+ }, -5);
2566
+ });
2567
+ it('file.spec.91 should read empty slice', function (done) {
2568
+ runReaderTest('readAsText', false, done, null, function (evt, fileData, fileDataAsBinaryString) {
2569
+ expect(evt.target.result).toBe('');
2570
+ done();
2571
+ }, 0, 0);
2572
+ });
2573
+ it('file.spec.92 should read sliced file properly, readAsDataURL', function (done) {
2574
+ runReaderTest('readAsDataURL', true, done, null, function (evt, fileData, fileDataAsBinaryString) {
2575
+ /* `readAsDataURL` function is supported, but the mediatype in Chrome depends on entry name extension,
2576
+ mediatype in IE is always empty (which is the same as `text-plain` according the specification),
2577
+ the mediatype in Firefox is always `application/octet-stream`.
2578
+ For example, if the content is `abcdefg` then Firefox returns `data:application/octet-stream;base64,YWJjZGVmZw==`,
2579
+ IE returns `data:;base64,YWJjZGVmZw==`, Chrome returns `data:<mediatype depending on extension of entry name>;base64,YWJjZGVmZw==`. */
2580
+ expect(evt.target.result).toBeDataUrl();
2581
+
2582
+ // The atob function it is completely ignored during mobilespec execution, besides the returned object: evt
2583
+ // it is encoded and the atob function is aimed to decode a string. Even with btoa (encode) the function it gets stucked
2584
+ // because of the Unicode characters that contains the fileData object.
2585
+ // Issue reported at JIRA with all the details: CB-7095
2586
+
2587
+ // expect(evt.target.result.slice(23)).toBe(atob(fileDataAsBinaryString.slice(10, -3)));
2588
+
2589
+ done();
2590
+ }, 10, -3);
2591
+ });
2592
+ it('file.spec.93 should read sliced file properly, readAsBinaryString', function (done) {
2593
+ if (isIE) {
2594
+ /* `readAsBinaryString` function is not supported by IE and has not the stub. */
2595
+ pending();
2596
+ }
2597
+
2598
+ runReaderTest('readAsBinaryString', true, done, null, function (evt, fileData, fileDataAsBinaryString) {
2599
+ expect(evt.target.result).toBe(fileDataAsBinaryString.slice(-10, -5));
2600
+ done();
2601
+ }, -10, -5);
2602
+ });
2603
+ it('file.spec.94 should read sliced file properly, readAsArrayBuffer', function (done) {
2604
+ // Skip test if ArrayBuffers are not supported (e.g.: Android 2.3).
2605
+ if (typeof window.ArrayBuffer === 'undefined') {
2606
+ expect(true).toFailWithMessage('Platform does not supported this feature');
2607
+ done();
2608
+ }
2609
+ runReaderTest('readAsArrayBuffer', true, done, null, function (evt, fileData, fileDataAsBinaryString) {
2610
+ expect(arrayBufferEqualsString(evt.target.result, fileDataAsBinaryString.slice(0, -1))).toBe(true);
2611
+ done();
2612
+ }, 0, -1);
2613
+ });
2614
+ it('file.spec.94.5 should read large file in multiple chunks, readAsArrayBuffer', function (done) {
2615
+ // Skip test if ArrayBuffers are not supported (e.g.: Android 2.3).
2616
+ if (typeof window.ArrayBuffer === 'undefined') {
2617
+ expect(true).toFailWithMessage('Platform does not supported this feature');
2618
+ done();
2619
+ }
2620
+
2621
+ var largeText = '';
2622
+ for (var i = 0; i < 1000; i++) {
2623
+ largeText += 'Test ' + i + '\n';
2624
+ }
2625
+
2626
+ // Set the chunk size so that the read will take 5 chunks
2627
+ FileReader.READ_CHUNK_SIZE = Math.floor(largeText.length / 4) + 1; // eslint-disable-line no-undef
2628
+
2629
+ var chunkCount = 0;
2630
+ var lastProgressValue = -1;
2631
+ var progressFunc = function (evt) {
2632
+ expect(evt.loaded).toBeDefined();
2633
+ expect(evt.total).toBeDefined();
2634
+
2635
+ expect(evt.total >= largeText.length).toBe(true);
2636
+ expect(evt.total <= largeText.length + 5).toBe(true);
2637
+ expect(evt.loaded > lastProgressValue).toBe(true);
2638
+ expect(evt.loaded <= evt.total).toBe(true);
2639
+
2640
+ lastProgressValue = evt.loaded;
2641
+ chunkCount++;
2642
+ };
2643
+
2644
+ runReaderTest(
2645
+ 'readAsArrayBuffer', true, done, progressFunc,
2646
+ function (evt, fileData, fileDataAsBinaryString) {
2647
+ expect(arrayBufferEqualsString(evt.target.result, fileDataAsBinaryString.slice(0, -1))).toBe(true);
2648
+ expect(lastProgressValue >= largeText.length).toBe(true);
2649
+ expect(lastProgressValue <= largeText.length + 5).toBe(true);
2650
+ if (!isChrome) {
2651
+ // chrome downloads it in one chunk -.-
2652
+ expect(chunkCount).toBe(5);
2653
+ }
2654
+ done();
2655
+ },
2656
+ 0, -1, largeText);
2657
+ });
2658
+ it('file.spec.94.6 should read large file in multiple chunks, readAsDataURL', function (done) {
2659
+ var largeText = '';
2660
+ for (var i = 0; i < 10; i++) {
2661
+ largeText += 'Test ' + i + '\n';
2662
+ }
2663
+
2664
+ // Set the chunk size so that the read will take 5 chunks
2665
+ FileReader.READ_CHUNK_SIZE = Math.floor(largeText.length / 4) + 1; // eslint-disable-line no-undef
2666
+
2667
+ var lastProgressValue = 0;
2668
+ var progressFunc = function (evt) {
2669
+ expect(evt.total).toBeDefined();
2670
+ expect(evt.total).toEqual(largeText.length);
2671
+
2672
+ expect(evt.loaded).toBeDefined();
2673
+ expect(evt.loaded).toBeGreaterThan(lastProgressValue);
2674
+ expect(evt.loaded).toBeLessThan(evt.total + 1);
2675
+
2676
+ lastProgressValue = evt.loaded;
2677
+ };
2678
+
2679
+ runReaderTest('readAsDataURL', false, done, progressFunc,
2680
+ function (evt, fileData, fileDataAsBinaryString) {
2681
+ expect(function () {
2682
+ // Cut off data uri prefix
2683
+ var base64Data = evt.target.result.substring(evt.target.result.indexOf(',') + 1);
2684
+ expect(window.atob(base64Data)).toEqual(fileData);
2685
+ }).not.toThrow();
2686
+
2687
+ expect(lastProgressValue).toEqual(largeText.length);
2688
+ done();
2689
+ },
2690
+ undefined, undefined, largeText);
2691
+ });
2692
+ });
2693
+ // Read method
2694
+ describe('FileWriter', function () {
2695
+ it('file.spec.95 should have correct methods', function (done) {
2696
+ // retrieve a FileWriter object
2697
+ var fileName = 'writer.methods';
2698
+ // FileWriter
2699
+ root.getFile(fileName, {
2700
+ create: true
2701
+ }, function (fileEntry) {
2702
+ fileEntry.createWriter(function (writer) {
2703
+ expect(writer).toBeDefined();
2704
+ expect(typeof writer.write).toBe('function');
2705
+ expect(typeof writer.seek).toBe('function');
2706
+ expect(typeof writer.truncate).toBe('function');
2707
+ expect(typeof writer.abort).toBe('function');
2708
+ // cleanup
2709
+ deleteFile(fileName, done);
2710
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
2711
+ }, failed.bind(null, done, 'root.getFile - Error creating file: ' + fileName));
2712
+ });
2713
+ it('file.spec.96 should be able to write and append to file, createWriter', function (done) {
2714
+ var fileName = 'writer.append.createWriter'; // file content
2715
+ var content = 'There is an exception to every rule.'; // for checkin file length
2716
+ var exception = ' Except this one.';
2717
+ var length = content.length;
2718
+ // create file, then write and append to it
2719
+ createFile(fileName, function (fileEntry) {
2720
+ // writes initial file content
2721
+ fileEntry.createWriter(function (writer) {
2722
+ // Verifiers declaration
2723
+ function verifier (evt) {
2724
+ expect(writer.length).toBe(length);
2725
+ expect(writer.position).toBe(length);
2726
+ // Append some more data
2727
+ writer.onwriteend = secondVerifier;
2728
+ length += exception.length;
2729
+ writer.seek(writer.length);
2730
+ writer.write(exception);
2731
+ }
2732
+ function secondVerifier (evt) {
2733
+ expect(writer.length).toBe(length);
2734
+ expect(writer.position).toBe(length);
2735
+ var reader = new FileReader(); // eslint-disable-line no-undef
2736
+ reader.onloadend = thirdVerifier;
2737
+ reader.onerror = failed.bind(null, done, 'reader.onerror - Error reading file: ' + fileName);
2738
+ fileEntry.file(function (f) { reader.readAsText(f); });
2739
+ }
2740
+ function thirdVerifier (evt) {
2741
+ expect(evt.target.result).toBe(content + exception);
2742
+ // cleanup
2743
+ deleteFile(fileName, done);
2744
+ }
2745
+
2746
+ // Write process
2747
+ writer.onwriteend = verifier;
2748
+ writer.write(content);
2749
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
2750
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
2751
+ });
2752
+ it('file.spec.97 should be able to write and append to file, File object', function (done) {
2753
+ var fileName = 'writer.append.File'; // file content
2754
+ var content = 'There is an exception to every rule.'; // for checkin file length
2755
+ var exception = ' Except this one.';
2756
+ var length = content.length;
2757
+ root.getFile(fileName, {
2758
+ create: true
2759
+ }, function (fileEntry) {
2760
+ fileEntry.createWriter(function (writer) {
2761
+ // Verifiers declaration
2762
+ function verifier () {
2763
+ expect(writer.length).toBe(length);
2764
+ expect(writer.position).toBe(length);
2765
+ // Append some more data
2766
+ writer.onwriteend = secondVerifier;
2767
+ length += exception.length;
2768
+ writer.seek(writer.length);
2769
+ writer.write(exception);
2770
+ }
2771
+ function secondVerifier () {
2772
+ expect(writer.length).toBe(length);
2773
+ expect(writer.position).toBe(length);
2774
+ var reader = new FileReader(); // eslint-disable-line no-undef
2775
+ reader.onloadend = thirdVerifier;
2776
+ reader.onerror = failed.bind(null, done, 'reader.onerror - Error reading file: ' + fileName);
2777
+ fileEntry.file(function (f) { reader.readAsText(f); });
2778
+ }
2779
+ function thirdVerifier (evt) {
2780
+ expect(evt.target.result).toBe(content + exception);
2781
+ // cleanup
2782
+ deleteFile(fileName, done);
2783
+ }
2784
+
2785
+ // Write process
2786
+ writer.onwriteend = verifier;
2787
+ writer.write(content);
2788
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
2789
+ }, failed.bind(null, done, 'root.getFile - Error creating file: ' + fileName));
2790
+ });
2791
+ it('file.spec.98 should be able to seek to the middle of the file and write more data than file.length', function (done) {
2792
+ var fileName = 'writer.seek.write'; // file content
2793
+ var content = 'This is our sentence.'; // for checking file length
2794
+ var exception = 'newer sentence.';
2795
+ var length = content.length;
2796
+ // create file, then write and append to it
2797
+ createFile(fileName, function (fileEntry) {
2798
+ fileEntry.createWriter(function (writer) {
2799
+ // Verifiers declaration
2800
+ function verifier (evt) {
2801
+ expect(writer.length).toBe(length);
2802
+ expect(writer.position).toBe(length);
2803
+ // Append some more data
2804
+ writer.onwriteend = secondVerifier;
2805
+ length = 12 + exception.length;
2806
+ writer.seek(12);
2807
+ writer.write(exception);
2808
+ }
2809
+ function secondVerifier (evt) {
2810
+ expect(writer.length).toBe(length);
2811
+ expect(writer.position).toBe(length);
2812
+ var reader = new FileReader(); // eslint-disable-line no-undef
2813
+ reader.onloadend = thirdVerifier;
2814
+ reader.onerror = failed.bind(null, done, 'reader.onerror - Error reading file: ' + fileName);
2815
+ fileEntry.file(function (f) { reader.readAsText(f); });
2816
+ }
2817
+ function thirdVerifier (evt) {
2818
+ expect(evt.target.result).toBe(content.substr(0, 12) + exception);
2819
+ // cleanup
2820
+ deleteFile(fileName, done);
2821
+ }
2822
+
2823
+ // Write process
2824
+ writer.onwriteend = verifier;
2825
+ writer.write(content);
2826
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
2827
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
2828
+ });
2829
+ it('file.spec.99 should be able to seek to the middle of the file and write less data than file.length', function (done) {
2830
+ if (isBrowser) {
2831
+ /* Browser (re)writes as follows: "This is our sentence." -> "This is new.sentence.",
2832
+ i.e. the length is not being changed from content.length and writer length will be equal 21 */
2833
+ pending();
2834
+ }
2835
+
2836
+ var fileName = 'writer.seek.write2'; // file content
2837
+ var content = 'This is our sentence.'; // for checking file length
2838
+ var exception = 'new.';
2839
+ var length = content.length;
2840
+ // create file, then write and append to it
2841
+ createFile(fileName, function (fileEntry) {
2842
+ fileEntry.createWriter(function (writer) {
2843
+ // Verifiers declaration
2844
+ function verifier (evt) {
2845
+ expect(writer.length).toBe(length);
2846
+ expect(writer.position).toBe(length);
2847
+ // Append some more data
2848
+ writer.onwriteend = secondVerifier;
2849
+ length = 8 + exception.length;
2850
+ writer.seek(8);
2851
+ writer.write(exception);
2852
+ }
2853
+ function secondVerifier (evt) {
2854
+ expect(writer.length).toBe(length);
2855
+ expect(writer.position).toBe(length);
2856
+ var reader = new FileReader(); // eslint-disable-line no-undef
2857
+ reader.onloadend = thirdVerifier;
2858
+ reader.onerror = failed.bind(null, done, 'reader.onerror - Error reading file: ' + fileName);
2859
+ fileEntry.file(function (f) { reader.readAsText(f); });
2860
+ }
2861
+ function thirdVerifier (evt) {
2862
+ expect(evt.target.result).toBe(content.substr(0, 8) + exception);
2863
+ // cleanup
2864
+ deleteFile(fileName, done);
2865
+ }
2866
+
2867
+ // Write process
2868
+ writer.onwriteend = verifier;
2869
+ writer.write(content);
2870
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
2871
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
2872
+ });
2873
+ it('file.spec.100 should be able to write XML data', function (done) {
2874
+ var fileName = 'writer.xml'; // file content
2875
+ var content = '<?xml version="1.0" encoding="UTF-8"?>\n<test prop="ack">\nData\n</test>\n'; // for testing file length
2876
+ var length = content.length;
2877
+ // creates file, then write XML data
2878
+ createFile(fileName, function (fileEntry) {
2879
+ fileEntry.createWriter(function (writer) {
2880
+ // Verifier content
2881
+ var verifier = function (evt) {
2882
+ expect(writer.length).toBe(length);
2883
+ expect(writer.position).toBe(length);
2884
+ // cleanup
2885
+ deleteFile(fileName, done);
2886
+ };
2887
+ // Write process
2888
+ writer.onwriteend = verifier;
2889
+ writer.write(content);
2890
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
2891
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
2892
+ });
2893
+ it('file.spec.101 should be able to write JSON data', function (done) {
2894
+ var fileName = 'writer.json'; // file content
2895
+ var content = '{ "name": "Guy Incognito", "email": "here@there.com" }'; // for testing file length
2896
+ var length = content.length;
2897
+ // creates file, then write JSON content
2898
+ createFile(fileName, function (fileEntry) {
2899
+ fileEntry.createWriter(function (writer) {
2900
+ // Verifier declaration
2901
+ var verifier = function (evt) {
2902
+ expect(writer.length).toBe(length);
2903
+ expect(writer.position).toBe(length);
2904
+ // cleanup
2905
+ deleteFile(fileName, done);
2906
+ };
2907
+ // Write process
2908
+ writer.onwriteend = verifier;
2909
+ writer.write(content);
2910
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
2911
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
2912
+ });
2913
+ it('file.spec.102 should be able to seek', function (done) {
2914
+ var fileName = 'writer.seek'; // file content
2915
+ var content = 'There is an exception to every rule. Except this one.'; // for testing file length
2916
+ var length = content.length;
2917
+ // creates file, then write JSON content
2918
+ createFile(fileName, function (fileEntry) {
2919
+ // writes file content and tests writer.seek
2920
+ fileEntry.createWriter(function (writer) {
2921
+ // Verifier declaration
2922
+ var verifier = function () {
2923
+ expect(writer.position).toBe(length);
2924
+ writer.seek(-5);
2925
+ expect(writer.position).toBe(length - 5);
2926
+ writer.seek(length + 100);
2927
+ expect(writer.position).toBe(length);
2928
+ writer.seek(10);
2929
+ expect(writer.position).toBe(10);
2930
+ // cleanup
2931
+ deleteFile(fileName, done);
2932
+ };
2933
+ // Write process
2934
+ writer.onwriteend = verifier;
2935
+ writer.seek(-100);
2936
+ expect(writer.position).toBe(0);
2937
+ writer.write(content);
2938
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
2939
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
2940
+ });
2941
+ it('file.spec.103 should be able to truncate', function (done) {
2942
+ if (isIndexedDBShim) {
2943
+ /* `abort` and `truncate` functions are not supported (Firefox, IE) */
2944
+ pending();
2945
+ }
2946
+
2947
+ var fileName = 'writer.truncate';
2948
+ var content = 'There is an exception to every rule. Except this one.';
2949
+ // creates file, writes to it, then truncates it
2950
+ createFile(fileName, function (fileEntry) {
2951
+ fileEntry.createWriter(function (writer) {
2952
+ // Verifier declaration
2953
+ var verifier = function () {
2954
+ expect(writer.length).toBe(36);
2955
+ expect(writer.position).toBe(36);
2956
+ // cleanup
2957
+ deleteFile(fileName, done);
2958
+ };
2959
+ // Write process
2960
+ writer.onwriteend = function () {
2961
+ // Truncate process after write
2962
+ writer.onwriteend = verifier;
2963
+ writer.truncate(36);
2964
+ };
2965
+ writer.write(content);
2966
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
2967
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
2968
+ });
2969
+ it('file.spec.104 should be able to write binary data from an ArrayBuffer', function (done) {
2970
+ // Skip test if ArrayBuffers are not supported (e.g.: Android 2.3).
2971
+ if (typeof window.ArrayBuffer === 'undefined') {
2972
+ expect(true).toFailWithMessage('Platform does not supported this feature');
2973
+ done();
2974
+ return;
2975
+ }
2976
+ var fileName = 'bufferwriter.bin'; // file content
2977
+ var data = new ArrayBuffer(32);
2978
+ var dataView = new Int8Array(data); // for verifying file length
2979
+ var length = 32;
2980
+ for (var i = 0; i < dataView.length; i++) {
2981
+ dataView[i] = i;
2982
+ }
2983
+ // creates file, then write content
2984
+ createFile(fileName, function (fileEntry) {
2985
+ // writes file content
2986
+ fileEntry.createWriter(function (writer) {
2987
+ // Verifier declaration
2988
+ var verifier = function () {
2989
+ expect(writer.length).toBe(length);
2990
+ expect(writer.position).toBe(length);
2991
+ // cleanup
2992
+ deleteFile(fileName, done);
2993
+ };
2994
+ // Write process
2995
+ writer.onwriteend = verifier;
2996
+ writer.write(data);
2997
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
2998
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
2999
+ });
3000
+ it('file.spec.105 should be able to write binary data from a Blob', function (done) {
3001
+ // Skip test if Blobs are not supported (e.g.: Android 2.3).
3002
+ if ((typeof window.Blob === 'undefined' && typeof window.WebKitBlobBuilder === 'undefined') || typeof window.ArrayBuffer === 'undefined') {
3003
+ expect(true).toFailWithMessage('Platform does not supported this feature');
3004
+ done();
3005
+ return;
3006
+ }
3007
+ var fileName = 'blobwriter.bin'; // file content
3008
+ var data = new ArrayBuffer(32);
3009
+ var dataView = new Int8Array(data);
3010
+ var blob; // for verifying file length
3011
+ var length = 32;
3012
+ for (var i = 0; i < dataView.length; i++) {
3013
+ dataView[i] = i;
3014
+ }
3015
+ try {
3016
+ // Mobile Safari: Use Blob constructor
3017
+ blob = new Blob([data], { // eslint-disable-line no-undef
3018
+ 'type': 'application/octet-stream'
3019
+ });
3020
+ } catch (e) {
3021
+ if (window.WebKitBlobBuilder) {
3022
+ // Android Browser: Use deprecated BlobBuilder
3023
+ var builder = new WebKitBlobBuilder();
3024
+ builder.append(data);
3025
+ blob = builder.getBlob('application/octet-stream');
3026
+ } else {
3027
+ // We have no way defined to create a Blob, so fail
3028
+ fail();
3029
+ }
3030
+ }
3031
+ if (typeof blob !== 'undefined') {
3032
+ // creates file, then write content
3033
+ createFile(fileName, function (fileEntry) {
3034
+ fileEntry.createWriter(function (writer) {
3035
+ // Verifier declaration
3036
+ var verifier = function () {
3037
+ expect(writer.length).toBe(length);
3038
+ expect(writer.position).toBe(length);
3039
+ // cleanup
3040
+ deleteFile(fileName, done);
3041
+ };
3042
+ // Write process
3043
+ writer.onwriteend = verifier;
3044
+ writer.write(blob);
3045
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
3046
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3047
+ }
3048
+ });
3049
+ it('file.spec.106 should be able to write a File to a FileWriter', function (done) {
3050
+ var dummyFileName = 'dummy.txt';
3051
+ var outputFileName = 'verify.txt';
3052
+ var dummyFileText = 'This text should be written to two files';
3053
+ var verifier = function (outputFileWriter) {
3054
+ expect(outputFileWriter.length).toBe(dummyFileText.length);
3055
+ expect(outputFileWriter.position).toBe(dummyFileText.length);
3056
+ deleteFile(outputFileName, done);
3057
+ };
3058
+ var writeFile = function (fileName, fileData, win) {
3059
+ var theWriter;
3060
+ var write_file = function (fileEntry) {
3061
+ // writes file content to new file
3062
+ fileEntry.createWriter(function (writer) {
3063
+ theWriter = writer;
3064
+ writer.onwriteend = function (ev) {
3065
+ if (typeof fileData.length !== 'undefined') {
3066
+ expect(theWriter.length).toBe(fileData.length);
3067
+ expect(theWriter.position).toBe(fileData.length);
3068
+ }
3069
+ win(theWriter);
3070
+ };
3071
+ writer.onerror = failed.bind(null, done, 'writer.onerror - Error writing content on file: ' + fileName);
3072
+ writer.write(fileData);
3073
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
3074
+ };
3075
+ createFile(fileName, write_file, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3076
+ };
3077
+ var openFile = function (fileName, callback) {
3078
+ root.getFile(fileName, {
3079
+ create: false
3080
+ }, function (fileEntry) {
3081
+ fileEntry.file(callback, failed.bind(null, done, 'fileEntry.file - Error reading file using fileEntry: ' + fileEntry.name));
3082
+ }, failed.bind(null, done, 'root.getFile - Error getting file: ' + fileName));
3083
+ };
3084
+ writeFile(dummyFileName, dummyFileText, function (dummyFileWriter) {
3085
+ openFile(dummyFileName, function (file) {
3086
+ writeFile(outputFileName, file, verifier);
3087
+ });
3088
+ });
3089
+ });
3090
+ it('file.spec.107 should be able to write a sliced File to a FileWriter', function (done) {
3091
+ var dummyFileName = 'dummy2.txt';
3092
+ var outputFileName = 'verify2.txt';
3093
+ var dummyFileText = 'This text should be written to two files';
3094
+ var verifier = function (outputFileWriter) {
3095
+ expect(outputFileWriter.length).toBe(10);
3096
+ expect(outputFileWriter.position).toBe(10);
3097
+ deleteFile(outputFileName, done);
3098
+ };
3099
+ var writeFile = function (fileName, fileData, win) {
3100
+ var theWriter;
3101
+ var write_file = function (fileEntry) {
3102
+ // writes file content to new file
3103
+ fileEntry.createWriter(function (writer) {
3104
+ theWriter = writer;
3105
+ writer.onwriteend = function (ev) {
3106
+ if (typeof fileData.length !== 'undefined') {
3107
+ expect(theWriter.length).toBe(fileData.length);
3108
+ expect(theWriter.position).toBe(fileData.length);
3109
+ }
3110
+ win(theWriter);
3111
+ };
3112
+ writer.onerror = failed.bind(null, done, 'writer.onerror - Error writing content on file: ' + fileName);
3113
+ writer.write(fileData);
3114
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
3115
+ };
3116
+ createFile(fileName, write_file, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3117
+ };
3118
+ var openFile = function (fileName, callback) {
3119
+ root.getFile(fileName, {
3120
+ create: false
3121
+ }, function (fileEntry) {
3122
+ fileEntry.file(callback, failed.bind(null, done, 'fileEntry.file - Error reading file using fileEntry: ' + fileEntry.name));
3123
+ }, failed.bind(null, done, 'root.getFile - Error getting file: ' + fileName));
3124
+ };
3125
+ writeFile(dummyFileName, dummyFileText, function (dummyFileWriter) {
3126
+ openFile(dummyFileName, function (file) {
3127
+ writeFile(outputFileName, file.slice(10, 20), verifier);
3128
+ });
3129
+ });
3130
+ });
3131
+ it('file.spec.108 should be able to write binary data from a File', function (done) {
3132
+ // Skip test if Blobs are not supported (e.g.: Android 2.3).
3133
+ if (typeof window.Blob === 'undefined' && typeof window.WebKitBlobBuilder === 'undefined') {
3134
+ expect(true).toFailWithMessage('Platform does not supported this feature');
3135
+ done();
3136
+ }
3137
+ var dummyFileName = 'blobwriter.bin';
3138
+ var outputFileName = 'verify.bin'; // file content
3139
+ var data = new ArrayBuffer(32);
3140
+ var dataView = new Int8Array(data);
3141
+ var blob; // for verifying file length
3142
+ var length = 32;
3143
+ var verifier = function (outputFileWriter) {
3144
+ expect(outputFileWriter.length).toBe(length);
3145
+ expect(outputFileWriter.position).toBe(length);
3146
+ // cleanup
3147
+ deleteFile(outputFileName);
3148
+ done();
3149
+ };
3150
+ var writeFile = function (fileName, fileData, win) {
3151
+ var theWriter;
3152
+ var write_file = function (fileEntry) {
3153
+ // writes file content to new file
3154
+ fileEntry.createWriter(function (writer) {
3155
+ theWriter = writer;
3156
+ writer.onwriteend = function (ev) {
3157
+ if (typeof fileData.length !== 'undefined') {
3158
+ expect(theWriter.length).toBe(fileData.length);
3159
+ expect(theWriter.position).toBe(fileData.length);
3160
+ }
3161
+ win(theWriter);
3162
+ };
3163
+ writer.onerror = failed.bind(null, done, 'writer.onerror - Error writing content on file: ' + fileName);
3164
+ writer.write(fileData);
3165
+ }, failed.bind(null, done, 'fileEntry.createWriter - Error creating writer using fileEntry: ' + fileEntry.name));
3166
+ };
3167
+ createFile(fileName, write_file, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3168
+ };
3169
+ var openFile = function (fileName, callback) {
3170
+ root.getFile(fileName, {
3171
+ create: false
3172
+ }, function (fileEntry) {
3173
+ fileEntry.file(callback, failed.bind(null, done, 'fileEntry.file - Error reading file using fileEntry: ' + fileEntry.name));
3174
+ }, failed.bind(null, done, 'root.getFile - Error getting file: ' + fileName));
3175
+ };
3176
+ for (var i = 0; i < dataView.length; i++) {
3177
+ dataView[i] = i;
3178
+ }
3179
+ try {
3180
+ // Mobile Safari: Use Blob constructor
3181
+ blob = new Blob([data], { // eslint-disable-line no-undef
3182
+ 'type': 'application/octet-stream'
3183
+ });
3184
+ } catch (e) {
3185
+ if (window.WebKitBlobBuilder) {
3186
+ // Android Browser: Use deprecated BlobBuilder
3187
+ var builder = new WebKitBlobBuilder();
3188
+ builder.append(data);
3189
+ blob = builder.getBlob('application/octet-stream');
3190
+ } else {
3191
+ // We have no way defined to create a Blob, so fail
3192
+ fail();
3193
+ }
3194
+ }
3195
+ if (typeof blob !== 'undefined') {
3196
+ // creates file, then write content
3197
+ writeFile(dummyFileName, blob, function (dummyFileWriter) {
3198
+ openFile(dummyFileName, function (file) {
3199
+ writeFile(outputFileName, file, verifier);
3200
+ });
3201
+ });
3202
+ }
3203
+ });
3204
+ });
3205
+ // FileWritter
3206
+ describe('Backwards compatibility', function () {
3207
+ /* These specs exist to test that the File plugin can still recognize file:///
3208
+ * URLs, and can resolve them to FileEntry and DirectoryEntry objects.
3209
+ * They rely on an undocumented interface to File which provides absolute file
3210
+ * paths, which are not used internally anymore.
3211
+ * If that interface is not present, then these tests will silently succeed.
3212
+ */
3213
+ it('file.spec.109 should be able to resolve a file:/// URL', function (done) {
3214
+ var localFilename = 'file.txt';
3215
+ var originalEntry;
3216
+ root.getFile(localFilename, {
3217
+ create: true
3218
+ }, function (entry) {
3219
+ originalEntry = entry;
3220
+ /* This is an undocumented interface to File which exists only for testing
3221
+ * backwards compatibilty. By obtaining the raw filesystem path of the download
3222
+ * location, we can pass that to ft.download() to make sure that previously-stored
3223
+ * paths are still valid.
3224
+ */
3225
+ cordova.exec(function (localPath) { // eslint-disable-line no-undef
3226
+ window.resolveLocalFileSystemURL('file://' + encodeURI(localPath), function (fileEntry) {
3227
+ expect(fileEntry.toURL()).toEqual(originalEntry.toURL());
3228
+ // cleanup
3229
+ deleteFile(localFilename);
3230
+ done();
3231
+ }, failed.bind(null, done, 'window.resolveLocalFileSystemURL - Error resolving URI: file://' + encodeURI(localPath)));
3232
+ }, done, 'File', '_getLocalFilesystemPath', [entry.toURL()]);
3233
+ }, failed.bind(null, done, 'root.getFile - Error creating file: ' + localFilename));
3234
+ });
3235
+ });
3236
+ // Backwards Compatibility
3237
+ describe('Parent References', function () {
3238
+ /* These specs verify that paths with parent references i("..") in them
3239
+ * work correctly, and do not cause the application to crash.
3240
+ */
3241
+ it('file.spec.110 should not throw exception resolving parent refefences', function (done) {
3242
+ /* This is a direct copy of file.spec.9, with the filename changed, * as reported in CB-5721.
3243
+ */
3244
+ var fileName = 'resolve.file.uri';
3245
+ var dirName = 'resolve.dir.uri';
3246
+ // create a new file entry
3247
+ createDirectory(dirName, function () {
3248
+ createFile(dirName + '/../' + fileName, function (entry) {
3249
+ // lookup file system entry
3250
+ window.resolveLocalFileSystemURL(entry.toURL(), function (fileEntry) {
3251
+ expect(fileEntry).toBeDefined();
3252
+ expect(fileEntry.name).toCanonicallyMatch(fileName);
3253
+ // cleanup
3254
+ deleteEntry(fileName, done);
3255
+ }, failed.bind(null, done, 'window.resolveLocalFileSystemURL - Error resolving URI: ' + entry.toURL()));
3256
+ }, failed.bind(null, done, 'createFile - Error creating file: ../' + fileName));
3257
+ }, failed.bind(null, done, 'createDirectory - Error creating directory: ' + dirName));
3258
+ });
3259
+ it('file.spec.111 should not traverse above above the root directory', function (done) {
3260
+ var fileName = 'traverse.file.uri';
3261
+ // create a new file entry
3262
+ createFile(fileName, function (entry) {
3263
+ // lookup file system entry
3264
+ root.getFile('../' + fileName, {
3265
+ create: false
3266
+ }, function (fileEntry) {
3267
+ // Note: we expect this to still resolve, as the correct behaviour is to ignore the ../, not to fail out.
3268
+ expect(fileEntry).toBeDefined();
3269
+ expect(fileEntry.name).toBe(fileName);
3270
+ expect(fileEntry.fullPath).toCanonicallyMatch(root.fullPath + '/' + fileName);
3271
+ // cleanup
3272
+ deleteEntry(fileName, done);
3273
+ }, failed.bind(null, done, 'root.getFile - Error getting file: ../' + fileName));
3274
+ }, failed.bind(null, done, 'createFile - Error creating file: ../' + fileName));
3275
+ });
3276
+ it('file.spec.112 should traverse above above the current directory', function (done) {
3277
+ var fileName = 'traverse2.file.uri';
3278
+ var dirName = 'traverse2.subdir';
3279
+ // create a new directory and a file entry
3280
+ createFile(fileName, function () {
3281
+ createDirectory(dirName, function (entry) {
3282
+ // lookup file system entry
3283
+ entry.getFile('../' + fileName, {
3284
+ create: false
3285
+ }, function (fileEntry) {
3286
+ expect(fileEntry).toBeDefined();
3287
+ expect(fileEntry.name).toBe(fileName);
3288
+ expect(fileEntry.fullPath).toCanonicallyMatch('/' + fileName);
3289
+ // cleanup
3290
+ deleteEntry(fileName, function () {
3291
+ deleteEntry(dirName, done);
3292
+ });
3293
+ }, failed.bind(null, done, 'entry.getFile - Error getting file: ' + fileName + ' recently created above: ' + dirName));
3294
+ }, failed.bind(null, done, 'createDirectory - Error creating directory: ' + dirName));
3295
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3296
+ });
3297
+ it('file.spec.113 getFile: get Entry should error for missing file above root directory', function (done) {
3298
+ var fileName = '../missing.file';
3299
+ // create:false, exclusive:false, file does not exist
3300
+ root.getFile(fileName, {
3301
+ create: false
3302
+ }, succeed.bind(null, done, 'root.getFile - Unexpected success callback, it should not locate nonexistent file: ' + fileName), function (error) {
3303
+ expect(error).toBeDefined();
3304
+ if (isChrome) {
3305
+ expect(error).toBeFileError(FileError.SYNTAX_ERR); // eslint-disable-line no-undef
3306
+ } else {
3307
+ expect(error).toBeFileError(FileError.NOT_FOUND_ERR); // eslint-disable-line no-undef
3308
+ }
3309
+ done();
3310
+ });
3311
+ });
3312
+ });
3313
+ // Parent References
3314
+ describe('toNativeURL interface', function () {
3315
+ /* These specs verify that FileEntries have a toNativeURL method
3316
+ * which appears to be sane.
3317
+ */
3318
+ var pathExpect = cordova.platformId === 'windowsphone' ? '//nativ' : 'file://'; // eslint-disable-line no-undef
3319
+ if (isChrome) {
3320
+ pathExpect = 'filesystem:http://';
3321
+ }
3322
+ it('file.spec.114 fileEntry should have a toNativeURL method', function (done) {
3323
+ var fileName = 'native.file.uri';
3324
+ if (isWindows) {
3325
+ var rootPath = root.fullPath;
3326
+ pathExpect = rootPath.substr(0, rootPath.indexOf(':'));
3327
+ }
3328
+ // create a new file entry
3329
+ createFile(fileName, function (entry) {
3330
+ expect(entry.toNativeURL).toBeDefined();
3331
+ expect(entry.name).toCanonicallyMatch(fileName);
3332
+ expect(typeof entry.toNativeURL).toBe('function');
3333
+ var nativeURL = entry.toNativeURL();
3334
+ expect(typeof nativeURL).toBe('string');
3335
+ expect(nativeURL.substring(0, pathExpect.length)).toEqual(pathExpect);
3336
+ expect(nativeURL.substring(nativeURL.length - fileName.length)).toEqual(fileName);
3337
+ // cleanup
3338
+ deleteEntry(fileName, done);
3339
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3340
+ });
3341
+ it('file.spec.115 DirectoryReader should return entries with toNativeURL method', function (done) {
3342
+ var dirName = 'nativeEntries.dir';
3343
+ var fileName = 'nativeEntries.file';
3344
+ var directory;
3345
+ var checkEntries = function (entries) {
3346
+ expect(entries).toBeDefined();
3347
+ expect(entries instanceof Array).toBe(true);
3348
+ expect(entries.length).toBe(1);
3349
+ expect(entries[0].toNativeURL).toBeDefined();
3350
+ expect(typeof entries[0].toNativeURL).toBe('function');
3351
+ var nativeURL = entries[0].toNativeURL();
3352
+ expect(typeof nativeURL).toBe('string');
3353
+ expect(nativeURL.substring(0, pathExpect.length)).toEqual(pathExpect);
3354
+ expect(nativeURL.substring(nativeURL.length - fileName.length)).toEqual(fileName);
3355
+ // cleanup
3356
+ directory.removeRecursively(function () {}, null);
3357
+ done();
3358
+ };
3359
+ // create a new file entry
3360
+ root.getDirectory(dirName, {
3361
+ create: true
3362
+ }, function (dir) {
3363
+ directory = dir;
3364
+ directory.getFile(fileName, {
3365
+ create: true
3366
+ }, function (fileEntry) {
3367
+ var reader = directory.createReader();
3368
+ reader.readEntries(checkEntries, failed.bind(null, done, 'reader.readEntries - Error reading entries from directory: ' + dirName));
3369
+ }, failed.bind(null, done, 'directory.getFile - Error creating file: ' + fileName));
3370
+ }, failed.bind(null, done, 'root.getDirectory - Error creating directory: ' + dirName));
3371
+ });
3372
+ it('file.spec.116 resolveLocalFileSystemURL should return entries with toNativeURL method', function (done) {
3373
+ var fileName = 'native.resolve.uri';
3374
+ // create a new file entry
3375
+ createFile(fileName, function (entry) {
3376
+ resolveLocalFileSystemURL(entry.toURL(), function (entry) { // eslint-disable-line no-undef
3377
+ expect(entry.toNativeURL).toBeDefined();
3378
+ expect(entry.name).toCanonicallyMatch(fileName);
3379
+ expect(typeof entry.toNativeURL).toBe('function');
3380
+ var nativeURL = entry.toNativeURL();
3381
+ expect(typeof nativeURL).toBe('string');
3382
+ expect(nativeURL.substring(0, pathExpect.length)).toEqual(pathExpect);
3383
+ expect(nativeURL.substring(nativeURL.length - fileName.length)).toEqual(fileName);
3384
+ // cleanup
3385
+ deleteEntry(fileName, done);
3386
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL - Error resolving file URL: ' + entry.toURL()));
3387
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3388
+ });
3389
+ });
3390
+ // toNativeURL interface
3391
+ describe('resolveLocalFileSystemURL on file://', function () {
3392
+ /* These specs verify that window.resolveLocalFileSystemURL works correctly on file:// URLs
3393
+ */
3394
+ it('file.spec.117 should not resolve native URLs outside of FS roots', function (done) {
3395
+ // lookup file system entry
3396
+ window.resolveLocalFileSystemURL('file:///this.is.an.invalid.url', succeed.bind(null, done, 'window.resolveLocalFileSystemURL - Unexpected success callback, it should not resolve invalid URL: file:///this.is.an.invalid.url'), function (error) {
3397
+ expect(error).toBeDefined();
3398
+ done();
3399
+ });
3400
+ });
3401
+ it('file.spec.118 should not resolve native URLs outside of FS roots', function (done) {
3402
+ // lookup file system entry
3403
+ window.resolveLocalFileSystemURL('file://localhost/this.is.an.invalid.url', succeed.bind(null, done, 'window.resolveLocalFileSystemURL - Unexpected success callback, it should not resolve invalid URL: file://localhost/this.is.an.invalid.url'), function (error) {
3404
+ expect(error).toBeDefined();
3405
+ done();
3406
+ });
3407
+ });
3408
+ it('file.spec.119 should not resolve invalid native URLs', function (done) {
3409
+ // lookup file system entry
3410
+ window.resolveLocalFileSystemURL('file://localhost', succeed.bind(null, done, 'window.resolveLocalFileSystemURL - Unexpected success callback, it should not resolve invalid URL: file://localhost'), function (error) {
3411
+ expect(error).toBeDefined();
3412
+ done();
3413
+ });
3414
+ });
3415
+ it('file.spec.120 should not resolve invalid native URLs with query strings', function (done) {
3416
+ // lookup file system entry
3417
+ window.resolveLocalFileSystemURL('file://localhost?test/test', succeed.bind(null, done, 'window.resolveLocalFileSystemURL - Unexpected success callback, it should not resolve invalid URL: file://localhost?test/test'), function (error) {
3418
+ expect(error).toBeDefined();
3419
+ done();
3420
+ });
3421
+ });
3422
+ it('file.spec.121 should resolve native URLs returned by API', function (done) {
3423
+ var fileName = 'native.resolve.uri1';
3424
+ // create a new file entry
3425
+ createFile(fileName, function (entry) {
3426
+ /* eslint-disable no-undef */
3427
+ resolveLocalFileSystemURL(entry.toNativeURL(), function (fileEntry) {
3428
+ expect(fileEntry.fullPath).toCanonicallyMatch(root.fullPath + '/' + fileName);
3429
+ // cleanup
3430
+ deleteEntry(fileName, done);
3431
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL - Error resolving file URL: ' + entry.toNativeURL()));
3432
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3433
+ });
3434
+ it('file.spec.122 should resolve native URLs returned by API with localhost', function (done) {
3435
+ var fileName = 'native.resolve.uri2';
3436
+ // create a new file entry
3437
+ createFile(fileName, function (entry) {
3438
+ var url = entry.toNativeURL();
3439
+ url = url.replace('///', '//localhost/');
3440
+ resolveLocalFileSystemURL(url, function (fileEntry) {
3441
+ expect(fileEntry.fullPath).toCanonicallyMatch(root.fullPath + '/' + fileName);
3442
+ // cleanup
3443
+ deleteEntry(fileName, done);
3444
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL - Error resolving file URL: ' + url));
3445
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3446
+ });
3447
+ it('file.spec.123 should resolve native URLs returned by API with query string', function (done) {
3448
+ var fileName = 'native.resolve.uri3';
3449
+ // create a new file entry
3450
+ createFile(fileName, function (entry) {
3451
+ var url = entry.toNativeURL();
3452
+ url = url + '?test/test';
3453
+ resolveLocalFileSystemURL(url, function (fileEntry) {
3454
+ expect(fileEntry.fullPath).toCanonicallyMatch(root.fullPath + '/' + fileName);
3455
+ // cleanup
3456
+ deleteEntry(fileName, done);
3457
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL - Error resolving file URL: ' + url));
3458
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3459
+ });
3460
+ it('file.spec.124 should resolve native URLs returned by API with localhost and query string', function (done) {
3461
+ var fileName = 'native.resolve.uri4';
3462
+ // create a new file entry
3463
+ createFile(fileName, function (entry) {
3464
+ var url = entry.toNativeURL();
3465
+ url = url.replace('///', '//localhost/') + '?test/test';
3466
+ resolveLocalFileSystemURL(url, function (fileEntry) {
3467
+ /* eslint-enable no-undef */
3468
+ expect(fileEntry.fullPath).toCanonicallyMatch(root.fullPath + '/' + fileName);
3469
+ // cleanup
3470
+ deleteEntry(fileName, done);
3471
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL - Error resolving file URL: ' + url));
3472
+ }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
3473
+ });
3474
+ });
3475
+ // resolveLocalFileSystemURL on file://
3476
+ describe('cross-file-system copy and move', function () {
3477
+ /* These specs verify that Entry.copyTo and Entry.moveTo work correctly
3478
+ * when crossing filesystem boundaries.
3479
+ */
3480
+ it('file.spec.125 copyTo: temporary -> persistent', function (done) {
3481
+ var file1 = 'entry.copy.file1a';
3482
+ var file2 = 'entry.copy.file2a';
3483
+ var sourceEntry;
3484
+ var fullPath = joinURL(root.fullPath, file2);
3485
+ var validateFile = function (entry) {
3486
+ // a bit redundant since copy returned this entry already
3487
+ expect(entry).toBeDefined();
3488
+ expect(entry.isFile).toBe(true);
3489
+ expect(entry.isDirectory).toBe(false);
3490
+ expect(entry.name).toCanonicallyMatch(file2);
3491
+ expect(entry.fullPath).toCanonicallyMatch(fullPath);
3492
+ expect(entry.filesystem).toBeDefined();
3493
+ if (isChrome) {
3494
+ expect(entry.filesystem.name).toContain('Persistent');
3495
+ } else {
3496
+ expect(entry.filesystem.name).toEqual('persistent');
3497
+ }
3498
+ // cleanup
3499
+ deleteEntry(entry.name);
3500
+ deleteEntry(sourceEntry.name, done);
3501
+ };
3502
+ var createSourceAndTransfer = function () {
3503
+ temp_root.getFile(file1, {
3504
+ create: true
3505
+ }, function (entry) {
3506
+ expect(entry.filesystem).toBeDefined();
3507
+ if (isChrome) {
3508
+ expect(entry.filesystem.name).toContain('Temporary');
3509
+ } else {
3510
+ expect(entry.filesystem.name).toEqual('temporary');
3511
+ }
3512
+ sourceEntry = entry;
3513
+ // Save for later cleanup
3514
+ entry.copyTo(persistent_root, file2, validateFile, failed.bind(null, done, 'entry.copyTo - Error copying file: ' + file1 + ' to PERSISTENT root as: ' + file2));
3515
+ }, failed.bind(null, done, 'temp_root.getFile - Error creating file: ' + file1 + 'at TEMPORAL root'));
3516
+ };
3517
+ // Delete any existing file to start things off
3518
+ persistent_root.getFile(file2, {}, function (entry) {
3519
+ entry.remove(createSourceAndTransfer, failed.bind(null, done, 'entry.remove - Error removing file: ' + file2));
3520
+ }, createSourceAndTransfer);
3521
+ });
3522
+ it('file.spec.126 copyTo: persistent -> temporary', function (done) {
3523
+ var file1 = 'entry.copy.file1b';
3524
+ var file2 = 'entry.copy.file2b';
3525
+ var sourceEntry;
3526
+ var fullPath = joinURL(temp_root.fullPath, file2);
3527
+ var validateFile = function (entry) {
3528
+ expect(entry).toBeDefined();
3529
+ expect(entry.isFile).toBe(true);
3530
+ expect(entry.isDirectory).toBe(false);
3531
+ expect(entry.name).toCanonicallyMatch(file2);
3532
+ expect(entry.fullPath).toCanonicallyMatch(fullPath);
3533
+ if (isChrome) {
3534
+ expect(entry.filesystem.name).toContain('Temporary');
3535
+ } else {
3536
+ expect(entry.filesystem.name).toEqual('temporary');
3537
+ }
3538
+ // cleanup
3539
+ deleteEntry(entry.name);
3540
+ deleteEntry(sourceEntry.name, done);
3541
+ };
3542
+ var createSourceAndTransfer = function () {
3543
+ persistent_root.getFile(file1, {
3544
+ create: true
3545
+ }, function (entry) {
3546
+ expect(entry).toBeDefined();
3547
+ expect(entry.filesystem).toBeDefined();
3548
+ if (isChrome) {
3549
+ expect(entry.filesystem.name).toContain('Persistent');
3550
+ } else {
3551
+ expect(entry.filesystem.name).toEqual('persistent');
3552
+ }
3553
+ sourceEntry = entry;
3554
+ // Save for later cleanup
3555
+ entry.copyTo(temp_root, file2, validateFile, failed.bind(null, done, 'entry.copyTo - Error copying file: ' + file1 + ' to TEMPORAL root as: ' + file2));
3556
+ }, failed.bind(null, done, 'persistent_root.getFile - Error creating file: ' + file1 + 'at PERSISTENT root'));
3557
+ };
3558
+ // Delete any existing file to start things off
3559
+ temp_root.getFile(file2, {}, function (entry) {
3560
+ entry.remove(createSourceAndTransfer, failed.bind(null, done, 'entry.remove - Error removing file: ' + file2));
3561
+ }, createSourceAndTransfer);
3562
+ });
3563
+ it('file.spec.127 moveTo: temporary -> persistent', function (done) {
3564
+ var file1 = 'entry.copy.file1a';
3565
+ var file2 = 'entry.copy.file2a';
3566
+ var sourceEntry;
3567
+ var fullPath = joinURL(root.fullPath, file2);
3568
+ var validateFile = function (entry) {
3569
+ // a bit redundant since copy returned this entry already
3570
+ expect(entry).toBeDefined();
3571
+ expect(entry.isFile).toBe(true);
3572
+ expect(entry.isDirectory).toBe(false);
3573
+ expect(entry.name).toCanonicallyMatch(file2);
3574
+ expect(entry.fullPath).toCanonicallyMatch(fullPath);
3575
+ expect(entry.filesystem).toBeDefined();
3576
+ if (isChrome) {
3577
+ expect(entry.filesystem.name).toContain('Persistent');
3578
+ } else {
3579
+ expect(entry.filesystem.name).toEqual('persistent');
3580
+ }
3581
+ // cleanup
3582
+ deleteEntry(entry.name);
3583
+ deleteEntry(sourceEntry.name, done);
3584
+ };
3585
+ var createSourceAndTransfer = function () {
3586
+ temp_root.getFile(file1, {
3587
+ create: true
3588
+ }, function (entry) {
3589
+ expect(entry.filesystem).toBeDefined();
3590
+ if (isChrome) {
3591
+ expect(entry.filesystem.name).toContain('Temporary');
3592
+ } else {
3593
+ expect(entry.filesystem.name).toEqual('temporary');
3594
+ }
3595
+ sourceEntry = entry;
3596
+ // Save for later cleanup
3597
+ entry.moveTo(persistent_root, file2, validateFile, failed.bind(null, done, 'entry.moveTo - Error moving file: ' + file1 + ' to PERSISTENT root as: ' + file2));
3598
+ }, failed.bind(null, done, 'temp_root.getFile - Error creating file: ' + file1 + 'at TEMPORAL root'));
3599
+ };
3600
+ // Delete any existing file to start things off
3601
+ persistent_root.getFile(file2, {}, function (entry) {
3602
+ entry.remove(createSourceAndTransfer, failed.bind(null, done, 'entry.remove - Error removing file: ' + file2));
3603
+ }, createSourceAndTransfer);
3604
+ });
3605
+ it('file.spec.128 moveTo: persistent -> temporary', function (done) {
3606
+ var file1 = 'entry.copy.file1b';
3607
+ var file2 = 'entry.copy.file2b';
3608
+ var sourceEntry;
3609
+ var fullPath = joinURL(temp_root.fullPath, file2);
3610
+ var validateFile = function (entry) {
3611
+ expect(entry).toBeDefined();
3612
+ expect(entry.isFile).toBe(true);
3613
+ expect(entry.isDirectory).toBe(false);
3614
+ expect(entry.name).toCanonicallyMatch(file2);
3615
+ expect(entry.fullPath).toCanonicallyMatch(fullPath);
3616
+ if (isChrome) {
3617
+ expect(entry.filesystem.name).toContain('Temporary');
3618
+ } else {
3619
+ expect(entry.filesystem.name).toEqual('temporary');
3620
+ }
3621
+ // cleanup
3622
+ deleteEntry(entry.name);
3623
+ deleteEntry(sourceEntry.name, done);
3624
+ };
3625
+ var createSourceAndTransfer = function () {
3626
+ persistent_root.getFile(file1, {
3627
+ create: true
3628
+ }, function (entry) {
3629
+ expect(entry).toBeDefined();
3630
+ expect(entry.filesystem).toBeDefined();
3631
+ if (isChrome) {
3632
+ expect(entry.filesystem.name).toContain('Persistent');
3633
+ } else {
3634
+ expect(entry.filesystem.name).toEqual('persistent');
3635
+ }
3636
+ sourceEntry = entry;
3637
+ // Save for later cleanup
3638
+ entry.moveTo(temp_root, file2, validateFile, failed.bind(null, done, 'entry.moveTo - Error moving file: ' + file1 + ' to TEMPORAL root as: ' + file2));
3639
+ }, failed.bind(null, done, 'persistent_root.getFile - Error creating file: ' + file1 + 'at PERSISTENT root'));
3640
+ };
3641
+ // Delete any existing file to start things off
3642
+ temp_root.getFile(file2, {}, function (entry) {
3643
+ entry.remove(createSourceAndTransfer, failed.bind(null, done, 'entry.remove - Error removing file: ' + file2));
3644
+ }, createSourceAndTransfer);
3645
+ });
3646
+ it('file.spec.129 cordova.file.*Directory are set', function () {
3647
+ var expectedPaths = ['applicationDirectory', 'applicationStorageDirectory', 'dataDirectory', 'cacheDirectory'];
3648
+ /* eslint-disable no-undef */
3649
+ if (cordova.platformId === 'android' || cordova.platformId === 'amazon-fireos') {
3650
+ if (cordova.file.externalApplicationStorageDirectory !== null) {
3651
+ // https://issues.apache.org/jira/browse/CB-10411
3652
+ // If external storage can't be mounted, the cordova.file.external* properties are null.
3653
+ expectedPaths.push('externalApplicationStorageDirectory', 'externalRootDirectory', 'externalCacheDirectory', 'externalDataDirectory');
3654
+ }
3655
+ } else if (cordova.platformId === 'blackberry10') {
3656
+ expectedPaths.push('externalRootDirectory', 'sharedDirectory');
3657
+ } else if (cordova.platformId === 'ios') {
3658
+ expectedPaths.push('syncedDataDirectory', 'documentsDirectory', 'tempDirectory');
3659
+ } else if (cordova.platformId === 'osx') {
3660
+ expectedPaths.push('documentsDirectory', 'tempDirectory', 'rootDirectory');
3661
+ } else {
3662
+ console.log('Skipping test due on unsupported platform.');
3663
+ return;
3664
+ }
3665
+ for (var i = 0; i < expectedPaths.length; ++i) {
3666
+ expect(typeof cordova.file[expectedPaths[i]]).toBe('string');
3667
+ expect(cordova.file[expectedPaths[i]]).toMatch(/\/$/, 'Path should end with a slash');
3668
+ }
3669
+ });
3670
+ });
3671
+ describe('resolveLocalFileSystemURL on cdvfile://', function () {
3672
+ it('file.spec.147 should be able to resolve cdvfile applicationDirectory fs root', function (done) {
3673
+ var cdvfileApplicationDirectoryFsRootName;
3674
+ if (cordova.platformId === 'android') {
3675
+ cdvfileApplicationDirectoryFsRootName = 'assets';
3676
+ } else if (cordova.platformId === 'ios') {
3677
+ cdvfileApplicationDirectoryFsRootName = 'bundle';
3678
+ } else {
3679
+ pending();
3680
+ }
3681
+
3682
+ resolveLocalFileSystemURL('cdvfile://localhost/' + cdvfileApplicationDirectoryFsRootName + '/', function (applicationDirectoryRoot) {
3683
+ expect(applicationDirectoryRoot.isFile).toBe(false);
3684
+ expect(applicationDirectoryRoot.isDirectory).toBe(true);
3685
+ expect(applicationDirectoryRoot.name).toCanonicallyMatch('');
3686
+ expect(applicationDirectoryRoot.fullPath).toCanonicallyMatch('/');
3687
+ expect(applicationDirectoryRoot.filesystem.name).toEqual(cdvfileApplicationDirectoryFsRootName);
3688
+
3689
+ // Requires HelloCordova www assets, <allow-navigation href="cdvfile:*" /> in config.xml or
3690
+ // cdvfile: in CSP and <access origin="cdvfile://*" /> in config.xml
3691
+ resolveLocalFileSystemURL('cdvfile://localhost/' + cdvfileApplicationDirectoryFsRootName + '/www/img/logo.png', function (entry) {
3692
+ /* eslint-enable no-undef */
3693
+ expect(entry.isFile).toBe(true);
3694
+ expect(entry.isDirectory).toBe(false);
3695
+ expect(entry.name).toCanonicallyMatch('logo.png');
3696
+ expect(entry.fullPath).toCanonicallyMatch('/www/img/logo.png');
3697
+ expect(entry.filesystem.name).toEqual(cdvfileApplicationDirectoryFsRootName);
3698
+
3699
+ var img = new Image(); // eslint-disable-line no-undef
3700
+ img.onerror = function (err) {
3701
+ expect(err).not.toBeDefined();
3702
+ done();
3703
+ };
3704
+ img.onload = function () {
3705
+ done();
3706
+ };
3707
+ img.src = entry.toInternalURL();
3708
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for cdvfile applicationDirectory'));
3709
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for cdvfile applicationDirectory'));
3710
+ });
3711
+ });
3712
+ // cross-file-system copy and move
3713
+ describe('IndexedDB-based impl', function () {
3714
+ it('file.spec.131 Nested file or nested directory should be removed when removing a parent directory', function (done) {
3715
+ var parentDirName = 'deletedDir131';
3716
+ var nestedDirName = 'nestedDir131';
3717
+ var nestedFileName = 'nestedFile131.txt';
3718
+
3719
+ createDirectory(parentDirName, function (parent) {
3720
+ parent.getDirectory(nestedDirName, { create: true }, function () {
3721
+ parent.getFile(nestedFileName, { create: true }, function () {
3722
+ parent.removeRecursively(function () {
3723
+ root.getDirectory(parentDirName, { create: false }, failed.bind(this, done, 'root.getDirectory - unexpected success callback : ' + parentDirName), function () {
3724
+ parent.getFile(nestedFileName, { create: false }, failed.bind(this, done, 'getFile - unexpected success callback : ' + nestedFileName), function () {
3725
+ parent.getDirectory(nestedDirName, { create: false }, failed.bind(this, done, 'getDirectory - unexpected success callback : ' + nestedDirName), done);
3726
+ });
3727
+ });
3728
+ }, failed.bind(this, done, 'removeRecursively - Error removing directory : ' + parentDirName));
3729
+ }, failed.bind(this, done, 'getFile - Error creating file : ' + nestedFileName));
3730
+ }, failed.bind(this, done, 'getDirectory - Error creating directory : ' + nestedDirName));
3731
+ }, failed.bind(this, done, 'root.getDirectory - Error creating directory : ' + parentDirName));
3732
+ });
3733
+ it('file.spec.132 Entry should be created succesfully when using relative paths if its parent directory exists', function (done) {
3734
+ /* Directory entries have to be created successively.
3735
+ For example, the call `fs.root.getDirectory('dir1/dir2', {create:true}, successCallback, errorCallback)`
3736
+ will fail if dir1 did not exist. */
3737
+ var parentName = 'parentName132';
3738
+ var nestedName = 'nestedName132';
3739
+ var path = parentName + '/' + nestedName;
3740
+
3741
+ var win = function (directory) {
3742
+ expect(directory).toBeDefined();
3743
+ expect(directory.isFile).toBe(false);
3744
+ expect(directory.isDirectory).toBe(true);
3745
+ expect(directory.name).toCanonicallyMatch(nestedName);
3746
+ expect(directory.fullPath).toCanonicallyMatch('/' + path + '/');
3747
+ deleteEntry(directory.name);
3748
+ deleteEntry(parentName, done);
3749
+ };
3750
+
3751
+ createDirectory(parentName, function () {
3752
+ root.getDirectory(parentName + '/' + nestedName, {create: true}, win,
3753
+ failed.bind(this, done, 'root.getDirectory - Error getting directory : ' + path));
3754
+ }, failed.bind(this, done, 'root.getDirectory - Error getting directory : ' + parentName));
3755
+ });
3756
+ it('file.spec.133 A file being removed should not affect another file with name being a prefix of the removed file name.', function (done) {
3757
+
3758
+ // Names include special symbols so that we check the IndexedDB range used
3759
+ var deletedFileName = 'deletedFile.0';
3760
+ var secondFileName = 'deletedFile.0.1';
3761
+
3762
+ var win = function (fileEntry) {
3763
+ expect(fileEntry).toBeDefined();
3764
+ expect(fileEntry.isFile).toBe(true);
3765
+ expect(fileEntry.isDirectory).toBe(false);
3766
+ expect(fileEntry.name).toCanonicallyMatch(secondFileName);
3767
+ deleteEntry(fileEntry.name, done);
3768
+ };
3769
+
3770
+ createFile(deletedFileName, function (deletedFile) {
3771
+ createFile(secondFileName, function () {
3772
+ deletedFile.remove(function () {
3773
+ root.getFile(deletedFileName, {create: false}, failed.bind(this, done, 'getFile - unexpected success callback getting deleted file : ' + deletedFileName), function () {
3774
+ root.getFile(secondFileName, {create: false}, win, failed.bind(this, done, 'getFile - Error getting file after deleting deletedFile : ' + secondFileName));
3775
+ });
3776
+ }, failed.bind(this, done, 'remove - Error removing file : ' + deletedFileName));
3777
+ }, failed.bind(this, done, 'getFile - Error creating file : ' + secondFileName));
3778
+ }, failed.bind(this, done, 'getFile - Error creating file : ' + deletedFileName));
3779
+ });
3780
+ it('file.spec.134 A directory being removed should not affect another directory with name being a prefix of the removed directory name.', function (done) {
3781
+
3782
+ // Names include special symbols so that we check the IndexedDB range used
3783
+ var deletedDirName = 'deletedDir.0';
3784
+ var secondDirName = 'deletedDir.0.1';
3785
+
3786
+ var win = function (directory) {
3787
+ expect(directory).toBeDefined();
3788
+ expect(directory.isFile).toBe(false);
3789
+ expect(directory.isDirectory).toBe(true);
3790
+ expect(directory.name).toCanonicallyMatch(secondDirName);
3791
+ deleteEntry(directory.name, done);
3792
+ };
3793
+
3794
+ createDirectory(deletedDirName, function (deletedDir) {
3795
+ createDirectory(secondDirName, function () {
3796
+ deletedDir.remove(function () {
3797
+ root.getDirectory(deletedDirName, {create: false}, failed.bind(this, done, 'getDirectory - unexpected success callback getting deleted directory : ' + deletedDirName), function () {
3798
+ root.getDirectory(secondDirName, {create: false}, win, failed.bind(this, done, 'getDirectory - Error getting directory after deleting deletedDirectory : ' + secondDirName));
3799
+ });
3800
+ }, failed.bind(this, done, 'remove - Error removing directory : ' + deletedDirName));
3801
+ }, failed.bind(this, done, 'root.getDirectory - Error creating directory : ' + secondDirName));
3802
+ }, failed.bind(this, done, 'root.getDirectory - Error creating directory : ' + deletedDirName));
3803
+ });
3804
+ it('file.spec.135 Deletion of a child directory should not affect the parent directory.', function (done) {
3805
+
3806
+ var parentName = 'parentName135';
3807
+ var childName = 'childName135';
3808
+
3809
+ var win = function (directory) {
3810
+ expect(directory).toBeDefined();
3811
+ expect(directory.isFile).toBe(false);
3812
+ expect(directory.isDirectory).toBe(true);
3813
+ expect(directory.name).toCanonicallyMatch(parentName);
3814
+ deleteEntry(directory.name, done);
3815
+ };
3816
+
3817
+ createDirectory(parentName, function (parent) {
3818
+ parent.getDirectory(childName, {create: true}, function (child) {
3819
+ child.removeRecursively(function () {
3820
+ root.getDirectory(parentName, {create: false}, win, failed.bind(this, done, 'root.getDirectory - Error getting parent directory : ' + parentName));
3821
+ },
3822
+ failed.bind(this, done, 'getDirectory - Error removing directory : ' + childName));
3823
+ }, failed.bind(this, done, 'getDirectory - Error creating directory : ' + childName));
3824
+ }, failed.bind(this, done, 'root.getDirectory - Error creating directory : ' + parentName));
3825
+ });
3826
+ it('file.spec.136 Paths should support Unicode symbols.', function (done) {
3827
+
3828
+ var dirName = '文件插件';
3829
+
3830
+ var win = function (directory) {
3831
+ expect(directory).toBeDefined();
3832
+ expect(directory.isFile).toBe(false);
3833
+ expect(directory.isDirectory).toBe(true);
3834
+ expect(directory.name).toCanonicallyMatch(dirName);
3835
+ deleteEntry(directory.name, done);
3836
+ };
3837
+
3838
+ createDirectory(dirName, function () {
3839
+ root.getDirectory(dirName, {create: false}, win,
3840
+ failed.bind(this, done, 'root.getDirectory - Error getting directory : ' + dirName));
3841
+ }, failed.bind(this, done, 'root.getDirectory - Error creating directory : ' + dirName));
3842
+ });
3843
+ });
3844
+ // Content and Asset URLs
3845
+ if (cordova.platformId === 'android') { // eslint-disable-line no-undef
3846
+ describe('content: URLs', function () {
3847
+ // Warning: Default HelloWorld www directory structure is required for these tests (www/index.html at least)
3848
+ function testContentCopy (src, done) {
3849
+ var file2 = 'entry.copy.file2b';
3850
+ var fullPath = joinURL(temp_root.fullPath, file2);
3851
+ var validateFile = function (entry) {
3852
+ expect(entry.isFile).toBe(true);
3853
+ expect(entry.isDirectory).toBe(false);
3854
+ expect(entry.name).toCanonicallyMatch(file2);
3855
+ expect(entry.fullPath).toCanonicallyMatch(fullPath);
3856
+ expect(entry.filesystem.name).toEqual('temporary');
3857
+ // cleanup
3858
+ deleteEntry(entry.name, done);
3859
+ };
3860
+ var transfer = function () {
3861
+ resolveLocalFileSystemURL(src, function (entry) { // eslint-disable-line no-undef
3862
+ expect(entry).toBeDefined();
3863
+ expect(entry.filesystem.name).toEqual('content');
3864
+ entry.copyTo(temp_root, file2, validateFile, failed.bind(null, done, 'entry.copyTo - Error copying file: ' + entry.toURL() + ' to TEMPORAL root as: ' + file2));
3865
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for content provider'));
3866
+ };
3867
+ // Delete any existing file to start things off
3868
+ temp_root.getFile(file2, {}, function (entry) {
3869
+ entry.remove(transfer, failed.bind(null, done, 'entry.remove - Error removing file: ' + file2));
3870
+ }, transfer);
3871
+ }
3872
+ it('file.spec.138 copyTo: content', function (done) {
3873
+ testContentCopy('content://org.apache.cordova.file.testprovider/www/index.html', done);
3874
+ });
3875
+ it('file.spec.139 copyTo: content /w space and query', function (done) {
3876
+ testContentCopy('content://org.apache.cordova.file.testprovider/?name=foo%20bar&realPath=%2Fwww%2Findex.html', done);
3877
+ });
3878
+ it('file.spec.140 delete: content should fail', function (done) {
3879
+ resolveLocalFileSystemURL('content://org.apache.cordova.file.testprovider/www/index.html', function (entry) { // eslint-disable-line no-undef
3880
+ entry.remove(failed.bind(null, done, 'expected delete to fail'), done);
3881
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for content provider'));
3882
+ });
3883
+ });
3884
+
3885
+ // these tests ensure that you can read and copy from android_asset folder
3886
+ // for details see https://issues.apache.org/jira/browse/CB-6428
3887
+ // and https://mail-archives.apache.org/mod_mbox/cordova-dev/201508.mbox/%3C782154441.8406572.1440182722528.JavaMail.yahoo%40mail.yahoo.com%3E
3888
+ describe('asset: URLs', function () {
3889
+ it('file.spec.141 filePaths.applicationStorage', function () {
3890
+ expect(cordova.file.applicationDirectory).toEqual('file:///android_asset/'); // eslint-disable-line no-undef
3891
+ }, MEDIUM_TIMEOUT);
3892
+ it('file.spec.142 assets should be enumerable', function (done) {
3893
+ resolveLocalFileSystemURL('file:///android_asset/www/fixtures/asset-test', function (entry) { // eslint-disable-line no-undef
3894
+ var reader = entry.createReader();
3895
+ reader.readEntries(function (entries) {
3896
+ expect(entries.length).not.toBe(0);
3897
+ done();
3898
+ }, failed.bind(null, done, 'reader.readEntries - Error during reading of entries from assets directory'));
3899
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for assets'));
3900
+ }, MEDIUM_TIMEOUT);
3901
+ it('file.spec.145 asset subdirectories should be obtainable', function (done) {
3902
+ resolveLocalFileSystemURL('file:///android_asset/www/fixtures', function (entry) { // eslint-disable-line no-undef
3903
+ entry.getDirectory('asset-test', { create: false }, function (subDir) {
3904
+ expect(subDir).toBeDefined();
3905
+ expect(subDir.isFile).toBe(false);
3906
+ expect(subDir.isDirectory).toBe(true);
3907
+ expect(subDir.name).toCanonicallyMatch('asset-test');
3908
+ done();
3909
+ }, failed.bind(null, done, 'entry.getDirectory - Error getting asset subdirectory'));
3910
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for assets'));
3911
+ }, MEDIUM_TIMEOUT);
3912
+ it('file.spec.146 asset files should be readable', function (done) {
3913
+ resolveLocalFileSystemURL('file:///android_asset/www/fixtures/asset-test/asset-test.txt', function (entry) { // eslint-disable-line no-undef
3914
+ expect(entry.isFile).toBe(true);
3915
+ entry.file(function (file) {
3916
+ expect(file).toBeDefined();
3917
+ var reader = new FileReader(); // eslint-disable-line no-undef
3918
+ reader.onerror = failed.bind(null, done, 'reader.readAsText - Error reading asset text file');
3919
+ reader.onloadend = function () {
3920
+ expect(this.result).toBeDefined();
3921
+ expect(this.result.length).not.toBe(0);
3922
+ done();
3923
+ };
3924
+ reader.readAsText(file);
3925
+ }, failed.bind(null, done, 'entry.file - Error reading asset file'));
3926
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for assets'));
3927
+ }, MEDIUM_TIMEOUT);
3928
+ it('file.spec.143 copyTo: asset -> temporary', function (done) {
3929
+ var file2 = 'entry.copy.file2b';
3930
+ var fullPath = joinURL(temp_root.fullPath, file2);
3931
+ var validateFile = function (entry) {
3932
+ expect(entry.isFile).toBe(true);
3933
+ expect(entry.isDirectory).toBe(false);
3934
+ expect(entry.name).toCanonicallyMatch(file2);
3935
+ expect(entry.fullPath).toCanonicallyMatch(fullPath);
3936
+ expect(entry.filesystem.name).toEqual('temporary');
3937
+ // cleanup
3938
+ deleteEntry(entry.name, done);
3939
+ };
3940
+ var transfer = function () {
3941
+ resolveLocalFileSystemURL('file:///android_asset/www/index.html', function (entry) { // eslint-disable-line no-undef
3942
+ expect(entry.filesystem.name).toEqual('assets');
3943
+ entry.copyTo(temp_root, file2, validateFile, failed.bind(null, done, 'entry.copyTo - Error copying file: ' + entry.toURL() + ' to TEMPORAL root as: ' + file2));
3944
+ }, failed.bind(null, done, 'resolveLocalFileSystemURL failed for assets'));
3945
+ };
3946
+ // Delete any existing file to start things off
3947
+ temp_root.getFile(file2, {}, function (entry) {
3948
+ entry.remove(transfer, failed.bind(null, done, 'entry.remove - Error removing file: ' + file2));
3949
+ }, transfer);
3950
+ }, MEDIUM_TIMEOUT);
3951
+ });
3952
+ it('file.spec.144 copyTo: asset directory', function (done) {
3953
+ var srcUrl = 'file:///android_asset/www/fixtures/asset-test';
3954
+ var dstDir = 'entry.copy.dstDir';
3955
+ var dstPath = joinURL(root.fullPath, dstDir);
3956
+ // create a new directory entry to kick off it
3957
+ deleteEntry(dstDir, function () {
3958
+ resolveLocalFileSystemURL(srcUrl, function (directory) { // eslint-disable-line no-undef
3959
+ directory.copyTo(root, dstDir, function (directory) {
3960
+ expect(directory).toBeDefined();
3961
+ expect(directory.isFile).toBe(false);
3962
+ expect(directory.isDirectory).toBe(true);
3963
+ expect(directory.fullPath).toCanonicallyMatch(dstPath);
3964
+ expect(directory.name).toCanonicallyMatch(dstDir);
3965
+ root.getDirectory(dstDir, {
3966
+ create: false
3967
+ }, function (dirEntry) {
3968
+ expect(dirEntry).toBeDefined();
3969
+ expect(dirEntry.isFile).toBe(false);
3970
+ expect(dirEntry.isDirectory).toBe(true);
3971
+ expect(dirEntry.fullPath).toCanonicallyMatch(dstPath);
3972
+ expect(dirEntry.name).toCanonicallyMatch(dstDir);
3973
+ dirEntry.getFile('asset-test.txt', {
3974
+ create: false
3975
+ }, function (fileEntry) {
3976
+ expect(fileEntry).toBeDefined();
3977
+ expect(fileEntry.isFile).toBe(true);
3978
+ // cleanup
3979
+ deleteEntry(dstDir, done);
3980
+ }, failed.bind(null, done, 'dirEntry.getFile - Error getting subfile'));
3981
+ }, failed.bind(null, done, 'root.getDirectory - Error getting copied directory'));
3982
+ }, failed.bind(null, done, 'directory.copyTo - Error copying directory'));
3983
+ }, failed.bind(null, done, 'resolving src dir'));
3984
+ }, failed.bind(null, done, 'deleteEntry - Error removing directory : ' + dstDir));
3985
+ }, MEDIUM_TIMEOUT);
3986
+ }
3987
+ });
3988
+
3989
+ };
3990
+ //* *****************************************************************************************
3991
+ //* **************************************Manual Tests***************************************
3992
+ //* *****************************************************************************************
3993
+
3994
+ exports.defineManualTests = function (contentEl, createActionButton) {
3995
+
3996
+ function resolveFs (fsname) {
3997
+ var fsURL = 'cdvfile://localhost/' + fsname + '/';
3998
+ logMessage('Resolving URL: ' + fsURL);
3999
+ /* eslint-disable no-undef */
4000
+ resolveLocalFileSystemURL(fsURL, function (entry) {
4001
+ logMessage('Success', 'green');
4002
+ logMessage(entry.toURL(), 'blue');
4003
+ logMessage(entry.toInternalURL(), 'blue');
4004
+ logMessage('Resolving URL: ' + entry.toURL());
4005
+ resolveLocalFileSystemURL(entry.toURL(), function (entry2) {
4006
+ logMessage('Success', 'green');
4007
+ logMessage(entry2.toURL(), 'blue');
4008
+ logMessage(entry2.toInternalURL(), 'blue');
4009
+ }, logError('resolveLocalFileSystemURL'));
4010
+ }, logError('resolveLocalFileSystemURL'));
4011
+ }
4012
+
4013
+ function testPrivateURL () {
4014
+ requestFileSystem(LocalFileSystem.TEMPORARY, 0, function (fileSystem) {
4015
+ logMessage('Temporary root is at ' + fileSystem.root.toNativeURL());
4016
+ fileSystem.root.getFile('testfile', {
4017
+ create: true
4018
+ }, function (entry) {
4019
+ logMessage('Temporary file is at ' + entry.toNativeURL());
4020
+ if (entry.toNativeURL().substring(0, 12) === 'file:///var/') {
4021
+ logMessage('File starts with /var/, trying /private/var');
4022
+ var newURL = 'file://localhost/private/var/' + entry.toNativeURL().substring(12) + '?and=another_thing';
4023
+ // var newURL = entry.toNativeURL();
4024
+ logMessage(newURL, 'blue');
4025
+ resolveLocalFileSystemURL(newURL, function (newEntry) {
4026
+ logMessage('Successfully resolved.', 'green');
4027
+ logMessage(newEntry.toURL(), 'blue');
4028
+ logMessage(newEntry.toNativeURL(), 'blue');
4029
+ }, logError('resolveLocalFileSystemURL'));
4030
+ }
4031
+ }, logError('getFile'));
4032
+ }, logError('requestFileSystem'));
4033
+ }
4034
+
4035
+ function resolveFsContactImage () {
4036
+ navigator.contacts.pickContact(function (contact) {
4037
+ var logBox = document.getElementById('logContactBox');
4038
+ logBox.innerHTML = '';
4039
+ var resolveResult = document.createElement('p');
4040
+ if (contact.photos) {
4041
+ var photoURL = contact.photos[0].value;
4042
+ resolveLocalFileSystemURL(photoURL, function (entry) {
4043
+ /* eslint-enable no-undef */
4044
+ var contactImage = document.createElement('img');
4045
+ var contactLabelImage = document.createElement('p');
4046
+ contactLabelImage.innerHTML = 'Result contact image';
4047
+ contactImage.setAttribute('src', entry.toURL());
4048
+ resolveResult.innerHTML = 'Success resolve\n' + entry.toURL();
4049
+ logBox.appendChild(contactLabelImage);
4050
+ logBox.appendChild(contactImage);
4051
+ logBox.appendChild(resolveResult);
4052
+ },
4053
+ function (err) {
4054
+ console.log('resolve error' + err);
4055
+ });
4056
+ } else {
4057
+ resolveResult.innerHTML = 'Contact has no photos';
4058
+ logBox.appendChild(resolveResult);
4059
+ }
4060
+ },
4061
+ function (err) {
4062
+ console.log('contact pick error' + err);
4063
+ });
4064
+ }
4065
+
4066
+ function clearLog () {
4067
+ var log = document.getElementById('info');
4068
+ log.innerHTML = '';
4069
+ }
4070
+
4071
+ function logMessage (message, color) {
4072
+ var log = document.getElementById('info');
4073
+ var logLine = document.createElement('div');
4074
+ if (color) {
4075
+ logLine.style.color = color;
4076
+ }
4077
+ logLine.innerHTML = message;
4078
+ log.appendChild(logLine);
4079
+ }
4080
+
4081
+ function logError (serviceName) {
4082
+ return function (err) {
4083
+ logMessage('ERROR: ' + serviceName + ' ' + JSON.stringify(err), 'red');
4084
+ };
4085
+ }
4086
+
4087
+ var fsRoots = {
4088
+ 'ios': 'library,library-nosync,documents,documents-nosync,cache,bundle,root,private',
4089
+ 'osx': 'library,library-nosync,documents,documents-nosync,cache,bundle,root,private',
4090
+ 'android': 'files,files-external,documents,sdcard,cache,cache-external,assets,root',
4091
+ 'amazon-fireos': 'files,files-external,documents,sdcard,cache,cache-external,root',
4092
+ 'windows': 'temporary,persistent'
4093
+ };
4094
+
4095
+ // Add title and align to content
4096
+ var div = document.createElement('h2');
4097
+ div.appendChild(document.createTextNode('File Systems'));
4098
+ div.setAttribute('align', 'center');
4099
+ contentEl.appendChild(div);
4100
+
4101
+ div = document.createElement('h3');
4102
+ div.appendChild(document.createTextNode('Results are displayed in yellow status box below with expected results noted under that'));
4103
+ div.setAttribute('align', 'center');
4104
+ contentEl.appendChild(div);
4105
+
4106
+ div = document.createElement('div');
4107
+ div.setAttribute('id', 'button');
4108
+ div.setAttribute('align', 'center');
4109
+ contentEl.appendChild(div);
4110
+ /* eslint-disable no-undef */
4111
+ if (fsRoots.hasOwnProperty(cordova.platformId)) {
4112
+ (fsRoots[cordova.platformId].split(',')).forEach(function (fs) {
4113
+ if (cordova.platformId === 'ios' && fs === 'private') {
4114
+ /* eslint-enable no-undef */
4115
+ createActionButton('Test private URL (iOS)', function () {
4116
+ clearLog();
4117
+ testPrivateURL();
4118
+ }, 'button');
4119
+ } else {
4120
+ createActionButton(fs, function () {
4121
+ clearLog();
4122
+ resolveFs(fs);
4123
+ }, 'button');
4124
+ }
4125
+ });
4126
+ }
4127
+
4128
+ div = document.createElement('div');
4129
+ div.setAttribute('id', 'info');
4130
+ div.setAttribute('align', 'center');
4131
+ contentEl.appendChild(div);
4132
+
4133
+ div = document.createElement('h3');
4134
+ div.appendChild(document.createTextNode('For each test above, file or directory should be successfully found. ' +
4135
+ 'Status box should say Resolving URL was Success. The first URL resolved is the internal URL. ' +
4136
+ 'The second URL resolved is the absolute URL. Blue URLs must match.'));
4137
+ contentEl.appendChild(div);
4138
+
4139
+ div = document.createElement('h3');
4140
+ div.appendChild(document.createTextNode('For Test private URL (iOS), the private URL (first blue URL in status box) ' +
4141
+ 'should be successfully resolved. Status box should say Successfully resolved. Both blue URLs below ' +
4142
+ 'that should match.'));
4143
+ contentEl.appendChild(div);
4144
+
4145
+ div = document.createElement('h2');
4146
+ div.appendChild(document.createTextNode('Resolving content urls'));
4147
+ div.setAttribute('align', 'center');
4148
+ contentEl.appendChild(div);
4149
+
4150
+ div = document.createElement('div');
4151
+ div.setAttribute('id', 'contactButton');
4152
+ div.setAttribute('align', 'center');
4153
+ contentEl.appendChild(div);
4154
+
4155
+ div = document.createElement('div');
4156
+ div.setAttribute('id', 'logContactBox');
4157
+ div.setAttribute('align', 'center');
4158
+ contentEl.appendChild(div);
4159
+
4160
+ createActionButton('show-contact-image', function () {
4161
+ resolveFsContactImage();
4162
+ }, 'contactButton');
4163
+ };