diff --git a/suite.js b/suite.js index 9351051..a8fc460 100644 --- a/suite.js +++ b/suite.js @@ -16,14 +16,41 @@ function tests(isNative, TextEncoder, TextDecoder) { const out = dec.decode(buffer); assert.equal(out, s); - }); suite('decoder', () => { test('basic', () => { const buffer = new Uint8Array([104, 101, 108, 108, 111]); - assert.equal(dec.decode(buffer), 'hello'); + assert.equal(dec.decode(buffer), 'hello', 'directly Uint8Array'); + assert.equal(dec.decode(buffer.buffer), 'hello', 'pass underlying ArrayBuffer'); + }); + + test('non-8 backing', () => { + // If passed a Uint32Array, TextDecoder will still decode the real + // underlying bytes. Source data must be aligned. + const padded = new Uint8Array([104, 101, 108, 108, 111, 33, 46, 46]); + const u32 = new Uint32Array(padded.buffer); + assert.equal(padded.length >> 2, u32.length, 'u32 must be 1/4 of real data'); + assert.equal(dec.decode(u32), 'hello!..', 'pass Uint32Array'); + assert.equal(dec.decode(u32.buffer), 'hello!..', 'pass Uint32Array\'s buffer'); + + // Ensure that we don't parse larger typed arrays as uint8's. We expect + // nulls here to pad out the remaining three bytes in every word. + const u32raw = new Uint32Array([104, 105, 33, 46]); + assert.equal(dec.decode(u32raw), 'h\0\0\0i\0\0\0!\0\0\0.\0\0\0', 'u32 with nulls'); + }); + + test('arraylike', () => { + const arr = [104, 101, 108, 108, 111]; + + if (isNative) { + // Native can't take Array. + assert.throws(() => dec.decode(arr)); + } else { + // Polyfill can accept Array or array-like. + assert.equal(dec.decode(arr), 'hello', 'decode arraylike'); + } }); test('constructor', () => { diff --git a/text.js b/text.js index a0819a0..96b866e 100644 --- a/text.js +++ b/text.js @@ -254,14 +254,21 @@ FastTextDecoder.prototype['decode'] = function(buffer, options={stream: false}) throw new Error(`Failed to decode: the 'stream' option is unsupported.`); } - // Accept Uint8Array instances as-is. - let bytes = buffer; - - // Look for ArrayBufferView, which isn't a real type, but basically represents - // all the valid TypedArray types plus DataView. They all have ".buffer" as - // an instance of ArrayBuffer. - if (!(bytes instanceof Uint8Array) && bytes.buffer instanceof ArrayBuffer) { + let bytes; + + if (buffer instanceof Uint8Array) { + // Accept Uint8Array instances as-is. + bytes = buffer; + } else if (buffer.buffer instanceof ArrayBuffer) { + // Look for ArrayBufferView, which isn't a real type, but basically + // represents all the valid TypedArray types plus DataView. They all have + // ".buffer" as an instance of ArrayBuffer. bytes = new Uint8Array(buffer.buffer); + } else { + // The only other valid argument here is that "buffer" is an ArrayBuffer. + // We also try to convert anything else passed to a Uint8Array, as this + // catches anything that's array-like. Native code would throw here. + bytes = new Uint8Array(buffer); } return decodeImpl(/** @type {!Uint8Array} */ (bytes)); diff --git a/text.min.js b/text.min.js index f3c7636..62457f7 100644 --- a/text.min.js +++ b/text.min.js @@ -1,6 +1,6 @@ -(function(l){function m(){}function k(c,a){c=void 0===c?"utf-8":c;a=void 0===a?{fatal:!1}:a;if(-1===r.indexOf(c.toLowerCase()))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+c+"') is invalid.");if(a.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.");}function t(c){return Buffer.from(c.buffer,c.byteOffset,c.byteLength).toString("utf-8")}function u(c){var a=URL.createObjectURL(new Blob([c],{type:"text/plain;charset=UTF-8"})); -try{var f=new XMLHttpRequest;f.open("GET",a,!1);f.send();return f.responseText}catch(e){return q(c)}finally{URL.revokeObjectURL(a)}}function q(c){for(var a=0,f=Math.min(65536,c.length+1),e=new Uint16Array(f),h=[],d=0;;){var b=a=f-1){h.push(String.fromCharCode.apply(null,e.subarray(0,d)));if(!b)return h.join("");c=c.subarray(a);d=a=0}b=c[a++];if(0===(b&128))e[d++]=b;else if(192===(b&224)){var g=c[a++]&63;e[d++]=(b&31)<<6|g}else if(224===(b&240)){g=c[a++]&63;var n=c[a++]&63;e[d++]= -(b&31)<<12|g<<6|n}else if(240===(b&248)){g=c[a++]&63;n=c[a++]&63;var v=c[a++]&63;b=(b&7)<<18|g<<12|n<<6|v;65535>>10&1023|55296,b=56320|b&1023);e[d++]=b}}}if(l.TextEncoder&&l.TextDecoder)return!1;var r=["utf-8","utf8","unicode-1-1-utf-8"];Object.defineProperty(m.prototype,"encoding",{value:"utf-8"});m.prototype.encode=function(c,a){a=void 0===a?{stream:!1}:a;if(a.stream)throw Error("Failed to encode: the 'stream' option is unsupported.");a=0;for(var f=c.length,e=0,h=Math.max(32, -f+(f>>>1)+7),d=new Uint8Array(h>>>3<<3);a=b){if(a=b)continue}e+4>d.length&&(h+=8,h*=1+a/c.length*2,h=h>>>3<<3,g=new Uint8Array(h),g.set(d),d=g);if(0===(b&4294967168))d[e++]=b;else{if(0===(b&4294965248))d[e++]=b>>>6&31|192;else if(0===(b&4294901760))d[e++]=b>>>12&15|224,d[e++]=b>>>6&63|128;else if(0===(b&4292870144))d[e++]=b>>>18&7|240,d[e++]=b>>>12& -63|128,d[e++]=b>>>6&63|128;else continue;d[e++]=b&63|128}}return d.slice?d.slice(0,e):d.subarray(0,e)};Object.defineProperty(k.prototype,"encoding",{value:"utf-8"});Object.defineProperty(k.prototype,"fatal",{value:!1});Object.defineProperty(k.prototype,"ignoreBOM",{value:!1});var p=q;"function"===typeof Buffer&&Buffer.from?p=t:"function"===typeof Blob&&"function"===typeof URL&&"function"===typeof URL.createObjectURL&&(p=u);k.prototype.decode=function(c,a){a=void 0===a?{stream:!1}:a;if(a.stream)throw Error("Failed to decode: the 'stream' option is unsupported."); -a=c;!(a instanceof Uint8Array)&&a.buffer instanceof ArrayBuffer&&(a=new Uint8Array(c.buffer));return p(a)};l.TextEncoder=m;l.TextDecoder=k})("undefined"!==typeof window?window:"undefined"!==typeof global?global:this); +(function(l){function m(){}function k(a,c){a=void 0===a?"utf-8":a;c=void 0===c?{fatal:!1}:c;if(-1===r.indexOf(a.toLowerCase()))throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+a+"') is invalid.");if(c.fatal)throw Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.");}function t(a){return Buffer.from(a.buffer,a.byteOffset,a.byteLength).toString("utf-8")}function u(a){var c=URL.createObjectURL(new Blob([a],{type:"text/plain;charset=UTF-8"})); +try{var f=new XMLHttpRequest;f.open("GET",c,!1);f.send();return f.responseText}catch(e){return q(a)}finally{URL.revokeObjectURL(c)}}function q(a){for(var c=0,f=Math.min(65536,a.length+1),e=new Uint16Array(f),h=[],d=0;;){var b=c=f-1){h.push(String.fromCharCode.apply(null,e.subarray(0,d)));if(!b)return h.join("");a=a.subarray(c);d=c=0}b=a[c++];if(0===(b&128))e[d++]=b;else if(192===(b&224)){var g=a[c++]&63;e[d++]=(b&31)<<6|g}else if(224===(b&240)){g=a[c++]&63;var n=a[c++]&63;e[d++]= +(b&31)<<12|g<<6|n}else if(240===(b&248)){g=a[c++]&63;n=a[c++]&63;var v=a[c++]&63;b=(b&7)<<18|g<<12|n<<6|v;65535>>10&1023|55296,b=56320|b&1023);e[d++]=b}}}if(l.TextEncoder&&l.TextDecoder)return!1;var r=["utf-8","utf8","unicode-1-1-utf-8"];Object.defineProperty(m.prototype,"encoding",{value:"utf-8"});m.prototype.encode=function(a,c){c=void 0===c?{stream:!1}:c;if(c.stream)throw Error("Failed to encode: the 'stream' option is unsupported.");c=0;for(var f=a.length,e=0,h=Math.max(32, +f+(f>>>1)+7),d=new Uint8Array(h>>>3<<3);c=b){if(c=b)continue}e+4>d.length&&(h+=8,h*=1+c/a.length*2,h=h>>>3<<3,g=new Uint8Array(h),g.set(d),d=g);if(0===(b&4294967168))d[e++]=b;else{if(0===(b&4294965248))d[e++]=b>>>6&31|192;else if(0===(b&4294901760))d[e++]=b>>>12&15|224,d[e++]=b>>>6&63|128;else if(0===(b&4292870144))d[e++]=b>>>18&7|240,d[e++]=b>>>12& +63|128,d[e++]=b>>>6&63|128;else continue;d[e++]=b&63|128}}return d.slice?d.slice(0,e):d.subarray(0,e)};Object.defineProperty(k.prototype,"encoding",{value:"utf-8"});Object.defineProperty(k.prototype,"fatal",{value:!1});Object.defineProperty(k.prototype,"ignoreBOM",{value:!1});var p=q;"function"===typeof Buffer&&Buffer.from?p=t:"function"===typeof Blob&&"function"===typeof URL&&"function"===typeof URL.createObjectURL&&(p=u);k.prototype.decode=function(a,c){c=void 0===c?{stream:!1}:c;if(c.stream)throw Error("Failed to decode: the 'stream' option is unsupported."); +a=a instanceof Uint8Array?a:a.buffer instanceof ArrayBuffer?new Uint8Array(a.buffer):new Uint8Array(a);return p(a)};l.TextEncoder=m;l.TextDecoder=k})("undefined"!==typeof window?window:"undefined"!==typeof global?global:this); diff --git a/text.min.js.map b/text.min.js.map index cb41bf4..747307d 100644 --- a/text.min.js.map +++ b/text.min.js.map @@ -2,7 +2,7 @@ "version":3, "file":"text.min.js", "lineCount":6, -"mappings":"AAsBC,SAAQ,CAACA,CAAD,CAAQ,CAcjBC,QAASA,EAAe,EAAG,EAgF3BC,QAASA,EAAe,CAACC,CAAD,CAAmBC,CAAnB,CAA2C,CAA1CD,CAAA,CAAA,IAAA,EAAA,GAAAA,CAAA,CAAS,OAAT,CAAAA,CAAkBC,EAAA,CAAA,IAAA,EAAA,GAAAA,CAAA,CAAQ,CAACC,MAAO,CAAA,CAAR,CAAR,CAAAD,CACzC,IAAuD,EAAvD,GAAIE,CAAAC,QAAA,CAAuBJ,CAAAK,YAAA,EAAvB,CAAJ,CACE,KAAM,KAAIC,UAAJ,CACJ,mEADI,CACgEN,CADhE,CACJ,gBADI,CAAN,CAGF,GAAIC,CAAAC,MAAJ,CACE,KAAUK,MAAJ,CAAU,uEAAV,CAAN,CAN+D,CAoBnEC,QAASA,EAAY,CAACC,CAAD,CAAQ,CAC3B,MAAOC,OAAAC,KAAA,CAAYF,CAAAG,OAAZ,CAA0BH,CAAAI,WAA1B,CAA4CJ,CAAAK,WAA5C,CAAAC,SAAA,CAAuE,OAAvE,CADoB,CAQ7BC,QAASA,EAAa,CAACP,CAAD,CAAQ,CAE5B,IAAMQ,EAAIC,GAAAC,gBAAA,CADAC,IAAIC,IAAJD,CAAS,CAACX,CAAD,CAATW,CAAkB,CAACE,KAAM,0BAAP,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AAC1C,CAAD,CAASX,CAAT,CAAkC,CAAzBA,CAAA,CAAA,IAAA,EAAA,GAAAA,CAAA,CAAQ,CAACwD,OAAQ,CAAA,CAAT,CAAR,CAAAxD,CACrD,IAAIA,CAAA,OAAJ,CACE,KAAUM,MAAJ,CAAU,uDAAV,CAAN;AAOAE,CAAA,CAFEG,CAAJ,WAAsBoD,WAAtB,CAEUpD,CAFV,CAGWA,CAAAA,OAAJ,WAA6B2D,YAA7B,CAIG,IAAIP,UAAJ,CAAepD,CAAAA,OAAf,CAJH,CASG,IAAIoD,UAAJ,CAAepD,CAAf,CAGV,OAAO0D,EAAA,CAAuC7D,CAAvC,CAtBuE,CAyBhFZ,EAAA,YAAA,CAAuBC,CACvBD,EAAA,YAAA,CAAuBE,CA/PN,CAAhB,CAAA,CAiQmB,WAAlB,GAAA,MAAOyE,OAAP,CAAgCA,MAAhC,CAA4D,WAAlB,GAAA,MAAOC,OAAP,CAAgCA,MAAhC,CAAyC,IAjQpF;", "sources":["text.js"], "names":["scope","FastTextEncoder","FastTextDecoder","utfLabel","options","fatal","validUtfLabels","indexOf","toLowerCase","RangeError","Error","decodeBuffer","bytes","Buffer","from","buffer","byteOffset","byteLength","toString","decodeSyncXHR","u","URL","createObjectURL","b","Blob","type","x","XMLHttpRequest","open","send","responseText","e","decodeFallback","revokeObjectURL","inputIndex","pendingSize","Math","min","length","pending","Uint16Array","chunks","pendingIndex","more","push","String","fromCharCode","apply","subarray","join","byte1","byte2","byte3","byte4","codepoint","Object","defineProperty","prototype","value","string","stream","pos","len","at","tlen","max","target","Uint8Array","charCodeAt","extra","update","set","slice","decodeImpl","ArrayBuffer","window","global"] }