@@ -322,6 +322,10 @@ describe("document", function () {
322322 { ref : sigRef , data : sigDict } ,
323323 { ref : fieldRef , data : fieldDict } ,
324324 ] ) ;
325+ acroForm . assignXref ( xref ) ;
326+ sigDict . assignXref ( xref ) ;
327+ fieldDict . assignXref ( xref ) ;
328+
325329 acroForm . set ( "Fields" , [ fieldRef ] ) ;
326330
327331 const pdfDocument = getDocument ( acroForm , xref ) ;
@@ -362,6 +366,10 @@ describe("document", function () {
362366 { ref : sigRef , data : sigDict } ,
363367 { ref : fieldRef , data : fieldDict } ,
364368 ] ) ;
369+ acroForm . assignXref ( xref ) ;
370+ sigDict . assignXref ( xref ) ;
371+ fieldDict . assignXref ( xref ) ;
372+
365373 acroForm . set ( "Fields" , [ fieldRef ] ) ;
366374
367375 const documentStream = new StringStream (
@@ -386,6 +394,10 @@ describe("document", function () {
386394 { ref : sigRef , data : sigDict } ,
387395 { ref : fieldRef , data : fieldDict } ,
388396 ] ) ;
397+ acroForm . assignXref ( xref ) ;
398+ sigDict . assignXref ( xref ) ;
399+ fieldDict . assignXref ( xref ) ;
400+
389401 acroForm . set ( "Fields" , [ fieldRef ] ) ;
390402
391403 const documentStream = new StringStream (
@@ -418,6 +430,11 @@ describe("document", function () {
418430 { ref : sigFieldRef , data : sigField } ,
419431 { ref : containerRef , data : container } ,
420432 ] ) ;
433+ acroForm . assignXref ( xref ) ;
434+ sigDict . assignXref ( xref ) ;
435+ sigField . assignXref ( xref ) ;
436+ container . assignXref ( xref ) ;
437+
421438 acroForm . set ( "Fields" , [ containerRef ] ) ;
422439
423440 const pdfDocument = getDocument ( acroForm , xref ) ;
@@ -450,6 +467,11 @@ describe("document", function () {
450467 { ref : sigFieldRef , data : sigField } ,
451468 { ref : widgetRef , data : widget } ,
452469 ] ) ;
470+ acroForm . assignXref ( xref ) ;
471+ sigDict . assignXref ( xref ) ;
472+ sigField . assignXref ( xref ) ;
473+ widget . assignXref ( xref ) ;
474+
453475 acroForm . set ( "Fields" , [ sigFieldRef ] ) ;
454476
455477 const pdfDocument = getDocument ( acroForm , xref ) ;
@@ -472,6 +494,10 @@ describe("document", function () {
472494 { ref : sigRef , data : sigDict } ,
473495 { ref : fieldRef , data : fieldDict } ,
474496 ] ) ;
497+ acroForm . assignXref ( xref ) ;
498+ sigDict . assignXref ( xref ) ;
499+ fieldDict . assignXref ( xref ) ;
500+
475501 acroForm . set ( "Fields" , [ fieldRef ] ) ;
476502
477503 const pdfDocument = getDocument ( acroForm , xref ) ;
@@ -498,18 +524,21 @@ describe("document", function () {
498524 name : "Inner" ,
499525 } ) ;
500526
527+ const outerField = makeSigField ( { T : "outer" , sigRef : outerSigRef } ) ;
528+ const innerField = makeSigField ( { T : "inner" , sigRef : innerSigRef } ) ;
529+
501530 const xref = new XRefMock ( [
502531 { ref : outerSigRef , data : outerSig } ,
503- {
504- ref : outerFieldRef ,
505- data : makeSigField ( { T : "outer" , sigRef : outerSigRef } ) ,
506- } ,
532+ { ref : outerFieldRef , data : outerField } ,
507533 { ref : innerSigRef , data : innerSig } ,
508- {
509- ref : innerFieldRef ,
510- data : makeSigField ( { T : "inner" , sigRef : innerSigRef } ) ,
511- } ,
534+ { ref : innerFieldRef , data : innerField } ,
512535 ] ) ;
536+ acroForm . assignXref ( xref ) ;
537+ outerSig . assignXref ( xref ) ;
538+ innerSig . assignXref ( xref ) ;
539+ outerField . assignXref ( xref ) ;
540+ innerField . assignXref ( xref ) ;
541+
513542 acroForm . set ( "Fields" , [ outerFieldRef , innerFieldRef ] ) ;
514543
515544 const pdfDocument = getDocument ( acroForm , xref ) ;
@@ -535,14 +564,18 @@ describe("document", function () {
535564 byteRange : [ 0 , 10 , 20 , 30 ] ,
536565 subFilter,
537566 } ) ;
567+ const sigField = makeSigField ( { T : "sig" , sigRef } ) ;
568+
538569 const xref = new XRefMock ( [
539570 { ref : sigRef , data : sigDict } ,
540- {
541- ref : fieldRef ,
542- data : makeSigField ( { T : "sig" , sigRef } ) ,
543- } ,
571+ { ref : fieldRef , data : sigField } ,
544572 ] ) ;
573+ acroForm . assignXref ( xref ) ;
574+ sigDict . assignXref ( xref ) ;
575+ sigField . assignXref ( xref ) ;
576+
545577 acroForm . set ( "Fields" , [ fieldRef ] ) ;
578+
546579 const pdfDocument = getDocument ( acroForm , xref ) ;
547580 const [ sig ] = await pdfDocument . signatures ;
548581 return sig . signatureType ;
0 commit comments