Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Allow XHR to file:// and allow local file (upload) handling - #26

Closed
rubenstolk wants to merge 1 commit into
apache:masterfrom
rubenstolk:feature/allow-file-access
Closed

rubenstolk wants to merge 1 commit into
apache:masterfrom
rubenstolk:feature/allow-file-access

Conversation

@rubenstolk

@rubenstolk rubenstolk commented Dec 25, 2016 •

Copy link
Copy Markdown

Until there is a better solution to setting this property, this solves the XHR and local file api issues.
This issue is described further in https://bugs.webkit.org/show_bug.cgi?id=154916.

Platforms affected

  • iOS

What does this PR do?

  • Prevents "Security DOM 18 error" while manipulating files, such as handling file uploads
  • Prevents "NetworkError (DOM Exception 19): A network error occurred." while loading files through XHR from file://

What testing has been done on this change?

  • XHR and file handling

Checklist

  • Reported an issue in the JIRA database
  • Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
  • Added automated test coverage as appropriate for this change.

@rubenstolk rubenstolk changed the title Allow file access until https://bugs.webkit.org/show_bug.cgi?id=154916 is solved Allow XHR to file:// and allow local file (upload) handling Dec 27, 2016
@shazron

shazron commented Jan 4, 2017 •

Copy link
Copy Markdown
Member

Although I replied to you jokingly on Twitter, let me explain why this is not a good idea, and I'm 100% sure will not be approved by the committers on Apache Cordova based on the precedent of trying to add unsupported methods to Cordova from before.

The key word is "unsupported". Apache Cordova cannot rely on an API that is not officially approved by Apple and may go away at any time without a deprecation period, and may cripple existing apps after an iOS update. There is even a warning by an Apple employee (Anders) at the end of that Webkit bug also.

@rubenstolk

Copy link
Copy Markdown
Author

I'm aware of the unsupportedness but I don't think we should give up on this. We all know that 1000s of developers are relying on UIWebView rather than WKWebView just because of this issue.

Honestly I don't understand why the webkit bug hasn't been addressed with higher importance by the Cordova developers...

@kerrishotts

Copy link
Copy Markdown

@rubenstolk:

First, thanks for the contribution!

However, in this instance, I agree with @shazron; the fix may work, but due to the unsupported and undocumented nature of this, it puts all apps built with this engine at far too much risk (both for rejection and future failure). This isn't "giving up", but when Apple says 'don't do it that way', we have to figure something else out. You might try this, which might help in your case.

Of course, the community is free to fork the repository and add the code themselves. If the suggestion above doesn't work, that would be my next suggestion, but of course, that doesn't mean you might not get a rejection from Apple when submitting to the store. For Enterprise stuff that wouldn't matter, but the app might stop working in the future should Apple change how that setting works.

@rubenstolk

Copy link
Copy Markdown
Author

Replaced by #30

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants