-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Dart2JS ByteBuffers inconsistence #12365
Comments
The VM and dart2js implementations are slightly inconsistent. I suspect that your program has a small bug but works in the VM because a single object (your buffer/list) implements both interfaces: Uint8List and ByteBuffer. On dart2js these are always separate types - no browser object implements both interfaces. My guess is that Reader._base is actually initialized to a ByteBuffer. On the VM this does not matter because it is also a Uint8List. Because the VM Uint8List is also a ByteBuffer, running on the VM did not help you find this bug. If my guess is correct I would like to close this bug as a duplicate of Issue #10136. Added Triaged label. |
This comment was originally written by [email protected] ОК, I see now. Really, it was my mistake, the HttpRequest.responce's type was unexpected and it was not typechecked in preconditions of Reader's constructor. Thanks for quick answer! |
This issue was originally filed by [email protected]
I'm using dart to create some binary file reader in browser. So, i wrote code, that works with dart:typed_data.ByteData, it uses Uint8List as data keeper and ByteData as raw data converter.
The code i wrote perfectly works on Dartium, but when i've tried to execute dart2js compiled code in Chrome 28.0.1500.95 m (Win7 x64), i've meet up some troubles.
What steps will reproduce the problem?
0. Open in
int readInt(){
assert(!this.eof);
ByteBuffer bb = this._base.buffer;
ByteData bd = new ByteData.view(bb, this._pos, 4);
assert(bd != null);
this._seekPos(this._pos+4);
return bd.getInt32(0, this._endian);
}
Uncaught Error: NoSuchMethodError : method not found: 'Object #<ByteBuffer> has no method 'get$buffer''
Receiver: ""
Arguments: []
Stack Trace:
TypeError: Object #<ByteBuffer> has no method 'get$buffer'
at $.get$buffer$x (http://127.0.0.1:3030/D:/dev/tmp/repos/odc/odc/web/odc.dart.js:73305:39)
at Reader.readInt$0 (http://127.0.0.1:3030/D:/dev/tmp/repos/odc/odc/web/odc.dart.js:65194:41)
at Documents_importDocument (http://127.0.0.1:3030/D:/dev/tmp/repos/odc/odc/web/odc.dart.js:63395:12)
The text was updated successfully, but these errors were encountered: