@@ -338,25 +338,34 @@ describe('api', function() {
338
338
it ( 'gets page labels' , function ( ) {
339
339
// PageLabels with Roman/Arabic numerals.
340
340
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 ) {
342
343
return pdfDoc . getPageLabels ( ) ;
343
344
} ) ;
345
+
344
346
// PageLabels with only a label prefix.
345
347
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 ) {
347
350
return pdfDoc . getPageLabels ( ) ;
348
351
} ) ;
352
+
349
353
// PageLabels identical to standard page numbering.
350
354
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 ) {
352
357
return pdfDoc . getPageLabels ( ) ;
353
358
} ) ;
354
359
355
360
waitsForPromiseResolved ( Promise . all ( [ promise0 , promise1 , promise2 ] ) ,
356
361
function ( pageLabels ) {
357
362
expect ( pageLabels [ 0 ] ) . toEqual ( [ 'i' , 'ii' , 'iii' , '1' ] ) ;
358
363
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 ( ) ;
360
369
} ) ;
361
370
} ) ;
362
371
it ( 'gets attachments' , function ( ) {
0 commit comments