On 2/12/12 3:48 AM, Tankred Hase wrote: > >> > It seems these objects aren't available to Web Workers due to >> > concurrency >> > issues: > http://www.html5rocks.com/en/tutorials/workers/basics/#toc-enviornment-features >> > >> > Does anyone have an idea how to work around this issue? Thank! >> >> Can't the access to window.crypto and window.localStorage be made >> asyncronous, by abstracting a class to access all document.* and >> window.* functions? > > Well you have to add all dependant js scripts to the web worker. Even if > they functions are called asynchronously, they will still be executed in > the worker thread. > > Im thinking this problem could be solved by depency injection. Namely by > saving the function in a variable "var crypto = window.crypto" and then > passing these function pointers into the constructor of openpgp.js. This > way the javascript does not need knowledge of the window object. Do you > think this could work?
Alex, Sean, you're the OpenPGP guru guys, what do you think on it? Frankly i don't have the deep knowledge to understand if the proposed fix solve the issue. I would just underline that this is a critical issue to be able to handle in "background" the encryption process without blocking the UI that will be able to show nice progress-bar on the status of operation. It would represent a major step in the "architectural constrain" of OpenPGPJS, let's improve it! -naif _______________________________________________ http://openpgpjs.org

