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

bytebuffer.js in Android WebView throws TypeError #79

Open
pawelrychlik opened this issue Nov 9, 2016 · 4 comments
Open

bytebuffer.js in Android WebView throws TypeError #79

pawelrychlik opened this issue Nov 9, 2016 · 4 comments

Comments

@pawelrychlik
Copy link

Hi,

I'm using the browser flavor of bytebuffer.js (the one based on ArrayBuffers) in an app built on top of Apache Cordova (irrelevant, I believe), which uses Android WebView - basically a Chromium-based embedded browser.

I'm getting a TypeError: Cannot read property 'length' of null in:

var b = new ByteBuffer(0, ByteBuffer.LITTLE_ENDIAN);
b.ensureCapacity(100); // this throws

My WebView does have support for ArrayBuffers and Uint8Arrays. Are there any other requirements? Any ideas?


I'm using:

If I try with bytebuffer-dataview.js, all is fine. The point is that I have limited CPU/RAM resources and tons of binary data to process, so I'm looking into ways how to shave off some seconds in the processing.

/Pawel

@dcodeIO
Copy link
Member

dcodeIO commented Nov 9, 2016

When using https://github.com/dcodeIO/bytebuffer.js/blob/master/dist/bytebuffer.js , do you have a line reference for me? There are a couple of accesses to length.

@pawelrychlik
Copy link
Author

Yep.

ByteBufferPrototype.resize  @   bytebuffer.js:2848
ByteBufferPrototype.ensureCapacity  @   bytebuffer.js:2609

@dcodeIO
Copy link
Member

dcodeIO commented Nov 9, 2016

Hmm, no access to a length property there.

@pawelrychlik
Copy link
Author

I just figured out that if I hack around dist/bytebuffer.js:77 and :2507 and let this.view = new Uint8Array(this.buffer); then it works fine for me (see the dirty pawelrychlik@262ee4c and don't pay attention to line endings). Now I guess I need to find my way through MetaScript to fix this properly.

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

No branches or pull requests

2 participants