Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(browser) support safari private browsing mode by using base64 text i…
…nstead of blob (#301) ### Platforms affected cordova-browser ### Motivation and Context Bascially cordova-browser uses indexeddb in order to store File(Blob) object as file-saving. However the private browsing mode on safari browser in mac does not permit to store File(Blob) object into the indexeddb. (See Webkit source code https://github.com/WebKit/webkit/blob/5dada1bf8d706e1c544f1a23bfb67f3eaeb4f412/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp#L328-L331 ) This PR is to fix this issue. ### Description The private borwsing mode on safari throws `DataCloneError` when storing Blob object to indexeddb. Therefore this PR detects `DataCloneError` and store base64 encoded text instead of Blob object itself. According to this, decoding/encoding helper functions are introduced. Note that the safari browser (emulator ?) in the saucelab used in travis ci seems to work in private browsing mode. For example previous master branch fails tests for safari browser in travis ci like https://travis-ci.org/apache/cordova-plugin-file/builds/502885593?utm_source=github_status&utm_medium=notification . This PR fix the issue. ### Testing The test with both public and private browsing modes on safari on My local mac are done. I confirmed this PR passes all test suites (specs). ### Checklist - [ ] I've run the tests to see all new and existing tests pass - [ ] I added automated test coverage as appropriate for this change - [ ] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`) - [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/)) - [ ] I've updated the documentation if necessary
- Loading branch information