> Could it possibly be that the ArrayBuffer is coming from another browsing
> context? (iframe)
The isInstanceOfArrayBuffer returns false.
But the the crash happnes here: handleJetFile calls to getLength, then
getLength at the entry calls to com.google.gwt....Cast.castToNative(src),
without the second arg (jsType)
public abstract class FileDropHandler<FileT> extends InputClientAdapter {
protected abstract int getLength(FileT buffer);
protected void handleJetFile(final String file, final FileT buffer) {
Logger.log("Handle jet file. length = " + getLength(buffer));
....
}
}
public class FileDropHandlerGwt extends FileDropHandler<ArrayBuffer> {
...
@Override
protected int getLength(ArrayBuffer buffer) {
return buffer.getByteLength();
}
}
вторник, 22 августа 2017 г., 18:08:55 UTC+3 пользователь Thomas Broyer
написал:
>
> Could it possibly be that the ArrayBuffer is coming from another browsing
> context? (iframe)
> What would the following output?
>
> private native boolean isInstanceOfArrayBuffer(Object x) /*-{
> return x instanceof $wnd.ArrayBuffer;
> }-*/;
>
> On Tuesday, August 22, 2017 at 2:04:30 PM UTC+2, Kirill Prazdnikov wrote:
>>
>> Sorry, copypaster error, here is the fixed
>>
>> getType(buffer) = [object ArrayBuffer]
>> typeOf(buffer) = object
>>
>>
>> вторник, 22 августа 2017 г., 15:02:49 UTC+3 пользователь Kirill
>> Prazdnikov написал:
>>>
>>> Here it is:
>>>
>>> getType(buffer) = [object ArrayBuffer]
>>> typeOf(buffer) = [object ArrayBuffer]
>>>
>>> private native String getType(Object x) /*-{
>>> return Object.prototype.toString.call(x);
>>> }-*/;
>>>
>>> private native String typeOf(Object x) /*-{
>>> return typeof x;
>>> }-*/;
>>>
>>>
>>>
>>> понедельник, 21 августа 2017 г., 21:47:37 UTC+3 пользователь Tony
>>> BenBrahim написал:
>>>>
>>>> Take the object you get back from the file reader and run it through
>>>> the JSNI method below and GWT,log the result. .Let's see if it really
>>>> is an ArrayBuffer.(I would note the FileReader result is sometimes a
>>>> String
>>>> and sometimes an ArrayBuffer).
>>>>
>>>> private native String getType(Object x)/*-{
>>>> return Object.prototype.toString.call(x);
>>>> }-*/
>>>>
>>>>
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.