File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -789,6 +789,7 @@ export function connect(port) {
789789
790790 hostPort = port ;
791791 port . onmessage = onmessage ;
792+ // TODO: kthoom change for debugging.
792793 console . log ( `debugFetch: Connected host to unzip implementation` ) ;
793794}
794795
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ onmessage = async (evt) => {
2222 if ( evt . data . implSrc ) {
2323 module = await import ( evt . data . implSrc ) ;
2424 module . connect ( evt . ports [ 0 ] ) ;
25+ // TODO: kthoom change for debugging.
2526 postMessage ( 'connected' ) ;
2627 } else if ( evt . data . disconnect ) {
2728 module . disconnect ( ) ;
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ export class EPUBBookBinder extends BookBinder {
5050 constructor ( filenameOrUri , ab , totalExpectedSize ) {
5151 super ( filenameOrUri , ab , totalExpectedSize ) ;
5252
53+ if ( Params [ 'debugFetch' ] === 'true' ) {
54+ console . log ( `debugFetch: Constructing a EPUBBookBinder for ${ filenameOrUri } ` ) ;
55+ }
56+
5357 /**
5458 * A map of all files in the archive, keyed by its full path in the archive with the value
5559 * being the raw ArrayBuffer.
@@ -76,9 +80,13 @@ export class EPUBBookBinder extends BookBinder {
7680 /** @override */
7781 beforeStart_ ( ) {
7882 let firstFile = true ;
79- this . unarchiver . addEventListener ( UnarchiveEventType . EXTRACT , evt => {
83+ this . unarchiver . onExtract ( evt => {
8084 /** @type {import('../bitjs/archive/decompress.js').UnarchivedFile } */
8185 const theFile = evt . unarchivedFile ;
86+ if ( Params [ 'debugFetch' ] === 'true' && this . fileMap_ . has ( theFile . filename ) ) {
87+ // TODO: How does it get multiple extract events for the same file?
88+ debugger ;
89+ }
8290 this . fileMap_ . set ( theFile . filename , theFile . fileData ) ;
8391 if ( Params [ 'debugFetch' ] === 'true' ) {
8492 console . log ( `debugFetch: Extracted file ${ theFile . filename } of size ${ theFile . fileData . byteLength } ` ) ;
You can’t perform that action at this time.
0 commit comments