Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(browser) support safari private browsing mode by using base64 text instead of blob #301

Merged
merged 1 commit into from
Mar 22, 2019

Conversation

knight9999
Copy link
Contributor

@knight9999 knight9999 commented Mar 15, 2019

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)
  • I've updated the documentation if necessary

@knight9999 knight9999 changed the title [WIP] support safari private browsing. use json instead of blob [WIP] (borwser) support safari private browsing, by using base64 text instead of blob Mar 15, 2019
@knight9999 knight9999 changed the title [WIP] (borwser) support safari private browsing, by using base64 text instead of blob [WIP] (borwser) support safari private browsing mode by using base64 text instead of blob Mar 15, 2019
@knight9999 knight9999 changed the title [WIP] (borwser) support safari private browsing mode by using base64 text instead of blob (borwser) support safari private browsing mode by using base64 text instead of blob Mar 15, 2019
Copy link
Member

@janpio janpio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are a hero @knight9999!

@janpio janpio changed the title (borwser) support safari private browsing mode by using base64 text instead of blob (browser) support safari private browsing mode by using base64 text instead of blob Mar 18, 2019
@knight9999
Copy link
Contributor Author

@janpio Thanks for the comment!

@janpio janpio merged commit c609ff6 into apache:master Mar 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants