I see.. I've added similar logic to windows phone exec bridge https://github.com/apache/cordova-js/pull/59
Tested on File Api, below is updated version after patching wp bridge https://github.com/apache/cordova-plugin-file/pull/18 PS. As showed at [1] manual array manipulation is not the fastest solution but it is the most convenient synchronous one [1]http://updates.html5rocks.com/2012/06/How-to-convert-ArrayBuffer-to-and-from-String Thx! Sergey -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Ian Clelland Sent: Monday, December 9, 2013 9:06 PM To: [email protected] Subject: Re: Windows Phone binary bridge Yes, we used to use that; I had to switch it to use a base64-encoding method; Using Array.prototype.apply() literally pushes every element of the array individually onto the stack as a separate argument. The exact limit depends on the device, but eventually they all fail with a "Stack exploded"-sort-of-exception. Ian On Mon, Dec 9, 2013 at 10:32 AM, Michal Mocny <[email protected]> wrote: > Where do you see an implementation using Array.apply(null, new > Uint8Array(...)) ? > > We used to have this bug in ios/android binary bridge but that was > patched many releases ago (unless there is a stray one somewhere that > still needs fixing). > > > On Mon, Dec 9, 2013 at 10:15 AM, Sergey Grebnov (Akvelon) < > [email protected]> wrote: > > > Working on this...I just found out that current implementation via > > Array.apply(null, new Uint8Array(...)) doesn't work for big buffers > (bigger > > than 150Kb) and could raise Maximum call stack size exceeded error. > > So > I'm > > looking on better/right way to do typed arrays conversion... will > > keep > you > > updated. > > > > Thx! > > Sergey > > -----Original Message----- > > From: Parashuram Narasimhan (MS OPEN TECH) [mailto: > [email protected]] > > Sent: Saturday, December 7, 2013 1:52 AM > > To: [email protected] > > Subject: RE: Windows Phone binary bridge > > > > I think Sergey should be able to squeeze this into his schedule. We > > were looking at fixing plugin support and this could be a good way > > to start > it. > > > > -----Original Message----- > > From: Jesse [mailto:[email protected]] > > Sent: Friday, December 6, 2013 1:30 PM > > To: [email protected] > > Subject: Re: Windows Phone binary bridge > > > > FYI, you can buy a no contract Nokia 520 WP8 device for $120, and > > developing in the emulator is more than sufficient for most tasks. > > > > Sergey, do you got this? > > > > > > @purplecabbage > > risingj.com > > > > > > On Fri, Dec 6, 2013 at 11:21 AM, Ian Clelland > > <[email protected] > > >wrote: > > > > > On Fri, Dec 6, 2013 at 2:15 PM, Sergey Grebnov (Akvelon) < > > > [email protected]> wrote: > > > > > > > Agree and like this idea. I don't think there are many other > > > > components (if any) which use ArrayBuffer but must be tested > > > > well anyway since this changes core. Ian do you want to complete > > > > this yourself or you are ok if > > > I > > > > handle this? > > > > > > > > > > I'm totally okay with you doing it -- I don't have a real windows > > > phone device to test it on; I'd be committing with my eyes closed > > > and hoping for the best :) > > > > > > I think you're right that there aren't any other core plugins > > > using the binary bridge, but that could change, and there are > > > probably already third-party plugins using it. > > > > > > If we do this right, then other developers won't have to roll > > > their own solution in each case, and it will be easier to port the > > > third-party plugins to WP. > > > > > > Let me know if you need any support; I'll help if I can. > > > > > > Ian > > > > > > > > > > > > > > -Sergey > > > > -----Original Message----- > > > > From: [email protected] [mailto:[email protected]] On > > > > Behalf Of > > > Ian > > > > Clelland > > > > Sent: Friday, December 6, 2013 7:37 PM > > > > To: [email protected] > > > > Subject: Windows Phone binary bridge > > > > > > > > As far as I can tell from reading its exec.js, WP8 does not have > > > > a binary bridge of any kind. Non-string data get JSON-serialized > > > > for > > transfer. > > > > > > > > The recent patch for CB-5532 broke the File plugin by explicitly > > > > casting ArrayBuffer data to Array type. Sergey's fixed it now, > > > > but the FileWriter JS code still has special cases for Windows > > > > and WP8 > > platforms. > > > > > > > > Would it make sense to have this code moved into the WP8 exec bridge? > > > Then > > > > it could apply to any plugins which transfer binary data, and > > > > any > > > improved > > > > transport methods would automatically be used by all plugins, > > > > rather than being a special case in each plugin. > > > > > > > > I don't know much about the Windows phone platform, so I could > > > > be completely off-base about this, but if it works, I think > > > > it'll make the implementation cleaner, and generally make > > > > Cordova better on the > > > platform. > > > > > > > > Ian > > > > > > > > > >
