aqsa test: asynchronous query from web worker to native iOS code using XHR
Author: Christopher J. Brody
License: UNLICENSE (public domain)
I can hereby testify that this project is completely my own work and not subject to agreements with any other parties. In case of code written under direct guidance from sample code the link is given for reference. In case I accept contributions from any others I will require CLA with similar statements.
This project demonstrates the following:
- Ability to request native iOS functionality from within a web worker and return a callback to the web worker.
file:URI (FUTURE TBD custom URI protocol prefix)
aqcallbackfunction with a string that echos the URI from the XHR request
This project also has an
AQManager component that keeps and handles the routing for multiple components that implement the
In addition, the custom
ViewController registers a function object in the
This project is a starting point for the following ideas (so far):
The Cordova project has been fixing security issues in its external domain whitelist plugin over time, and has also dealt with security issues in its internal bridging mechanism. It is very strongly advised NOT to release an app with a custom-built web view bridging or domain whitelisting mechanism without proper code review and testing.
Major tips & tricks
- Uses a subclass of
NSURLProtocolto intercept XHR requests
- @brodybits / aq-query-test-android - request native Android functionality from within a web worker
- @brodybits / cordova-aqs-ios and @brodybits / cordova-aqs-android
A similar concept described in my Starting JSONBus: towards a replacement for Cordova/PhoneGap post on an old blog in December 2012.