wehe64 opened a new issue #423:
URL: https://github.com/apache/cordova-plugin-file/issues/423


   # Bug Report: 
   
   ## FileWriter silently fails in IFrame with 'Invalid Parameter type'
   
   ## Problem
   
   A blob/pdf is written to a temporary file on the device and then opened via 
the platform's OS. This workes fine when the test-doc is properly compiled into 
its own platform app on Android or iOS.
   
   But I want my app to come empty and be installed without it's content 
document, which should be downloaded and locally stored by the final user only.
   
   When the test-doc is downloaded by a loader-app, then written to the device 
storage and displayed from there in an IFrame, everything looks and works fine, 
except this:
   
   * When the doc's JS creates a FileWriter, all looks good, but no data gets 
written. No Error occurs and the empty file is passed on to the file-opener2 
and finally the PDF-viewer complains about the corrupt pdf.
   
   On iOS the console shows an error inside the FileWriter object, on Android, 
no errors are reported at all.
   
   ### What is expected to happen?
   
   - [LoaderApp](https://github.com/wehe64/cordova-LoaderApp) started, then 
loades & stores the [loaderDoc](https://github.com/wehe64/cordova-loaderDoc) 
web-document, 
   - the loaderDoc should be able to download, store, open and display a 
test-PDF from Github.
   
   ### What does actually happen?
   
   - pdf file size always empty (or just 2bytes)
   - no errors in console on Android
   - on iOS in console:<br/>
     ``FileWriter`` error: ``'Unknown Parameter type'``
   
   ![remote 
console](https://github.com/wehe64/cordova-loaderDoc/raw/master/remote-console.png)
   
   ## Information
   <!-- Include all relevant information that might help understand and 
reproduce the problem -->
   
   the cordova [loaderDoc](https://github.com/wehe64/cordova-loaderDoc)  
project 
   - can either run as is (w/o the LoaderApp) - and works fine
   - or be payload for the LoaderApp, that is:
     - have its www-folder downloaded as zip,
     - be stored locally on the device
     - and then opened from there in an IFrame
     *  **in both cases the same code runs -<br> 
     in the latter case it fails**
   
   
   
   ### DROP-IN www/cordova.js:
   
   `www/cordova.js` of the [payload 
document](https://github.com/wehe64/cordova-loaderDoc) is meant to be replaced 
during cordova's build procress. 
     
   In two cases it won't be replaced and is used as is:
    - before the raw web-doc is put inside a cordova project's www/ folder 
(happens on the CMS creating the doc)
    - if it resides in the LoaderApp's IFrame, in this case proxies of the 
plugins are created inside the IFrame
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   1. build the [loaderDoc](https://github.com/wehe64/cordova-loaderDoc) as a 
cordova app, install/run it,<br>
      see if it manages to download, write and open the test-pdf
   2. build and run the 
[LoaderApp](https://github.com/wehe64/cordova-LoaderApp), have it download the 
loaderDoc, save and open it, and finally have the loaderDoc fail its 
test-operation.
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you 
experiencing the issue? -->
   
   Desktop Linux:
   ```
   5.8.6-1-MANJARO, x86_64 GNU/Linux
   ```
   
   Desktop OS/X:
   ```
   Systemversion:       macOS 10.15.6 (19G2021)
   Kernel-Version:      Darwin 19.6.0
   ```
   
   Android:
   ```sh
   Galaxy Tab-A Model SM-T510
   Android-Version: 10
   Kernel-Version: 4.4.177-19000394
   # 1 Tue June 30 16:25:20 KST 2020
   ```
   
   iOS:
   ```sh
   iPAD Air 2
   iOS-Version 14.0
   ModelNo MGHY2FD/A
   ```
   
   
   
   ### Version information
   <!-- 
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins 
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   
   for both LoaderApp and and the loaderDoc:
   
   ```
   > cordova --version
   10.0.0
   ```
   ```
   > cordova platform ls
   Installed platforms:
     android 9.0.0
     ios 6.1.1
   ```
   
   ```sh
   > cordova plugin ls
   cordova-plugin-device 2.0.3 "Device"
   cordova-plugin-dialogs 2.0.2 "Notification"
   cordova-plugin-file-opener2 3.0.5 "File Opener2"
   cordova-plugin-file 6.0.2 "File"
   cordova-plugin-whitelist 1.3.4 "Whitelist"
   ```
   
   
   ```
   - jQuery 3.5.1.min.js
   - jszip.min.js
   ```
   
   
   
   ```sh
   Android Studio 4.0.1
   Build #AI-193.6911.18.40.6626763, built on June 25, 2020
   Runtime version: 1.8.0_242-release-1644-b3-6222593 amd64
   VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
   Linux 5.8.6-1-MANJARO
   GC: ParNew, ConcurrentMarkSweep
   Memory: 1981M
   Cores: 8
   Registry: ide.new.welcome.screen.force=true
   Non-Bundled Plugins: org.jetbrains.kotlin, com.google.services.firebase
   ```
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to