@@ -338,25 +338,34 @@ describe('api', function() {
338338 it ( 'gets page labels' , function ( ) {
339339 // PageLabels with Roman/Arabic numerals.
340340 var url0 = combineUrl ( window . location . href , '../pdfs/bug793632.pdf' ) ;
341- var promise0 = PDFJS . getDocument ( url0 ) . promise . then ( function ( pdfDoc ) {
341+ var loadingTask0 = PDFJS . getDocument ( url0 ) ;
342+ var promise0 = loadingTask0 . promise . then ( function ( pdfDoc ) {
342343 return pdfDoc . getPageLabels ( ) ;
343344 } ) ;
345+
344346 // PageLabels with only a label prefix.
345347 var url1 = combineUrl ( window . location . href , '../pdfs/issue1453.pdf' ) ;
346- var promise1 = PDFJS . getDocument ( url1 ) . promise . then ( function ( pdfDoc ) {
348+ var loadingTask1 = PDFJS . getDocument ( url1 ) ;
349+ var promise1 = loadingTask1 . promise . then ( function ( pdfDoc ) {
347350 return pdfDoc . getPageLabels ( ) ;
348351 } ) ;
352+
349353 // PageLabels identical to standard page numbering.
350354 var url2 = combineUrl ( window . location . href , '../pdfs/rotation.pdf' ) ;
351- var promise2 = PDFJS . getDocument ( url2 ) . promise . then ( function ( pdfDoc ) {
355+ var loadingTask2 = PDFJS . getDocument ( url2 ) ;
356+ var promise2 = loadingTask2 . promise . then ( function ( pdfDoc ) {
352357 return pdfDoc . getPageLabels ( ) ;
353358 } ) ;
354359
355360 waitsForPromiseResolved ( Promise . all ( [ promise0 , promise1 , promise2 ] ) ,
356361 function ( pageLabels ) {
357362 expect ( pageLabels [ 0 ] ) . toEqual ( [ 'i' , 'ii' , 'iii' , '1' ] ) ;
358363 expect ( pageLabels [ 1 ] ) . toEqual ( [ 'Front Page1' ] ) ;
359- expect ( pageLabels [ 2 ] ) . toEqual ( [ ] ) ;
364+ expect ( pageLabels [ 2 ] ) . toEqual ( [ '1' , '2' ] ) ;
365+
366+ loadingTask0 . destroy ( ) ;
367+ loadingTask1 . destroy ( ) ;
368+ loadingTask2 . destroy ( ) ;
360369 } ) ;
361370 } ) ;
362371 it ( 'gets attachments' , function ( ) {
0 commit comments