mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
Added sendWithStream method in MessageHandler.
Adds functionality to accept Queueing Strategy in sendWithStream method. Using Queueing Strategy we can control the data that is enqueued into the sink, and hence regulated the flow of chunks from worker to main thread. Adds capability in pull and cancel methods. Adds ready and desiredSize property in streamSink. Adds unit test for ReadableStream and sendWithStream.
This commit is contained in:
parent
edd7d89fe5
commit
bbd9968f76
6 changed files with 653 additions and 40 deletions
|
@ -20,46 +20,46 @@ import {
|
|||
describe('util', function() {
|
||||
describe('stringToPDFString', function() {
|
||||
it('handles ISO Latin 1 strings', function() {
|
||||
var str = '\x8Dstring\x8E';
|
||||
let str = '\x8Dstring\x8E';
|
||||
expect(stringToPDFString(str)).toEqual('\u201Cstring\u201D');
|
||||
});
|
||||
|
||||
it('handles UTF-16BE strings', function() {
|
||||
var str = '\xFE\xFF\x00\x73\x00\x74\x00\x72\x00\x69\x00\x6E\x00\x67';
|
||||
let str = '\xFE\xFF\x00\x73\x00\x74\x00\x72\x00\x69\x00\x6E\x00\x67';
|
||||
expect(stringToPDFString(str)).toEqual('string');
|
||||
});
|
||||
|
||||
it('handles empty strings', function() {
|
||||
// ISO Latin 1
|
||||
var str1 = '';
|
||||
let str1 = '';
|
||||
expect(stringToPDFString(str1)).toEqual('');
|
||||
|
||||
// UTF-16BE
|
||||
var str2 = '\xFE\xFF';
|
||||
let str2 = '\xFE\xFF';
|
||||
expect(stringToPDFString(str2)).toEqual('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('removeNullCharacters', function() {
|
||||
it('should not modify string without null characters', function() {
|
||||
var str = 'string without null chars';
|
||||
let str = 'string without null chars';
|
||||
expect(removeNullCharacters(str)).toEqual('string without null chars');
|
||||
});
|
||||
|
||||
it('should modify string with null characters', function() {
|
||||
var str = 'string\x00With\x00Null\x00Chars';
|
||||
let str = 'string\x00With\x00Null\x00Chars';
|
||||
expect(removeNullCharacters(str)).toEqual('stringWithNullChars');
|
||||
});
|
||||
});
|
||||
|
||||
describe('ReadableStream', function() {
|
||||
it('should return an Object', function () {
|
||||
var readable = new ReadableStream();
|
||||
let readable = new ReadableStream();
|
||||
expect(typeof readable).toEqual('object');
|
||||
});
|
||||
|
||||
it('should have property getReader', function () {
|
||||
var readable = new ReadableStream();
|
||||
let readable = new ReadableStream();
|
||||
expect(typeof readable.getReader).toEqual('function');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue